#include "sys.h"
#include "delay.h"
#include "usart.h"
#include "led.h"
#include "oled.h"
int main(void)
{
u8 t=0;
NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);//设置系统中断优先级分组2
delay_init(168); //初始化延时函数
uart_init(115200); //初始化串口波特率为115200
LED_Init(); //初始化LED
OLED_Init(); //初始化OLED
OLED_ShowString(0,0,"ALIENTEK",24);
OLED_ShowString(0,24, "0.96' OLED TEST",16);
OLED_ShowString(0,40,"ATOM 2014/5/4",12);
OLED_ShowString(0,52,"ASCII:",12);
OLED_ShowString(64,52,"CODE:",12);
OLED_Refresh_Gram();//更新显示到OLED
t=' '; //空格对应的ASCLL码值为32,
//之所以将空格赋值给t,因为空格刚好对应oledfont.h中ASCII字符集点阵的起始位:0
//方便取oledfont.h中的ASCII字符
printf("t1:%d\r\n",t); //输出:32(十进制)
printf("t2:%c\r\n",t); //输出:空格
printf("t3:%f\r\n",(float)t); //输出:32.000000
while(1)
{
OLED_ShowChar(36,52,t,12,1);//显示ASCII字符
OLED_ShowNum(94,52,t,3,12); //显示ASCII字符的码值
OLED_Refresh_Gram(); //更新显示到OLED
t++;
if(t>'~')t=' '; //~对应的ASCLL码值为94
delay_ms(500);
LED0=!LED0;
}
} |