pic延时子程序,同过.EXE文件取出的值替换下面的代码,就能很好的实现延时。 1层循环例程: movlw 0X00 取值 movwf n0 incfsz n0 goto $-1 return 2层循环例程: movlw 0x11 外层 movwf n1 movlw 0X00 里层 movwf n0 incfsz n0 goto $-1 incfsz n1 goto $-5 return
上传时间: 2013-12-19
上传用户:lixinxiang
//温度数码管显示演示程序 //数码管位选信号 :由右到左为P20、P21、P22、P23、P24、P33 //数码管数据线 :P0口 //数码管数字码 :0 0xC0 1 0xF9 2 0xA4 3 0xB0 4 0x99 5 0x92 6 0x82 7 0xF8 8 0x80 9 0x90 //数码管带点码 :0 0x40 1 0x79 2 0x24 3 0x30 4 0x19 5 0x12 6 0x02 7 0x78 8 0X00 9 0x10 //18B20端口DQ :P27
上传时间: 2014-01-22
上传用户:古谷仁美
#include<reg52.h> #include<intrins.h> #define LED P0 sbit KEY0=P2^0; //定义按键输入端口 A sbit KEY1=P2^1; //定义按键输入端口 B sbit KEY2=P2^2; //定义按键输入端口 C unsigned int Led_table[8]={0xfe,0xfc,0xf8,0xf0,0xe0,0xc0,0x80,0X00}; char Led_num=0; unsigned int num=0; //中断计数 void delayms(unsigned int x) { unsigned int i,j;
标签: 单片机
上传时间: 2015-12-23
上传用户:kimyu
/* * _168ZHONGDUAN2.c * * Created: 2014/11/2 15:12:45 * Author: lenovo */ #include <avr/io.h> #include <avr/iom168pa.h> #include <avr/interrupt.h> #include <util/delay.h> #include <avr/eeprom.h> //#include <util/delay_basic.h> //unsigned char const SEGtable[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f,0x40}; #define BIT(x) (1<<(x)) #include<avr/signal.h> #include<avr/pgmspace.h> #include<util/delay.h> #include<avr/eeprom.h> #define setb(val,bitn) (val|=(1<<(bitn)))//设置某IO口某位为1 #define clr(val,bitn) (val&=~(1<<(bitn)))//设置某IO口某位为0 #define get(val,bitn) (val&(1<<(bitn)))//读取某位状态 //uchar ACT[8] ={0xfe,0xfd,0xfb,0xf7,0xef,0xdf,0xbf,0x7f}; #define CPL_BIT(x,y) (x^=(1<<y)) #define CLR_BIT(x,y) (x&=~(1<<y)) #define SET_1(a,b) a|=(1<<b) #define CLE_0(a,b) a&=~(1<<b) /*------宏定义------*/ #include <avr/wdt.h> #include <avr/sleep.h> #include <avr/interrupt.h> #include <avr/pgmspace.h> #include <util/delay.h> #include <avr/eeprom.h> #define setb(val,bitn) (val|=(1<<(bitn)))//设置某IO口某位为1 #define clr(val,bitn) (val&=~(1<<(bitn)))//设置某IO口某位为0 #define get(val,bitn) (val&(1<<(bitn)))//读取某位状态 #define uint8 unsigned char #define uint16 unsigned int #define P_LCDCS1 setb(PORTB,5) #define P_LCDCS0 clr(PORTB,5) #define P_LCDRST1 setb(PORTB,1) #define P_LCDRST0 clr(PORTB,1) #define P_LCDRS1 setb(PORTB,2) #define P_LCDRS0 clr(PORTB,2) #define P_LCDDAT1 setb(PORTB,4) #define P_LCDDAT0 clr(PORTB,4) #define P_LCDCLK1 setb(PORTB,3) #define P_LCDCLK0 clr(PORTB,3) //#define LCD_ //-----页地址定义----- #define Page1 0 #define Page2 1 #define Page3 2 #define Page4 3 #define Page5 4 #define Page6 5 #define Page7 6 #define Page8 7 //-----列地址定义-----每8列地址增1 #define List8_1 0 #define List8_2 7 #define List8_3 15 #define List8_4 23 #define List8_5 31 #define List8_6 39 #define List8_7 47 #define List8_8 55 #define List8_9 63 #define List8_10 71 #define List8_11 79 #define List8_12 87 #define List8_13 95 #define List8_14 103 #define List8_15 111 #define List8_16 119 //#define List8_17 127 //-----列地址定义-----每16列地址增1 #define List16_1 0 #define List16_2 15 #define List16_3 31 #define List16_4 47 #define List16_5 63 #define List16_6 79 #define List16_7 95 #define List16_8 111 //---------------------------------- #define STR_CHARG "Charge" //提示充电 #define STR_PRCE "%" //电量百分比 #define STR_ERR "Err" //出错显示 #define STR_OFF "OFF" //关机显示 //待机显示 #define STR_WAIT1 "Portable UPS" #define STR_WAIT2 "110V/60HZ" #define STR_WAIT3 "Select:DC OR AC" #define STR_WAIT4 "BATTERY:" //开机显示 #define STR_OUTSTATUS "Out Status:" #define STR_DCOUT12V "DC12V" #define STR_DCOUT5V "DC5V" #define STR_ACOUT "AC110V" //#define STR_MAOHAO ":" //====================================== extern uint8 LOCKA[2][16] ; //extern uint8 code BATS[10][16] ; extern uint8 BAT2S[12][32] ; extern uint8 NC[] ; extern uint8 mao_hao[] ; extern uint8 num1[] ; extern uint8 num2[] ; extern uint8 num3[] ; extern uint8 num4[] ; extern uint8 num5[] ; extern uint8 num6[] ; extern uint8 num7[] ; extern uint8 num8[] ; extern uint8 num9[] ; extern uint8 Tab_Ascii_8x16[95][16] ; extern uint8 Tab_Ascii_5x7[95][5] ; extern uint8 zhuang1[] ; extern uint8 tai1[] ; extern uint8 shi1[] ; extern uint8 yong1[] ; //---------------------------------- //extern void LcdWriteCommand(uint8 data1) ; extern void Display_Graphic_32x32(uint8 page,uint8 column,uint8 *dp) ; extern void Display_Graphic_32x16(uint8 page,uint8 column,uint8 *dp) ; extern void Display_Graphic_16x16(uint8 page,uint8 column,uint8 *dp) ; extern void Display_Graphic_8x16(uint8 page,uint8 column,uint8 *dp) ; extern void Display_String_8x16(uint8 page,uint8 column,uint8 *text) ; extern void Display_Num_8x16(uint8 page,uint8 column,uint8 Num) ; extern void Display_Digital_8x16(uint8 page,uint8 column,uint8 *a) ; extern void Display_Nop_8x16(uint8 page,uint8 column,uint8 DatLong) ; extern void Display_String_5x7(uint8 page,uint8 column,uint8 *text) ; extern void Full_Display(void) ; extern void Clear_Screen(void) ; extern void Init_lcd12864(void) ; //#endif //========c12864.c============================================== /*************************************************** LCD:晶联讯电子 JLX12864G-086-PN(不带字库IC-UC1701X) 仅支持串行驱动方式 ***************************************************/ //#include "global.h" //#include "c12864.h" #define Tab_Ascii_8x16_CALL1 //粗体字形 #define Tab_Ascii_8x16_CALL2 //细体字形 #define Tab_Ascii_5x7_CALL #define Display_Graphic_32x32_CALL #define Display_Graphic_32x16_CALL #define Display_Graphic_16x16_CALL #define Display_Graphic_8x16_CALL #define Display_String_8x16_CALL //显示字符串 #define Display_Num_8x16_CALL //显示单个数据0-9 #define Display_Digital_8x16_CALL //显示数据0-9999 #define Display_Nop_8x16_CALL //填充8*16的空字符N个 #define Display_String_5x7_CALL #define Full_Display_CALL //============================================================================== uint8 aa[]={0,1,2,3,4,5,6,7,8,9}; uint8 LOCKA[2][16]={ //-- 童锁符号 -- //-- 此字体下对应的点阵为:宽x高=16x16 -- //0X00, 0X00, 0xc0, 0xe0, 0xf0, 0xd8, 0xcc, 0xc4, 0xc4, 0xcc, 0xd8, 0xf0, 0xe0, 0xc0, 0X00, 0X00, //0X00, 0X00, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0X00, 0X00, 0X00, 0X00, 0xc0, 0xe0, 0xb0, 0x98, 0x8c, 0x8c, 0x8c, 0x8c, 0x98, 0xb0, 0xe0, 0xc0, 0X00, 0X00, 0X00, 0X00, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0X00, 0X00, } ; const PROGMEM uint8_t BATS[10][16]={ //-- 电池符号 -- //-- 此字体下对应的点阵为:宽x高=16x16 -- 0X00, 0X00, 0X00, 0xf8, 0x08, 0x08, 0x0c, 0x0e, 0x0e, 0x0c, 0x08, 0x08, 0xf8, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0x7f, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x7f, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0xf8, 0x08, 0x08, 0x0c, 0x0e, 0x0e, 0x0c, 0x08, 0x08, 0xf8, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0x7f, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x70, 0x7f, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0xf8, 0x08, 0x08, 0x0c, 0x0e, 0x0e, 0x0c, 0x08, 0x08, 0xf8, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0x7f, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7e, 0x7f, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0xf8, 0xc8, 0xc8, 0xcc, 0xce, 0xce, 0xcc, 0xc8, 0xc8, 0xf8, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0xf8, 0xf8, 0xf8, 0xfc, 0xfe, 0xfe, 0xfc, 0xf8, 0xf8, 0xf8, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0X00, 0X00, 0X00, }; const PROGMEM uint8_t BAT2S1[12][32]={ /*-- 电池符号 --*/ /*-- 此字体下对应的点阵为:宽x高=32x16 --*/ {0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0xf8, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0xf8, 0xc0, 0x80}, {0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0x3f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3f, 0x07, 0x03}, {0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0xf8, 0x08, 0x08, 0xe8, 0xe8, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0xf8, 0xc0, 0x80}, {0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0x3f, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3f, 0x07, 0x03}, {0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0xf8, 0x08, 0x08, 0xe8, 0xe8, 0x08, 0x08, 0xe8, 0xe8, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0xf8, 0xc0, 0x80}, {0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0x3f, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3f, 0x07, 0x03}, {0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0xf8, 0x08, 0x08, 0xe8, 0xe8, 0x08, 0x08, 0xe8, 0xe8, 0x08, 0x08, 0xe8, 0xe8, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0xf8, 0xc0, 0x80}, {0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0x3f, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3f, 0x07, 0x03}, {0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0xf8, 0x08, 0x08, 0xe8, 0xe8, 0x08, 0x08, 0xe8, 0xe8, 0x08, 0x08, 0xe8, 0xe8, 0x08, 0x08, 0xe8, 0xe8, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0xf8, 0xc0, 0x80}, {0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0x3f, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3f, 0x07, 0x03}, {0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0xf8, 0x08, 0x08, 0xe8, 0xe8, 0x08, 0x08, 0xe8, 0xe8, 0x08, 0x08, 0xe8, 0xe8, 0x08, 0x08, 0xe8, 0xe8, 0x08, 0x08, 0xe8, 0xe8, 0x08, 0x08, 0xf8, 0xc0, 0x80}, {0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0x3f, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x2f, 0x2f, 0x20, 0x20, 0x3f, 0x07, 0x03}, } ; const PROGMEM uint8_t BAT2S2[2][32]={ //-- 电池符号 不显示 -- //-- 此字体下对应的点阵为:宽x高=32x16 -- 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, 0X00, } ; uint8 NC[]={ /*-- 文字: 空符号 --*/ 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, } ; uint8 mao_hao[]={ /*-- 文字: : (冒号) --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0X00,0X00,0X00,0xC0,0xC0,0X00,0X00,0X00,0X00,0X00,0X00,0x30,0x30,0X00,0X00,0X00}; uint8 num0[]={ /*-- 文字: 0 --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0X00,0xE0,0x10,0x08,0x08,0x10,0xE0,0X00,0X00,0x0F,0x10,0x20,0x20,0x10,0x0F,0X00 }; uint8 num1[]={ /*-- 文字: 1 --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0X00,0x10,0x10,0xF8,0X00,0X00,0X00,0X00,0X00,0x20,0x20,0x3F,0x20,0x20,0X00,0X00 }; uint8 num2[]={ /*-- 文字: 2 --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0X00,0x70,0x08,0x08,0x08,0x88,0x70,0X00,0X00,0x30,0x28,0x24,0x22,0x21,0x30,0X00 //细体 //0x08,0x0C,0x84,0xC4,0x64,0x3C,0x18,0X00,0x0E,0x0F,0x09,0x08,0x08,0x0C,0x0C,0X00, // 粗体 }; uint8 num3[]={ /*-- 文字: 3 --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0X00,0x30,0x08,0x88,0x88,0x48,0x30,0X00,0X00,0x18,0x20,0x20,0x20,0x11,0x0E,0X00 }; uint8 num4[]={ /*-- 文字: 4 --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0X00,0X00,0xC0,0x20,0x10,0xF8,0X00,0X00,0X00,0x07,0x04,0x24,0x24,0x3F,0x24,0X00 }; uint8 num5[]={ /*-- 文字: 5 --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0X00,0xF8,0x08,0x88,0x88,0x08,0x08,0X00,0X00,0x19,0x21,0x20,0x20,0x11,0x0E,0X00 }; uint8 num6[]={ /*-- 文字: 6 --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0X00,0xE0,0x10,0x88,0x88,0x18,0X00,0X00,0X00,0x0F,0x11,0x20,0x20,0x11,0x0E,0X00 }; uint8 num7[]={ /*-- 文字: 7 --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0X00,0x38,0x08,0x08,0xC8,0x38,0x08,0X00,0X00,0X00,0X00,0x3F,0X00,0X00,0X00,0X00 }; uint8 num8[]={ /*-- 文字: 8 --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0X00,0x70,0x88,0x08,0x08,0x88,0x70,0X00,0X00,0x1C,0x22,0x21,0x21,0x22,0x1C,0X00 }; uint8 num9[]={ /*-- 文字: 9 --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0X00,0xE0,0x10,0x08,0x08,0x10,0xE0,0X00,0X00,0X00,0x31,0x22,0x22,0x11,0x0F,0X00 }; //=======8x16======================================================================= #ifdef Display_String_8x16_CALL //Tab_Ascii_8x16_CALL const PROGMEM uint8_t Tab_Ascii_8x161[95][16]={ //粗体字形 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, // - - 0X00,0X00,0x38,0xFC,0xFC,0x38,0X00,0X00,0X00,0X00,0X00,0x0D,0x0D,0X00,0X00,0X00, // -!- 0X00,0x0E,0x1E,0X00,0X00,0x1E,0x0E,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, // -"- 0x20,0xF8,0xF8,0x20,0xF8,0xF8,0x20,0X00,0x02,0x0F,0x0F,0x02,0x0F,0x0F,0x02,0X00, // -#- 0x38,0x7C,0x44,0x47,0x47,0xCC,0x98,0X00,0x03,0x06,0x04,0x1C,0x1C,0x07,0x03,0X00, // -$- 0x30,0x30,0X00,0x80,0xC0,0x60,0x30,0X00,0x0C,0x06,0x03,0x01,0X00,0x0C,0x0C,0X00, // -%- 0x80,0xD8,0x7C,0xE4,0xBC,0xD8,0x40,0X00,0x07,0x0F,0x08,0x08,0x07,0x0F,0x08,0X00, // -&- 0X00,0x10,0x1E,0x0E,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, // -'- 0X00,0X00,0xF0,0xF8,0x0C,0x04,0X00,0X00,0X00,0X00,0x03,0x07,0x0C,0x08,0X00,0X00, // -(- 0X00,0X00,0x04,0x0C,0xF8,0xF0,0X00,0X00,0X00,0X00,0x08,0x0C,0x07,0x03,0X00,0X00, // -)- 0x80,0xA0,0xE0,0xC0,0xC0,0xE0,0xA0,0x80,0X00,0x02,0x03,0x01,0x01,0x03,0x02,0X00, // -*- 0X00,0x80,0x80,0xE0,0xE0,0x80,0x80,0X00,0X00,0X00,0X00,0x03,0x03,0X00,0X00,0X00, // -+- 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0x10,0x1E,0x0E,0X00,0X00,0X00, // -,- 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, // --- 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0x0C,0x0C,0X00,0X00,0X00, // -.- 0X00,0X00,0X00,0x80,0xC0,0x60,0x30,0X00,0x0C,0x06,0x03,0x01,0X00,0X00,0X00,0X00, // -/- 0xF8,0xFC,0x04,0xC4,0x24,0xFC,0xF8,0X00,0x07,0x0F,0x09,0x08,0x08,0x0F,0x07,0X00, // -0- 0X00,0x10,0x18,0xFC,0xFC,0X00,0X00,0X00,0X00,0x08,0x08,0x0F,0x0F,0x08,0x08,0X00, // -1- 0x08,0x0C,0x84,0xC4,0x64,0x3C,0x18,0X00,0x0E,0x0F,0x09,0x08,0x08,0x0C,0x0C,0X00, // -2- 0x08,0x0C,0x44,0x44,0x44,0xFC,0xB8,0X00,0x04,0x0C,0x08,0x08,0x08,0x0F,0x07,0X00, // -3- 0xC0,0xE0,0xB0,0x98,0xFC,0xFC,0x80,0X00,0X00,0X00,0X00,0x08,0x0F,0x0F,0x08,0X00, // -4- 0x7C,0x7C,0x44,0x44,0xC4,0xC4,0x84,0X00,0x04,0x0C,0x08,0x08,0x08,0x0F,0x07,0X00, // -5- 0xF0,0xF8,0x4C,0x44,0x44,0xC0,0x80,0X00,0x07,0x0F,0x08,0x08,0x08,0x0F,0x07,0X00, // -6- 0x0C,0x0C,0x04,0x84,0xC4,0x7C,0x3C,0X00,0X00,0X00,0x0F,0x0F,0X00,0X00,0X00,0X00, // -7- 0xB8,0xFC,0x44,0x44,0x44,0xFC,0xB8,0X00,0x07,0x0F,0x08,0x08,0x08,0x0F,0x07,0X00, // -8- 0x38,0x7C,0x44,0x44,0x44,0xFC,0xF8,0X00,0X00,0x08,0x08,0x08,0x0C,0x07,0x03,0X00, // -9- 0X00,0X00,0X00,0x30,0x30,0X00,0X00,0X00,0X00,0X00,0X00,0x06,0x06,0X00,0X00,0X00, // -:- 0X00,0X00,0X00,0x30,0x30,0X00,0X00,0X00,0X00,0X00,0x08,0x0E,0x06,0X00,0X00,0X00, // -;- 0X00,0x80,0xC0,0x60,0x30,0x18,0x08,0X00,0X00,0X00,0x01,0x03,0x06,0x0C,0x08,0X00, // -<- 0x40,0x40,0x40,0x40,0x40,0x40,0x40,0X00,0x02,0x02,0x02,0x02,0x02,0x02,0x02,0X00, // -=- 0X00,0x08,0x18,0x30,0x60,0xC0,0x80,0X00,0X00,0x08,0x0C,0x06,0x03,0x01,0X00,0X00, // ->- 0x18,0x1C,0x04,0xC4,0xE4,0x3C,0x18,0X00,0X00,0X00,0X00,0x0D,0x0D,0X00,0X00,0X00, // -?- 0xF0,0xF8,0x08,0xC8,0xC8,0xF8,0xF0,0X00,0x07,0x0F,0x08,0x0B,0x0B,0x0B,0x01,0X00, // -@- 0xE0,0xF0,0x98,0x8C,0x98,0xF0,0xE0,0X00,0x0F,0x0F,0X00,0X00,0X00,0x0F,0x0F,0X00, // -A- 0x04,0xFC,0xFC,0x44,0x44,0xFC,0xB8,0X00,0x08,0x0F,0x0F,0x08,0x08,0x0F,0x07,0X00, // -B- 0xF0,0xF8,0x0C,0x04,0x04,0x0C,0x18,0X00,0x03,0x07,0x0C,0x08,0x08,0x0C,0x06,0X00, // -C- 0x04,0xFC,0xFC,0x04,0x0C,0xF8,0xF0,0X00,0x08,0x0F,0x0F,0x08,0x0C,0x07,0x03,0X00, // -D- 0x04,0xFC,0xFC,0x44,0xE4,0x0C,0x1C,0X00,0x08,0x0F,0x0F,0x08,0x08,0x0C,0x0E,0X00, // -E- 0x04,0xFC,0xFC,0x44,0xE4,0x0C,0x1C,0X00,0x08,0x0F,0x0F,0x08,0X00,0X00,0X00,0X00, // -F- 0xF0,0xF8,0x0C,0x84,0x84,0x8C,0x98,0X00,0x03,0x07,0x0C,0x08,0x08,0x07,0x0F,0X00, // -G- 0xFC,0xFC,0x40,0x40,0x40,0xFC,0xFC,0X00,0x0F,0x0F,0X00,0X00,0X00,0x0F,0x0F,0X00, // -H- 0X00,0X00,0x04,0xFC,0xFC,0x04,0X00,0X00,0X00,0X00,0x08,0x0F,0x0F,0x08,0X00,0X00, // -I- 0X00,0X00,0X00,0x04,0xFC,0xFC,0x04,0X00,0x07,0x0F,0x08,0x08,0x0F,0x07,0X00,0X00, // -J- 0x04,0xFC,0xFC,0xC0,0xF0,0x3C,0x0C,0X00,0x08,0x0F,0x0F,0X00,0x01,0x0F,0x0E,0X00, // -K- 0x04,0xFC,0xFC,0x04,0X00,0X00,0X00,0X00,0x08,0x0F,0x0F,0x08,0x08,0x0C,0x0E,0X00, // -L- 0xFC,0xFC,0x38,0x70,0x38,0xFC,0xFC,0X00,0x0F,0x0F,0X00,0X00,0X00,0x0F,0x0F,0X00, // -M- 0xFC,0xFC,0x38,0x70,0xE0,0xFC,0xFC,0X00,0x0F,0x0F,0X00,0X00,0X00,0x0F,0x0F,0X00, // -N- 0xF0,0xF8,0x0C,0x04,0x0C,0xF8,0xF0,0X00,0x03,0x07,0x0C,0x08,0x0C,0x07,0x03,0X00, // -O- 0x04,0xFC,0xFC,0x44,0x44,0x7C,0x38,0X00,0x08,0x0F,0x0F,0x08,0X00,0X00,0X00,0X00, // -P- 0xF8,0xFC,0x04,0x04,0x04,0xFC,0xF8,0X00,0x07,0x0F,0x08,0x0E,0x3C,0x3F,0x27,0X00, // -Q- 0x04,0xFC,0xFC,0x44,0xC4,0xFC,0x38,0X00,0x08,0x0F,0x0F,0X00,0X00,0x0F,0x0F,0X00, // -R- 0x18,0x3C,0x64,0x44,0xC4,0x9C,0x18,0X00,0x06,0x0E,0x08,0x08,0x08,0x0F,0x07,0X00, // -S- 0X00,0x1C,0x0C,0xFC,0xFC,0x0C,0x1C,0X00,0X00,0X00,0x08,0x0F,0x0F,0x08,0X00,0X00, // -T- 0xFC,0xFC,0X00,0X00,0X00,0xFC,0xFC,0X00,0x07,0x0F,0x08,0x08,0x08,0x0F,0x07,0X00, // -U- 0xFC,0xFC,0X00,0X00,0X00,0xFC,0xFC,0X00,0x01,0x03,0x06,0x0C,0x06,0x03,0x01,0X00, // -V- 0xFC,0xFC,0X00,0x80,0X00,0xFC,0xFC,0X00,0x03,0x0F,0x0E,0x03,0x0E,0x0F,0x03,0X00, // -W- 0x0C,0x3C,0xF0,0xC0,0xF0,0x3C,0x0C,0X00,0x0C,0x0F,0x03,0X00,0x03,0x0F,0x0C,0X00, // -X- 0X00,0x3C,0x7C,0xC0,0xC0,0x7C,0x3C,0X00,0X00,0X00,0x08,0x0F,0x0F,0x08,0X00,0X00, // -Y- 0x1C,0x0C,0x84,0xC4,0x64,0x3C,0x1C,0X00,0x0E,0x0F,0x09,0x08,0x08,0x0C,0x0E,0X00, // -Z- 0X00,0X00,0xFC,0xFC,0x04,0x04,0X00,0X00,0X00,0X00,0x0F,0x0F,0x08,0x08,0X00,0X00, // -[- 0x38,0x70,0xE0,0xC0,0x80,0X00,0X00,0X00,0X00,0X00,0X00,0x01,0x03,0x07,0x0E,0X00, // -\- 0X00,0X00,0x04,0x04,0xFC,0xFC,0X00,0X00,0X00,0X00,0x08,0x08,0x0F,0x0F,0X00,0X00, // -]- 0x08,0x0C,0x06,0x03,0x06,0x0C,0x08,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, // -^- 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20, // -_- 0X00,0X00,0x03,0x07,0x04,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, // -`- 0X00,0xA0,0xA0,0xA0,0xE0,0xC0,0X00,0X00,0x07,0x0F,0x08,0x08,0x07,0x0F,0x08,0X00, // -a- 0x04,0xFC,0xFC,0x20,0x60,0xC0,0x80,0X00,0x08,0x0F,0x07,0x08,0x08,0x0F,0x07,0X00, // -b- 0xC0,0xE0,0x20,0x20,0x20,0x60,0x40,0X00,0x07,0x0F,0x08,0x08,0x08,0x0C,0x04,0X00, // -c- 0x80,0xC0,0x60,0x24,0xFC,0xFC,0X00,0X00,0x07,0x0F,0x08,0x08,0x07,0x0F,0x08,0X00, // -d- 0xC0,0xE0,0xA0,0xA0,0xA0,0xE0,0xC0,0X00,0x07,0x0F,0x08,0x08,0x08,0x0C,0x04,0X00, // -e- 0x40,0xF8,0xFC,0x44,0x0C,0x18,0X00,0X00,0x08,0x0F,0x0F,0x08,0X00,0X00,0X00,0X00, // -f- 0xC0,0xE0,0x20,0x20,0xC0,0xE0,0x20,0X00,0x27,0x6F,0x48,0x48,0x7F,0x3F,0X00,0X00, // -g- 0x04,0xFC,0xFC,0x40,0x20,0xE0,0xC0,0X00,0x08,0x0F,0x0F,0X00,0X00,0x0F,0x0F,0X00, // -h- 0X00,0X00,0x20,0xEC,0xEC,0X00,0X00,0X00,0X00,0X00,0x08,0x0F,0x0F,0x08,0X00,0X00, // -i- 0X00,0X00,0X00,0X00,0x20,0xEC,0xEC,0X00,0X00,0x30,0x70,0x40,0x40,0x7F,0x3F,0X00, // -j- 0x04,0xFC,0xFC,0x80,0xC0,0x60,0x20,0X00,0x08,0x0F,0x0F,0x01,0x03,0x0E,0x0C,0X00, // -k- 0X00,0X00,0x04,0xFC,0xFC,0X00,0X00,0X00,0X00,0X00,0x08,0x0F,0x0F,0x08,0X00,0X00, // -l- 0xE0,0xE0,0x60,0xC0,0x60,0xE0,0xC0,0X00,0x0F,0x0F,0X00,0x0F,0X00,0x0F,0x0F,0X00, // -m- 0x20,0xE0,0xC0,0x20,0x20,0xE0,0xC0,0X00,0X00,0x0F,0x0F,0X00,0X00,0x0F,0x0F,0X00, // -n- 0xC0,0xE0,0x20,0x20,0x20,0xE0,0xC0,0X00,0x07,0x0F,0x08,0x08,0x08,0x0F,0x07,0X00, // -o- 0x20,0xE0,0xC0,0x20,0x20,0xE0,0xC0,0X00,0x40,0x7F,0x7F,0x48,0x08,0x0F,0x07,0X00, // -p- 0xC0,0xE0,0x20,0x20,0xC0,0xE0,0x20,0X00,0x07,0x0F,0x08,0x48,0x7F,0x7F,0x40,0X00, // -q- 0x20,0xE0,0xC0,0x60,0x20,0x60,0xC0,0X00,0x08,0x0F,0x0F,0x08,0X00,0X00,0X00,0X00, // -r- 0x40,0xE0,0xA0,0x20,0x20,0x60,0x40,0X00,0x04,0x0C,0x09,0x09,0x0B,0x0E,0x04,0X00, // -s- 0x20,0x20,0xF8,0xFC,0x20,0x20,0X00,0X00,0X00,0X00,0x07,0x0F,0x08,0x0C,0x04,0X00, // -t- 0xE0,0xE0,0X00,0X00,0xE0,0xE0,0X00,0X00,0x07,0x0F,0x08,0x08,0x07,0x0F,0x08,0X00, // -u- 0X00,0xE0,0xE0,0X00,0X00,0xE0,0xE0,0X00,0X00,0x03,0x07,0x0C,0x0C,0x07,0x03,0X00, // -v- 0xE0,0xE0,0X00,0X00,0X00,0xE0,0xE0,0X00,0x07,0x0F,0x0C,0x07,0x0C,0x0F,0x07,0X00, // -w- 0x20,0x60,0xC0,0x80,0xC0,0x60,0x20,0X00,0x08,0x0C,0x07,0x03,0x07,0x0C,0x08,0X00, // -x- 0xE0,0xE0,0X00,0X00,0X00,0xE0,0xE0,0X00,0x47,0x4F,0x48,0x48,0x68,0x3F,0x1F,0X00, // -y- 0x60,0x60,0x20,0xA0,0xE0,0x60,0x20,0X00,0x0C,0x0E,0x0B,0x09,0x08,0x0C,0x0C,0X00, // -z- 0X00,0x40,0x40,0xF8,0xBC,0x04,0x04,0X00,0X00,0X00,0X00,0x07,0x0F,0x08,0x08,0X00, // -{- 0X00,0X00,0X00,0xBC,0xBC,0X00,0X00,0X00,0X00,0X00,0X00,0x0F,0x0F,0X00,0X00,0X00, // -|- 0X00,0x04,0x04,0xBC,0xF8,0x40,0x40,0X00,0X00,0x08,0x08,0x0F,0x07,0X00,0X00,0X00, // -}- 0x08,0x0C,0x04,0x0C,0x08,0x0C,0x04,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, // -~- } ; #endif //Tab_Ascii_8x16_CALL1 //=======8x16======================================================================= //#ifdef Tab_Ascii_8x16_CALL2 // #ifdef Display_Num_8x16_CALL const PROGMEM uint8_t Tab_Ascii_8x162[95][16]={ //细体字形 /*-- 文字: --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, /*-- 文字: ! --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0X00,0X00,0X00,0xF8,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0x33,0x30,0X00,0X00,0X00, /*-- 文字: " --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0X00,0x10,0x0C,0x06,0x10,0x0C,0x06,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, /*-- 文字: # --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0x40,0xC0,0x78,0x40,0xC0,0x78,0x40,0X00,0x04,0x3F,0x04,0x04,0x3F,0x04,0x04,0X00, /*-- 文字: $ --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0X00,0x70,0x88,0xFC,0x08,0x30,0X00,0X00,0X00,0x18,0x20,0xFF,0x21,0x1E,0X00,0X00, /*-- 文字: % --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0xF0,0x08,0xF0,0X00,0xE0,0x18,0X00,0X00,0X00,0x21,0x1C,0x03,0x1E,0x21,0x1E,0X00, /*-- 文字: & --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0X00,0xF0,0x08,0x88,0x70,0X00,0X00,0X00,0x1E,0x21,0x23,0x24,0x19,0x27,0x21,0x10, /*-- 文字: ' --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0x10,0x16,0x0E,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, /*-- 文字: ( --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0X00,0X00,0X00,0xE0,0x18,0x04,0x02,0X00,0X00,0X00,0X00,0x07,0x18,0x20,0x40,0X00, /*-- 文字: ) --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0X00,0x02,0x04,0x18,0xE0,0X00,0X00,0X00,0X00,0x40,0x20,0x18,0x07,0X00,0X00,0X00, /*-- 文字: * --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0x40,0x40,0x80,0xF0,0x80,0x40,0x40,0X00,0x02,0x02,0x01,0x0F,0x01,0x02,0x02,0X00, /*-- 文字: + --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0X00,0X00,0X00,0xF0,0X00,0X00,0X00,0X00,0x01,0x01,0x01,0x1F,0x01,0x01,0x01,0X00, /*-- 文字: , --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0x80,0xB0,0x70,0X00,0X00,0X00,0X00,0X00, /*-- 文字: - --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0x01,0x01,0x01,0x01,0x01,0x01,0x01, /*-- 文字: . --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0x30,0x30,0X00,0X00,0X00,0X00,0X00, /*-- 文字: / --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0X00,0X00,0X00,0X00,0x80,0x60,0x18,0x04,0X00,0x60,0x18,0x06,0x01,0X00,0X00,0X00, /*-- 文字: 0 --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0X00,0xE0,0x10,0x08,0x08,0x10,0xE0,0X00,0X00,0x0F,0x10,0x20,0x20,0x10,0x0F,0X00, /*-- 文字: 1 --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0X00,0x10,0x10,0xF8,0X00,0X00,0X00,0X00,0X00,0x20,0x20,0x3F,0x20,0x20,0X00,0X00, /*-- 文字: 2 --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0X00,0x70,0x08,0x08,0x08,0x88,0x70,0X00,0X00,0x30,0x28,0x24,0x22,0x21,0x30,0X00, /*-- 文字: 3 --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0X00,0x30,0x08,0x88,0x88,0x48,0x30,0X00,0X00,0x18,0x20,0x20,0x20,0x11,0x0E,0X00, /*-- 文字: 4 --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0X00,0X00,0xC0,0x20,0x10,0xF8,0X00,0X00,0X00,0x07,0x04,0x24,0x24,0x3F,0x24,0X00, /*-- 文字: 5 --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0X00,0xF8,0x08,0x88,0x88,0x08,0x08,0X00,0X00,0x19,0x21,0x20,0x20,0x11,0x0E,0X00, /*-- 文字: 6 --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0X00,0xE0,0x10,0x88,0x88,0x18,0X00,0X00,0X00,0x0F,0x11,0x20,0x20,0x11,0x0E,0X00, /*-- 文字: 7 --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0X00,0x38,0x08,0x08,0xC8,0x38,0x08,0X00,0X00,0X00,0X00,0x3F,0X00,0X00,0X00,0X00, /*-- 文字: 8 --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0X00,0x70,0x88,0x08,0x08,0x88,0x70,0X00,0X00,0x1C,0x22,0x21,0x21,0x22,0x1C,0X00, /*-- 文字: 9 --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0X00,0xE0,0x10,0x08,0x08,0x10,0xE0,0X00,0X00,0X00,0x31,0x22,0x22,0x11,0x0F,0X00, /*-- 文字: : --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0X00,0X00,0X00,0xC0,0xC0,0X00,0X00,0X00,0X00,0X00,0X00,0x30,0x30,0X00,0X00,0X00, /*-- 文字: ; --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0X00,0X00,0X00,0x80,0X00,0X00,0X00,0X00,0X00,0X00,0x80,0x60,0X00,0X00,0X00,0X00, /*-- 文字: < --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0X00,0X00,0x80,0x40,0x20,0x10,0x08,0X00,0X00,0x01,0x02,0x04,0x08,0x10,0x20,0X00, /*-- 文字: = --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0x40,0x40,0x40,0x40,0x40,0x40,0x40,0X00,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0X00, /*-- 文字: > --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0X00,0x08,0x10,0x20,0x40,0x80,0X00,0X00,0X00,0x20,0x10,0x08,0x04,0x02,0x01,0X00, /*-- 文字: ? --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0X00,0x70,0x48,0x08,0x08,0x08,0xF0,0X00,0X00,0X00,0X00,0x30,0x36,0x01,0X00,0X00, /*-- 文字: @ --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0xC0,0x30,0xC8,0x28,0xE8,0x10,0xE0,0X00,0x07,0x18,0x27,0x24,0x23,0x14,0x0B,0X00, /*-- 文字: A --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0X00,0X00,0xC0,0x38,0xE0,0X00,0X00,0X00,0x20,0x3C,0x23,0x02,0x02,0x27,0x38,0x20, /*-- 文字: B --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0x08,0xF8,0x88,0x88,0x88,0x70,0X00,0X00,0x20,0x3F,0x20,0x20,0x20,0x11,0x0E,0X00, /*-- 文字: C --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0xC0,0x30,0x08,0x08,0x08,0x08,0x38,0X00,0x07,0x18,0x20,0x20,0x20,0x10,0x08,0X00, /*-- 文字: D --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0x08,0xF8,0x08,0x08,0x08,0x10,0xE0,0X00,0x20,0x3F,0x20,0x20,0x20,0x10,0x0F,0X00, /*-- 文字: E --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0x08,0xF8,0x88,0x88,0xE8,0x08,0x10,0X00,0x20,0x3F,0x20,0x20,0x23,0x20,0x18,0X00, /*-- 文字: F --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0x08,0xF8,0x88,0x88,0xE8,0x08,0x10,0X00,0x20,0x3F,0x20,0X00,0x03,0X00,0X00,0X00, /*-- 文字: G --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0xC0,0x30,0x08,0x08,0x08,0x38,0X00,0X00,0x07,0x18,0x20,0x20,0x22,0x1E,0x02,0X00, /*-- 文字: H --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0x08,0xF8,0x08,0X00,0X00,0x08,0xF8,0x08,0x20,0x3F,0x21,0x01,0x01,0x21,0x3F,0x20, /*-- 文字: I --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0X00,0x08,0x08,0xF8,0x08,0x08,0X00,0X00,0X00,0x20,0x20,0x3F,0x20,0x20,0X00,0X00, /*-- 文字: J --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0X00,0X00,0x08,0x08,0xF8,0x08,0x08,0X00,0xC0,0x80,0x80,0x80,0x7F,0X00,0X00,0X00, /*-- 文字: K --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0x08,0xF8,0x88,0xC0,0x28,0x18,0x08,0X00,0x20,0x3F,0x20,0x01,0x26,0x38,0x20,0X00, /*-- 文字: L --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0x08,0xF8,0x08,0X00,0X00,0X00,0X00,0X00,0x20,0x3F,0x20,0x20,0x20,0x20,0x30,0X00, /*-- 文字: M --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0x08,0xF8,0xF8,0X00,0xF8,0xF8,0x08,0X00,0x20,0x3F,0X00,0x3F,0X00,0x3F,0x20,0X00, /*-- 文字: N --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0x08,0xF8,0x30,0xC0,0X00,0x08,0xF8,0x08,0x20,0x3F,0x20,0X00,0x07,0x18,0x3F,0X00, /*-- 文字: O --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0xE0,0x10,0x08,0x08,0x08,0x10,0xE0,0X00,0x0F,0x10,0x20,0x20,0x20,0x10,0x0F,0X00, /*-- 文字: P --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0x08,0xF8,0x08,0x08,0x08,0x08,0xF0,0X00,0x20,0x3F,0x21,0x01,0x01,0x01,0X00,0X00, /*-- 文字: Q --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0xE0,0x10,0x08,0x08,0x08,0x10,0xE0,0X00,0x0F,0x18,0x24,0x24,0x38,0x50,0x4F,0X00, /*-- 文字: R --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0x08,0xF8,0x88,0x88,0x88,0x88,0x70,0X00,0x20,0x3F,0x20,0X00,0x03,0x0C,0x30,0x20, /*-- 文字: S --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0X00,0x70,0x88,0x08,0x08,0x08,0x38,0X00,0X00,0x38,0x20,0x21,0x21,0x22,0x1C,0X00, /*-- 文字: T --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0x18,0x08,0x08,0xF8,0x08,0x08,0x18,0X00,0X00,0X00,0x20,0x3F,0x20,0X00,0X00,0X00, /*-- 文字: U --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0x08,0xF8,0x08,0X00,0X00,0x08,0xF8,0x08,0X00,0x1F,0x20,0x20,0x20,0x20,0x1F,0X00, /*-- 文字: V --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0x08,0x78,0x88,0X00,0X00,0xC8,0x38,0x08,0X00,0X00,0x07,0x38,0x0E,0x01,0X00,0X00, /*-- 文字: W --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0xF8,0x08,0X00,0xF8,0X00,0x08,0xF8,0X00,0x03,0x3C,0x07,0X00,0x07,0x3C,0x03,0X00, /*-- 文字: X --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0x08,0x18,0x68,0x80,0x80,0x68,0x18,0x08,0x20,0x30,0x2C,0x03,0x03,0x2C,0x30,0x20, /*-- 文字: Y --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0x08,0x38,0xC8,0X00,0xC8,0x38,0x08,0X00,0X00,0X00,0x20,0x3F,0x20,0X00,0X00,0X00, /*-- 文字: Z --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0x10,0x08,0x08,0x08,0xC8,0x38,0x08,0X00,0x20,0x38,0x26,0x21,0x20,0x20,0x18,0X00, /*-- 文字: [ --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0X00,0X00,0X00,0xFE,0x02,0x02,0x02,0X00,0X00,0X00,0X00,0x7F,0x40,0x40,0x40,0X00, /*-- 文字: \ --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0X00,0x0C,0x30,0xC0,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0x01,0x06,0x38,0xC0,0X00, /*-- 文字: ] --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0X00,0x02,0x02,0x02,0xFE,0X00,0X00,0X00,0X00,0x40,0x40,0x40,0x7F,0X00,0X00,0X00, /*-- 文字: ^ --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0X00,0X00,0x04,0x02,0x02,0x02,0x04,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, /*-- 文字: _ --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80, /*-- 文字: ` --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0X00,0x02,0x02,0x04,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00, /*-- 文字: a --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0X00,0X00,0x80,0x80,0x80,0x80,0X00,0X00,0X00,0x19,0x24,0x22,0x22,0x22,0x3F,0x20, /*-- 文字: b --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0x08,0xF8,0X00,0x80,0x80,0X00,0X00,0X00,0X00,0x3F,0x11,0x20,0x20,0x11,0x0E,0X00, /*-- 文字: c --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0X00,0X00,0X00,0x80,0x80,0x80,0X00,0X00,0X00,0x0E,0x11,0x20,0x20,0x20,0x11,0X00, /*-- 文字: d --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0X00,0X00,0X00,0x80,0x80,0x88,0xF8,0X00,0X00,0x0E,0x11,0x20,0x20,0x10,0x3F,0x20, /*-- 文字: e --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0X00,0X00,0x80,0x80,0x80,0x80,0X00,0X00,0X00,0x1F,0x22,0x22,0x22,0x22,0x13,0X00, /*-- 文字: f --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0X00,0x80,0x80,0xF0,0x88,0x88,0x88,0x18,0X00,0x20,0x20,0x3F,0x20,0x20,0X00,0X00, /*-- 文字: g --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0X00,0X00,0x80,0x80,0x80,0x80,0x80,0X00,0X00,0x6B,0x94,0x94,0x94,0x93,0x60,0X00, /*-- 文字: h --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0x08,0xF8,0X00,0x80,0x80,0x80,0X00,0X00,0x20,0x3F,0x21,0X00,0X00,0x20,0x3F,0x20, /*-- 文字: i --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0X00,0x80,0x98,0x98,0X00,0X00,0X00,0X00,0X00,0x20,0x20,0x3F,0x20,0x20,0X00,0X00, /*-- 文字: j --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0X00,0X00,0X00,0x80,0x98,0x98,0X00,0X00,0X00,0xC0,0x80,0x80,0x80,0x7F,0X00,0X00, /*-- 文字: k --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0x08,0xF8,0X00,0X00,0x80,0x80,0x80,0X00,0x20,0x3F,0x24,0x02,0x2D,0x30,0x20,0X00, /*-- 文字: l --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0X00,0x08,0x08,0xF8,0X00,0X00,0X00,0X00,0X00,0x20,0x20,0x3F,0x20,0x20,0X00,0X00, /*-- 文字: m --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0x80,0x80,0x80,0x80,0x80,0x80,0x80,0X00,0x20,0x3F,0x20,0X00,0x3F,0x20,0X00,0x3F, /*-- 文字: n --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0x80,0x80,0X00,0x80,0x80,0x80,0X00,0X00,0x20,0x3F,0x21,0X00,0X00,0x20,0x3F,0x20, /*-- 文字: o --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0X00,0X00,0x80,0x80,0x80,0x80,0X00,0X00,0X00,0x1F,0x20,0x20,0x20,0x20,0x1F,0X00, /*-- 文字: p --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0x80,0x80,0X00,0x80,0x80,0X00,0X00,0X00,0x80,0xFF,0xA1,0x20,0x20,0x11,0x0E,0X00, /*-- 文字: q --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0X00,0X00,0X00,0x80,0x80,0x80,0x80,0X00,0X00,0x0E,0x11,0x20,0x20,0xA0,0xFF,0x80, /*-- 文字: r --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0x80,0x80,0x80,0X00,0x80,0x80,0x80,0X00,0x20,0x20,0x3F,0x21,0x20,0X00,0x01,0X00, /*-- 文字: s --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0X00,0X00,0x80,0x80,0x80,0x80,0x80,0X00,0X00,0x33,0x24,0x24,0x24,0x24,0x19,0X00, /*-- 文字: t --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0X00,0x80,0x80,0xE0,0x80,0x80,0X00,0X00,0X00,0X00,0X00,0x1F,0x20,0x20,0X00,0X00, /*-- 文字: u --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0x80,0x80,0X00,0X00,0X00,0x80,0x80,0X00,0X00,0x1F,0x20,0x20,0x20,0x10,0x3F,0x20, /*-- 文字: v --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0x80,0x80,0x80,0X00,0X00,0x80,0x80,0x80,0X00,0x01,0x0E,0x30,0x08,0x06,0x01,0X00, /*-- 文字: w --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0x80,0x80,0X00,0x80,0X00,0x80,0x80,0x80,0x0F,0x30,0x0C,0x03,0x0C,0x30,0x0F,0X00, /*-- 文字: x --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0X00,0x80,0x80,0X00,0x80,0x80,0x80,0X00,0X00,0x20,0x31,0x2E,0x0E,0x31,0x20,0X00, /*-- 文字: y --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0x80,0x80,0x80,0X00,0X00,0x80,0x80,0x80,0x80,0x81,0x8E,0x70,0x18,0x06,0x01,0X00, /*-- 文字: z --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0X00,0x80,0x80,0x80,0x80,0x80,0x80,0X00,0X00,0x21,0x30,0x2C,0x22,0x21,0x30,0X00, /*-- 文字: { --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0X00,0X00,0X00,0X00,0x80,0x7C,0x02,0x02,0X00,0X00,0X00,0X00,0X00,0x3F,0x40,0x40, /*-- 文字: | --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0X00,0X00,0X00,0X00,0xFF,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0xFF,0X00,0X00,0X00, /*-- 文字: } --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0X00,0x02,0x02,0x7C,0x80,0X00,0X00,0X00,0X00,0x40,0x40,0x3F,0X00,0X00,0X00,0X00, /*-- 文字: ~ --*/ /*-- Comic Sans MS12; 此字体下对应的点阵为:宽x高=8x16 --*/ 0X00,0x06,0x01,0x01,0x02,0x02,0x04,0x04,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00 }; ///#endif //#endif //Tab_Ascii_8x16_CALL1 //=======5x7======================================================================= //#ifdef Tab_Ascii_5x7_CALL const PROGMEM uint8_t Tab_Ascii_5x71[95][5]={ /*全体ASCII 列表:5x7点阵*/ 0X00,0X00,0X00,0X00,0X00,//space 0X00,0X00,0x4f,0X00,0X00,//! 0X00,0x07,0X00,0x07,0X00,//" 0x14,0x7f,0x14,0x7f,0x14,//# 0x24,0x2a,0x7f,0x2a,0x12,//$ 0x23,0x13,0x08,0x64,0x62,//% 0x36,0x49,0x55,0x22,0x50,//& 0X00,0x05,0x07,0X00,0X00,//] 0X00,0x1c,0x22,0x41,0X00,//( 0X00,0x41,0x22,0x1c,0X00,//) 0x14,0x08,0x3e,0x08,0x14,//* 0x08,0x08,0x3e,0x08,0x08,//+ 0X00,0x50,0x30,0X00,0X00,//, 0x08,0x08,0x08,0x08,0x08,//- 0X00,0x60,0x60,0X00,0X00,//. 0x20,0x10,0x08,0x04,0x02,/// 0x3e,0x51,0x49,0x45,0x3e,//0 0X00,0x42,0x7f,0x40,0X00,//1 0x42,0x61,0x51,0x49,0x46,//2 0x21,0x41,0x45,0x4b,0x31,//3 0x18,0x14,0x12,0x7f,0x10,//4 0x27,0x45,0x45,0x45,0x39,//5 0x3c,0x4a,0x49,0x49,0x30,//6 0x01,0x71,0x09,0x05,0x03,//7 0x36,0x49,0x49,0x49,0x36,//8 0x06,0x49,0x49,0x29,0x1e,//9 0X00,0x36,0x36,0X00,0X00,//: 0X00,0x56,0x36,0X00,0X00,//; 0x08,0x14,0x22,0x41,0X00,//< 0x14,0x14,0x14,0x14,0x14,//= 0X00,0x41,0x22,0x14,0x08,//> 0x02,0x01,0x51,0x09,0x06,//? 0x32,0x49,0x79,0x41,0x3e,//@ 0x7e,0x11,0x11,0x11,0x7e,//A 0x7f,0x49,0x49,0x49,0x36,//B 0x3e,0x41,0x41,0x41,0x22,//C 0x7f,0x41,0x41,0x22,0x1c,//D 0x7f,0x49,0x49,0x49,0x41,//E 0x7f,0x09,0x09,0x09,0x01,//F 0x3e,0x41,0x49,0x49,0x7a,//G 0x7f,0x08,0x08,0x08,0x7f,//H 0X00,0x41,0x7f,0x41,0X00,//I 0x20,0x40,0x41,0x3f,0x01,//J 0x7f,0x08,0x14,0x22,0x41,//K 0x7f,0x40,0x40,0x40,0x40,//L 0x7f,0x02,0x0c,0x02,0x7f,//M 0x7f,0x04,0x08,0x10,0x7f,//N 0x3e,0x41,0x41,0x41,0x3e,//O 0x7f,0x09,0x09,0x09,0x06,//P 0x3e,0x41,0x51,0x21,0x5e,//Q 0x7f,0x09,0x19,0x29,0x46,//R 0x46,0x49,0x49,0x49,0x31,//S 0x01,0x01,0x7f,0x01,0x01,//T 0x3f,0x40,0x40,0x40,0x3f,//U 0x1f,0x20,0x40,0x20,0x1f,//V 0x3f,0x40,0x38,0x40,0x3f,//W 0x63,0x14,0x08,0x14,0x63,//X 0x07,0x08,0x70,0x08,0x07,//Y 0x61,0x51,0x49,0x45,0x43,//Z 0X00,0x7f,0x41,0x41,0X00,//[ 0x02,0x04,0x08,0x10,0x20,//\ 0X00,0x41,0x41,0x7f,0X00,//] 0x04,0x02,0x01,0x02,0x04,//^ 0x40,0x40,0x40,0x40,0x40,//_ 0x01,0x02,0x04,0X00,0X00,//` 0x20,0x54,0x54,0x54,0x78,//a 0x7f,0x48,0x48,0x48,0x30,//b 0x38,0x44,0x44,0x44,0x44,//c 0x30,0x48,0x48,0x48,0x7f,//d 0x38,0x54,0x54,0x54,0x58,//e 0X00,0x08,0x7e,0x09,0x02,//f 0x48,0x54,0x54,0x54,0x3c,//g 0x7f,0x08,0x08,0x08,0x70,//h 0X00,0X00,0x7a,0X00,0X00,//i 0x20,0x40,0x40,0x3d,0X00,//j 0x7f,0x20,0x28,0x44,0X00,//k 0X00,0x41,0x7f,0x40,0X00,//l 0x7c,0x04,0x38,0x04,0x7c,//m 0x7c,0x08,0x04,0x04,0x78,//n 0x38,0x44,0x44,0x44,0x38,//o 0x7c,0x14,0x14,0x14,0x08,//p 0x08,0x14,0x14,0x14,0x7c,//q 0x7c,0x08,0x04,0x04,0x08,//r 0x48,0x54,0x54,0x54,0x24,//s 0x04,0x04,0x3f,0x44,0x24,//t 0x3c,0x40,0x40,0x40,0x3c,//u 0x1c,0x20,0x40,0x20,0x1c,//v 0x3c,0x40,0x30,0x40,0x3c,//w 0x44,0x28,0x10,0x28,0x44,//x 0x04,0x48,0x30,0x08,0x04,//y 0x44,0x64,0x54,0x4c,0x44,//z 0x08,0x36,0x41,0x41,0X00,//{ 0X00,0X00,0x77,0X00,0X00,//| 0X00,0x41,0x41,0x36,0x08,//} 0x04,0x02,0x02,0x02,0x01,//~ }; //#endif //Tab_Ascii_5x7_CALL uint8 zhuang1[]={ /*-- 文字: 状 --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/ 0x08,0x30,0X00,0xFF,0x20,0x20,0x20,0x20,0xFF,0x20,0xE1,0x26,0x2C,0x20,0x20,0X00, 0x04,0x02,0x01,0xFF,0x40,0x20,0x18,0x07,0X00,0X00,0x03,0x0C,0x30,0x60,0x20,0X00 }; uint8 tai1[]={ /*-- 文字: 态 --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/ 0X00,0x04,0x04,0x04,0x84,0x44,0x34,0x4F,0x94,0x24,0x44,0x84,0x84,0x04,0X00,0X00, 0X00,0x60,0x39,0x01,0X00,0x3C,0x40,0x42,0x4C,0x40,0x40,0x70,0x04,0x09,0x31,0X00 }; uint8 shi1[]={ /*-- 文字: 使 --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/ 0x40,0x20,0xF0,0x1C,0x07,0xF2,0x94,0x94,0x94,0xFF,0x94,0x94,0x94,0xF4,0x04,0X00, 0X00,0X00,0x7F,0X00,0x40,0x41,0x22,0x14,0x0C,0x13,0x10,0x30,0x20,0x61,0x20,0X00 }; uint8 yong1[]={ /*-- 文字: 用 --*/ /*-- 宋体12; 此字体下对应的点阵为:宽x高=16x16 --*/ 0X00,0X00,0X00,0xFE,0x22,0x22,0x22,0x22,0xFE,0x22,0x22,0x22,0x22,0xFE,0X00,0X00, 0x80,0x40,0x30,0x0F,0x02,0x02,0x02,0x02,0xFF,0x02,0x02,0x42,0x82,0x7F,0X00,0X00 }; //x=9 y=16 点阵 0-9 const PROGMEM uint8_t lcd_numbers_lit[]={ 0X00,0xE0,0xE0,0x60,0x20,0x60,0xE0,0xE0,0X00,//0 0X00,0x7F,0x7F,0x60,0x40,0x60,0x7F,0x7F,0X00, 0X00,0X00,0x40,0x40,0xE0,0xE0,0X00,0X00,0X00,//1 0X00,0X00,0X00,0X00,0x7F,0x7F,0X00,0X00,0X00, 0X00,0xE0,0xE0,0x20,0x20,0xE0,0xE0,0xC0,0X00,//2 0X00,0x71,0x79,0x78,0x5E,0x47,0x43,0x41,0X00, 0X00,0xE0,0xE0,0x20,0x20,0xE0,0xE0,0xC0,0X00,//3 0X00,0x78,0x78,0x42,0x47,0x7F,0x7D,0x39,0X00, 0X00,0X00,0X00,0x80,0xE0,0xE0,0xE0,0X00,0X00,//4 0X00,0x0E,0x0F,0x0B,0x7F,0x7F,0x7F,0x08,0X00, 0X00,0xE0,0xE0,0xE0,0x20,0x20,0x20,0x20,0X00,//5 0X00,0x73,0x73,0x43,0x41,0x7F,0x7F,0x3E,0X00, 0X00,0xE0,0xE0,0x60,0x20,0x60,0x60,0x60,0X00,//6 0X00,0x7F,0x7F,0x43,0x43,0x7F,0x7E,0x3C,0X00, 0X00,0x20,0x20,0x20,0xA0,0xE0,0xE0,0x60,0X00,//7 0X00,0X00,0x40,0x78,0x7F,0x0F,0x01,0X00,0X00, 0X00,0xE0,0xE0,0x20,0x20,0x20,0xE0,0xE0,0X00,//8 0X00,0x7D,0x7D,0x47,0x42,0x47,0x7D,0x7D,0X00, 0X00,0xE0,0xE0,0x20,0x20,0xE0,0xE0,0x80,0X00,//9 0X00,0x67,0x6F,0x4C,0x6C,0x7F,0x3F,0x0F,0X00 }; //x=12 y=16 点阵 0-9数字 const PROGMEM uint8_t lcd_numbers[]={ 0X00,0xF0,0xFC,0xFC,0x0E,0x02,0x02,0x0E,0xFC,0xFC,0xF0,0X00,//0 0X00,0x07,0x3F,0x3F,0x70,0x40,0x40,0x70,0x3F,0x3F,0x07,0X00, 0X00,0X00,0X00,0x08,0x08,0xFC,0xFE,0xFE,0X00,0X00,0X00,0X00,//1 0X00,0X00,0X00,0X00,0X00,0x7F,0x7F,0x7F,0X00,0X00,0X00,0X00, 0X00,0x38,0x3C,0x3E,0x06,0x02,0x86,0xFE,0xFC,0x78,0X00,0X00,//2 0X00,0x60,0x78,0x7C,0x5E,0x4F,0x43,0x41,0x40,0x40,0X00,0X00, 0X00,0x18,0x1C,0x1E,0x86,0x82,0xC6,0xFE,0x7C,0x38,0X00,0X00,//3 0X00,0x1C,0x3C,0x7C,0x60,0x40,0x61,0x7F,0x3F,0x1E,0X00,0X00, 0X00,0X00,0x80,0xC0,0xF0,0x3C,0xFE,0xFE,0xFE,0X00,0X00,0X00,//4 0X00,0x06,0x07,0x05,0x04,0x04,0x7F,0x7F,0x7F,0x04,0x04,0X00, 0X00,0X00,0xFE,0xFE,0xFE,0x62,0x62,0xE2,0xE2,0x82,0X00,0X00,//5 0X00,0x18,0x38,0x78,0x60,0x40,0x60,0x7F,0x3F,0x1F,0X00,0X00, 0X00,0xF0,0xFC,0xFC,0xCE,0x42,0xC6,0xCE,0x8E,0x0C,0X00,0X00,//6 0X00,0x0F,0x3F,0x7F,0x60,0x40,0x60,0x7F,0x3F,0x1F,0X00,0X00, 0X00,0x02,0x02,0x02,0x02,0x82,0xF2,0xFE,0x7E,0x0E,0X00,0X00,//7 0X00,0X00,0X00,0x60,0x7C,0x7F,0x1F,0x03,0X00,0X00,0X00,0X00, 0X00,0x38,0x7C,0x7E,0xC6,0x82,0x82,0xC6,0x7E,0x7C,0x38,0X00,//8 0X00,0x1E,0x3F,0x7F,0x61,0x40,0x40,0x61,0x7F,0x3F,0x1E,0X00, 0X00,0xF8,0xFC,0xFE,0x06,0x02,0x06,0xFE,0xFC,0xF0,0X00,0X00,//9 0X00,0x30,0x71,0x73,0x63,0x42,0x73,0x3F,0x1F,0x07,0X00,0X00, 0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,0X00,//. 0X00,0X00,0X00,0x38,0x38,0x38,0X00,0X00,0X00,0X00,0X00,0X00, 0X00,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0X00,//- 0X00,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0X00 }; const PROGMEM uint8_t Tab_Ascii_5x72[95][5]={ /*全体ASCII 列表:5x7点阵*/ 0X00,0X00,0X00,0X00,0X00,//space 0X00,0X00,0x4f,0X00,0X00,//! 0X00,0x07,0X00,0x07,0X00,//" 0x14,0x7f,0x14,0x7f,0x14,//# 0x24,0x2a,0x7f,0x2a,0x12,//$ 0x23,0x13,0x08,0x64,0x62,//% 0x36,0x49,0x55,0x22,0x50,//& 0X00,0x05,0x07,0X00,0X00,//] 0X00,0x1c,0x22,0x41,0X00,//( 0X00,0x41,0x22,0x1c,0X00,//) 0x14,0x08,0x3e,0x08,0x14,//* 0x08,0x08,0x3e,0x08,0x08,//+ 0X00,0x50,0x30,0X00,0X00,//, 0x08,0x08,0x08,0x08,0x08,//- 0X00,0x60,0x60,0X00,0X00,//. 0x20,0x10,0x08,0x04,0x02,/// 0x3e,0x51,0x49,0x45,0x3e,//0 0X00,0x42,0x7f,0x40,0X00,//1 0x42,0x61,0x51,0x49,0x46,//2 0x21,0x41,0x45,0x4b,0x31,//3 0x18,0x14,0x12,0x7f,0x10,//4 0x27,0x45,0x45,0x45,0x39,//5 0x3c,0x4a,0x49,0x49,0x30,//6 0x01,0x71,0x09,0x05,0x03,//7 0x36,0x49,0x49,0x49,0x36,//8 0x06,0x49,0x49,0x29,0x1e,//9 0X00,0x36,0x36,0X00,0X00,//: 0X00,0x56,0x36,0X00,0X00,//; 0x08,0x14,0x22,0x41,0X00,//< 0x14,0x14,0x14,0x14,0x14,//= 0X00,0x41,0x22,0x14,0x08,//> 0x02,0x01,0x51,0x09,0x06,//? 0x32,0x49,0x79,0x41,0x3e,//@ 0x7e,0x11,0x11,0x11,0x7e,//A 0x7f,0x49,0x49,0x49,0x36,//B 0x3e,0x41,0x41,0x41,0x22,//C 0x7f,0x41,0x41,0x22,0x1c,//D 0x7f,0x49,0x49,0x49,0x41,//E 0x7f,0x09,0x09,0x09,0x01,//F 0x3e,0x41,0x49,0x49,0x7a,//G 0x7f,0x08,0x08,0x08,0x7f,//H 0X00,0x41,0x7f,0x41,0X00,//I 0x20,0x40,0x41,0x3f,0x01,//J 0x7f,0x08,0x14,0x22,0x41,//K 0x7f,0x40,0x40,0x40,0x40,//L 0x7f,0x02,0x0c,0x02,0x7f,//M 0x7f,0x04,0x08,0x10,0x7f,//N 0x3e,0x41,0x41,0x41,0x3e,//O 0x7f,0x09,0x09,0x09,0x06,//P 0x3e,0x41,0x51,0x21,0x5e,//Q 0x7f,0x09,0x19,0x29,0x46,//R 0x46,0x49,0x49,0x49,0x31,//S 0x01,0x01,0x7f,0x01,0x01,//T 0x3f,0x40,0x40,0x40,0x3f,//U 0x1f,0x20,0x40,0x20,0x1f,//V 0x3f,0x40,0x38,0x40,0x3f,//W 0x63,0x14,0x08,0x14,0x63,//X 0x07,0x08,0x70,0x08,0x07,//Y 0x61,0x51,0x49,0x45,0x43,//Z 0X00,0x7f,0x41,0x41,0X00,//[ 0x02,0x04,0x08,0x10,0x20,// 0X00,0x41,0x41,0x7f,0X00,//] 0x04,0x02,0x01,0x02,0x04,//^ 0x40,0x40,0x40,0x40,0x40,//_ 0x01,0x02,0x04,0X00,0X00,//` 0x20,0x54,0x54,0x54,0x78,//a 0x7f,0x48,0x48,0x48,0x30,//b 0x38,0x44,0x44,0x44,0x44,//c 0x30,0x48,0x48,0x48,0x7f,//d 0x38,0x54,0x54,0x54,0x58,//e 0X00,0x08,0x7e,0x09,0x02,//f 0x48,0x54,0x54,0x54,0x3c,//g 0x7f,0x08,0x08,0x08,0x70,//h 0X00,0X00,0x7a,0X00,0X00,//i 0x20,0x40,0x40,0x3d,0X00,//j 0x7f,0x20,0x28,0x44,0X00,//k 0X00,0x41,0x7f,0x40,0X00,//l 0x7c,0x04,0x38,0x04,0x7c,//m 0x7c,0x08,0x04,0x04,0x78,//n 0x38,0x44,0x44,0x44,0x38,//o 0x7c,0x14,0x14,0x14,0x08,//p 0x08,0x14,0x14,0x14,0x7c,//q 0x7c,0x08,0x04,0x04,0x08,//r 0x48,0x54,0x54,0x54,0x24,//s 0x04,0x04,0x3f,0x44,0x24,//t 0x3c,0x40,0x40,0x40,0x3c,//u 0x1c,0x20,0x40,0x20,0x1c,//v 0x3c,0x40,0x30,0x40,0x3c,//w 0x44,0x28,0x10,0x28,0x44,//x 0x04,0x48,0x30,0x08,0x04,//y 0x44,0x64,0x54,0x4c,0x44,//z 0x08,0x36,0x41,0x41,0X00,//{ 0X00,0X00,0x77,0X00,0X00,//| 0X00,0x41,0x41,0x36,0x08,//} 0x04,0x02,0x02,0x02,0x01,//~ }; /////////////// #define Start_T1 TCCR1B|=_BV(CS11);TCNT1=0//复位预计分频器并开启定时器T1 #define Stop_T1 TCCR1B&=~_BV(CS11) //关闭定时器T1 //数码管的段码编码 unsigned char table[10] = {0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f}; volatile unsigned char i,j,k; volatile unsigned char IRcode; //定义一个长度为4字节的无符号long类型变量来存储代码 volatile unsigned char IR_OK=0; //IR信号接收有效 当程序响应接收以后请马上清零 这样才会继续接收下一IR码 volatile unsigned char IR_con=0; //IR信号当前接收位 0时表示第0位即同步码(4.5ms高电平) volatile unsigned int Pulse_length=0; //捕获的脉冲宽度 volatile unsigned char ICP_Parity=0; //捕获中断奇偶次计数 1时为偶次 并在此时判断脉宽 volatile unsigned char address; volatile unsigned char code_data; volatile unsigned char code_data1; unsigned char clrbit; #define FREQ 8 //定义单片机工作频率为 4M /////////////// //**************************************************************** // 函数名称:DelayLcd // 函数功能:延时 // 入口参数: // 出口参数: //***************************************************************** void DelayLcd(uint16 i) { uint16 j; for(j=200;j>0;j--) for(;i>0;i--); //while(i--); } //**************************************************************** // 函数名称:LcdWriteCommand // 函数功能:写指令到LCD模块 // 入口参数:数据 // 出口参数: //***************************************************************** void LcdWriteCommand(uint8 data1) // { uint8 i ; P_LCDCS0 ; P_LCDRS0 ; for(i=8;i>0;i--) { P_LCDCLK0; if(data1&0x80) P_LCDDAT1; else P_LCDDAT0; P_LCDCLK1; data1 <<= 1; } } //**************************************************************** // 函数名称:LcdWritedata // 函数功能:写数据到LCD模块 // 入口参数:数据 // 出口参数: //***************************************************************** void LcdWritedata(uint8 data1) // { uint8 i; P_LCDCS0 ; P_LCDRS1 ; for(i=8;i>0;i--) { P_LCDCLK0; if(data1&0x80) P_LCDDAT1; else P_LCDDAT0; P_LCDCLK1; data1 <<= 1; } } //**************************************************************** // 函数名称:Lcd_SetAddr // 函数功能:设置LCD显示地址 // 入口参数: 页地址 列地址 // 出口参数: //***************************************************************** void Lcd_SetAddr(uint8 page,uint8 column) { //LcdWriteCommand(0xb0 | (y+yy)); //LcdWriteCommand(0x10 | (x>>4)); //LcdWriteCommand(0X00 | (x&0x0f)); //P_LCDCS0 ; LcdWriteCommand(0xb0|page); /*设置页地址*/ LcdWriteCommand((column>>4)|0x10); /*设置列地址的高4位*/ LcdWriteCommand(column&0x0f); /*设置列地址的低4位*/ } ////// void Display_Graphic_32x2(uint8 page,uint8 column,PROGMEM uint8_t *dp) // 电池显示 0、2、4、6、8、10 { uint8 i,j; uint8 page_address; uint8 column_address_L,column_address_H; page_address = 0xb0|page; column_address_L =(column&0x0f); column_address_H =(column>>4)|0x10; P_LCDCS0 ; for(j=0;j<2;j++) { LcdWriteCommand(page_address+j); /*设置页地址*/ LcdWriteCommand(column_address_H); /*设置列地址的高4位*/ LcdWriteCommand(column_address_L); /*设置列地址的低4位*/ for (i=32;i>0;i--) //写32行 { LcdWritedata(pgm_read_byte(dp++)); /*写数据到LCD,每写完一个8位的数据后列地址自动加1*/ } LcdWritedata(0X00); } P_LCDCS1 ; } //#ifdef Display_Graphic_32x32_CALL void Display_Graphic_32x32(uint8 page,uint8 column,PROGMEM uint8_t *dp) { uint8 i,j; uint8 page_address; uint8 column_address_L,column_address_H; page_address = 0xb0|page; column_address_L =(column&0x0f); column_address_H =(column>>4)|0x10; P_LCDCS0 ; &
标签: 程序
上传时间: 2016-03-03
上传用户:彦 yan
#include "STC90.h" #include < intrins.h > #define uchar unsigned char #define uint unsigned int #define led_port P1 sbit IR_RE = P3^2; sbit led_r = P1^3; sbit led_g = P1^4; sbit led_b = P1^5; sbit led_wd = P1^7; sbit K1 =P3^0 ; //增加键 sbit K2 =P3^1 ; //减少键 sbit BEEP =P3^7 ; //蜂鸣器 uchar temp,temp1; bit k=0; //红外解码判断标志位,为0则为有效信号,为1则为无效 bit Flag2; uchar date[4]={0,0,0,0}; //date数组为存放地址原码,反码,数据原码,反码 uint lade_1,lade_2,lade_3,lade_4; uint num; uchar date_ram,ee_temp,ee_temp1; uchar WDT_NUM=0; uchar const dofly[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};// 显示段码值01234567 uchar code seg[]={7,6,5,4,3,2,1,0};//分别对应相应的数码管点亮,即位码 unsigned long disp_date; void fade(); void fade1(); /*************************** 看门狗子程序*************************/ void watchdog_timer() { if(WDT_NUM==5) { WDT_NUM=0; led_wd=!led_wd; } WDT_NUM++; WDT_CONTR=0x3f; } /******************************************************************/ void delay(unsigned int cnt) { while(--cnt); } /*--------------------------延时1ms程子程序-----------------------*/ void delay_1ms(uint z) { uint x,y; for(x=z;x>0;x--) for(y=126;y>0;y--); } /*--------------------------延时1ms程子程序-----------------------*/ delay1000() { uchar i,j; i=5; do{j=95; do{j--;} while(j); i--; } while(i); } /*---------------------------延时882us子程序-----------------------*/ delay882() { uchar i,j; i=6; do{j=71; do{j--;} while(j); i--; }while(i); } /*--------------------------延时2400us程子程序-----------------------*/ delay2400() { uchar i,j; i=5; do{j=237; do{j--;} while(j); i--; }while(i); } /**********************************************************************/ /* void display() { uchar i; for(i=0;i<8;i++) { P0=dofly[disp_date%10];//取显示数据,段码 P2=seg[i]; //取位码 delay_1ms(1); disp_date/=10; } } */ /*********************************************************************/ uchar EEPROM_read(uint addr)//EEPROM字节读 { ISP_CONTR=0x83; //系统时钟<12M时,对ISP_CONTR寄存器设置的值,本电路为11.0592M ISP_CMD=1; //字节读 ISP_ADDRH=(addr&0xff00)>>8; ISP_ADDRL=addr&0X00ff; ISP_TRIG=0x46; ISP_TRIG=0xb9; _nop_(); _nop_(); return ISP_DATA; } //-------------------------------------------------------------------- void EEPROM_write(uint addr,uchar dat)//EEPROM字节写 { ISP_CONTR=0x83; //系统时钟<12M时,对ISP_CONTR寄存器设置的值,本电路为11.0592M ISP_CMD=2; //字节编程 ISP_ADDRH=(addr&0xff00)>>8; ISP_ADDRL=addr&0X00ff; ISP_DATA=dat; ISP_TRIG=0x46; ISP_TRIG=0xb9; _nop_(); _nop_(); } //-------------------------------------------------------------------- void EEPROM_ERASE(uint addr)//EEPROM扇区擦除 { ISP_CONTR=0x83; //系统时钟<12M时,对ISP_CONTR寄存器设置的值,本电路为11.0592M ISP_CMD=3; //扇区擦除 ISP_ADDRH=(addr&0xff00)>>8; ISP_ADDRL=addr&0X00ff; ISP_TRIG=0x46; ISP_TRIG=0xb9; _nop_(); _nop_(); } //************************************************************** /*----------------------------------------------------------*/ /*-----------------------红外解码程序(核心)-----------------*/ /*----------------------------------------------------------*/ void IR_decode() { uchar i,j; while(IR_RE==0); delay2400(); if(IR_RE==1) //延时2.4ms后如果是高电平则是新码 { delay1000(); delay1000(); for(i=0;i<4;i++) { for(j=0;j<8;j++) { while(IR_RE==0); //等待地址码第1位高电平到来 delay882(); //延时882us判断此时引脚电平 ///CY=IR_RE; if(IR_RE==0) { date[i]>>=1; date[i]=date[i]|0X00; } else if(IR_RE==1) { delay1000(); date[i]>>=1; date[i]=date[i]|0x80; } } //1位数据接收结束 } //32位二进制码接收结束 } } /* void LED_PWM() { lade_2=num; //384 lade_4=num; //384 while(lade_2!=0&Flag2==1) { for(lade_3=512;lade_3>lade_4;lade_3--) //512 { led_port=0X00; delay(1); } lade_3=512; //512 lade_4--; for(lade_1=0;lade_1<lade_2;lade_1++) { led_port=0x38; //c7 delay(1); } lade_1=0; lade_2--; if(temp!=0x0c&Flag2==1) { lade_2=0; } lade_2=num; //384 lade_4=num; //384 } } */ void calc() { EEPROM_read(0x2000); ee_temp1=ISP_DATA; ee_temp=ee_temp1&0x0f; //************************************* 1 /* if(date[3]==0xff&Flag2==1) { if(num>=20) { num=num-80; } //else num=1; LED_PWM(); } if(date[3]==0xfe&Flag2==1) { if(num<=500) { num=num+80; } // else num=511; LED_PWM(); } if(ee_temp1==0xfd) { led_port=0X00; watchdog_timer(); } if(ee_temp1==0xfc) { led_port=0X00; led_r=1; led_g=1; led_b=1; watchdog_timer(); } */ //********************************************** 2 if(ee_temp1==0xfb) { led_port=0X00; led_r=1; watchdog_timer(); } if(ee_temp1==0xfa) { led_port=0X00; led_g=1; watchdog_timer(); } if(ee_temp1==0xf9) { led_port=0X00; led_b=1; watchdog_timer(); } if(ee_temp1==0xf8) { led_port=0X00; led_r=1; led_g=1; led_b=1; watchdog_timer(); } //************************************** 3 if(ee_temp1==0xf7) { uint fade_1,fade_2,fade_3,fade_4; fade_2=448; //384 fade_4=448; //384 while(fade_2!=0&ee_temp==0x07) { for(fade_3=512;fade_3>fade_4;fade_3--) //512 { led_port=0x10; delay(1); } fade_3=512; //512 fade_4--; watchdog_timer(); for(fade_1=0;fade_1<fade_2;fade_1++) { led_port=0x08; delay(1); } fade_1=0; fade_2--; if(ee_temp!=0x07) { fade_2=0; } watchdog_timer(); fade_2=448; //384 fade_4=448; //384 } } if(ee_temp1==0xf6) { uint fade_1,fade_2,fade_3,fade_4; fade_2=448; //384 fade_4=448; //384 while(fade_2!=0&ee_temp==0x06) { for(fade_3=512;fade_3>fade_4;fade_3--) //512 { led_port=0x20; delay(1); } fade_3=512; //512 fade_4--; watchdog_timer(); for(fade_1=0;fade_1<fade_2;fade_1++) { led_port=0x10; delay(1); } fade_1=0; fade_2--; if(ee_temp!=0x06) { fade_2=0; } watchdog_timer(); fade_2=448; //384 fade_4=448; //384 } } if(ee_temp1==0xf5) { uint fade_1,fade_2,fade_3,fade_4; fade_2=448; //384 fade_4=448; //384 while(fade_2!=0&ee_temp==0x05) { for(fade_3=512;fade_3>fade_4;fade_3--) //512 { led_port=0x08; delay(1); } fade_3=512; //512 fade_4--; watchdog_timer(); for(fade_1=0;fade_1<fade_2;fade_1++) { led_port=0x20; delay(1); } fade_1=0; fade_2--; if(ee_temp!=0x05) { fade_2=0; } watchdog_timer(); fade_2=448; //384 fade_4=448; //384 } } if(ee_temp1==0xf4) { while(ee_temp==4) { led_port=0X00; led_r=1; delay_1ms(200); led_port=0X00; led_r=1; led_g=1; delay_1ms(200); led_port=0X00; led_g=1; delay_1ms(200); watchdog_timer(); led_port=0X00; led_g=1; led_b=1; delay_1ms(200); led_port=0X00; led_b=1; delay_1ms(200); led_port=0X00; led_b=1; led_r=1; delay_1ms(200); watchdog_timer(); } } //************************************** 4 if(ee_temp1==0xf3) { uint fade_1,fade_2,fade_3,fade_4; fade_2=416; //384 fade_4=416; //384 while(fade_2!=0&ee_temp==0x03) { for(fade_3=512;fade_3>fade_4;fade_3--) //512 { led_port=0x10; delay(1); } fade_3=512; //512 fade_4--; watchdog_timer(); for(fade_1=0;fade_1<fade_2;fade_1++) { led_port=0x08; delay(1); } fade_1=0; fade_2--; if(ee_temp!=0x03) { fade_2=0; } watchdog_timer(); fade_2=416; //384 fade_4=416; //384 } } if(ee_temp1==0xf2) { uint fade_1,fade_2,fade_3,fade_4; fade_2=384; //384 fade_4=384; //384 while(fade_2!=0&ee_temp==0x02) { for(fade_3=512;fade_3>fade_4;fade_3--) //512 { led_port=0x20; delay(1); } fade_3=512; //512 fade_4--; watchdog_timer(); for(fade_1=0;fade_1<fade_2;fade_1++) { led_port=0x10; delay(1); } fade_1=0; fade_2--; if(ee_temp!=0x02) { fade_2=0; } watchdog_timer(); fade_2=384; //384 fade_4=384; //384 } } if(ee_temp1==0xf1) { uint fade_1,fade_2,fade_3,fade_4; fade_2=348; //384 fade_4=348; //384 while(fade_2!=0&ee_temp==0x01) { for(fade_3=512;fade_3>fade_4;fade_3--) //512 { led_port=0x08; delay(1); } fade_3=512; //512 fade_4--; watchdog_timer(); for(fade_1=0;fade_1<fade_2;fade_1++) { led_port=0x20; delay(1); } fade_1=0; fade_2--; if(ee_temp!=0x01) { fade_2=0; } watchdog_timer(); fade_2=348; //384 fade_4=348; //384 } } if(ee_temp1==0xf0) { while(ee_temp==0) { led_port=0X00; led_r=1; delay_1ms(500); watchdog_timer(); led_port=0X00; led_g=1; delay_1ms(500); led_port=0X00; led_b=1; delay_1ms(500); watchdog_timer(); } } //******************************************** 5 if(ee_temp1==0xef) { uint fade_1,fade_2,fade_3,fade_4; fade_2=384; //384 fade_4=384; //384 while(fade_2!=0&ee_temp==0x0f) { for(fade_3=512;fade_3>fade_4;fade_3--) //512 { led_port=0x10; delay(1); } fade_3=512; //512 fade_4--; watchdog_timer(); for(fade_1=0;fade_1<fade_2;fade_1++) { led_port=0x08; delay(1); } fade_1=0; fade_2--; if(ee_temp!=0x0f) { fade_2=0; } watchdog_timer(); fade_2=384; //384 fade_4=384; //384 } } if(ee_temp1==0xee) { uint fade_1,fade_2,fade_3,fade_4; fade_2=320; //384 fade_4=320; //384 while(fade_2!=0&ee_temp==0x0e) { for(fade_3=512;fade_3>fade_4;fade_3--) //512 { led_port=0x20; delay(1); } fade_3=512; //512 fade_4--; watchdog_timer(); for(fade_1=0;fade_1<fade_2;fade_1++) { led_port=0x10; delay(1); } fade_1=0; fade_2--; if(ee_temp!=0x0e) { fade_2=0; } watchdog_timer(); fade_2=320; //384 fade_4=320; //384 } } if(ee_temp1==0xed) { uint fade_1,fade_2,fade_3,fade_4; fade_2=320; //384 fade_4=320; //384 while(fade_2!=0&ee_temp==0x0d) { for(fade_3=512;fade_3>fade_4;fade_3--) //512 { led_port=0x08; delay(1); } fade_3=512; //512 fade_4--; watchdog_timer(); for(fade_1=0;fade_1<fade_2;fade_1++) { led_port=0x20; delay(1); } fade_1=0; fade_2--; if(ee_temp!=0x0d) { fade_2=0; } watchdog_timer(); fade_2=320; //384 fade_4=320; //384 } } if(ee_temp1==0xec) fade(); //******************************************* 6 if(ee_temp1==0xeb) { led_port=0X00; led_r=1; led_g=1; watchdog_timer(); } if(ee_temp1==0xea) { led_port=0X00; //led_r=0; led_g=1; led_b=1; watchdog_timer(); } if(ee_temp1==0xe9) { led_port=0X00; led_r=1; //led_g=0; led_b=1; watchdog_timer(); } if(ee_temp1==0xe8) fade1(); } void fade() { // uchar i; uint fade_1,fade_2,fade_3,fade_4; fade_2=512; fade_4=511; while(fade_2!=0&ee_temp==0x0c) { for(fade_3=512;fade_3>fade_4;fade_3--) { led_port=0x10; delay(1); } fade_3=512; fade_4--; watchdog_timer(); for(fade_1=0;fade_1<fade_2;fade_1++) { led_port=0x08; delay(1); } fade_1=0; fade_2--; if(ee_temp!=0x0c) { fade_2=0; } } watchdog_timer(); fade_2=512; fade_4=511; while(fade_2!=0&ee_temp==0x0c) { if(ee_temp!=0x0c) { fade_2=0; } for(fade_3=512;fade_3>fade_4;fade_3--) { led_port=0x20; delay(1); // watchdog_timer(); } fade_3=512; fade_4--; watchdog_timer(); for(fade_1=0;fade_1<fade_2;fade_1++) { led_port=0x10; delay(1); // watchdog_timer(); } fade_1=0; fade_2--; } watchdog_timer(); fade_2=512; fade_4=511; while(fade_2!=0&ee_temp==0x0c) { if(ee_temp!=0x0c) { fade_2=0; } for(fade_3=512;fade_3>fade_4;fade_3--) { led_port=0x08; delay(1); watchdog_timer(); } fade_3=512; fade_4--; watchdog_timer(); for(fade_1=0;fade_1<fade_2;fade_1++) { led_port=0x20; delay(1); watchdog_timer(); } fade_1=0; fade_2--; } watchdog_timer(); } void fade1() { // uchar i; uint fade_1,fade_2,fade_3,fade_4; fade_2=128; fade_4=127; while(fade_2!=0&ee_temp==0x08) { for(fade_3=128;fade_3>fade_4;fade_3--) { led_port=0x10; delay(1); } fade_3=128; fade_4--; for(fade_1=0;fade_1<fade_2;fade_1++) { led_port=0x08; delay(1); } fade_1=0; fade_2--; if(ee_temp!=0x08) { fade_2=0; } } watchdog_timer(); fade_2=128; fade_4=127; while(fade_2!=0&ee_temp==0x08) { if(ee_temp!=0x08) { fade_2=0; } for(fade_3=128;fade_3>fade_4;fade_3--) { led_port=0x20; delay(1); } fade_3=128; fade_4--; for(fade_1=0;fade_1<fade_2;fade_1++) { led_port=0x10; delay(1); } fade_1=0; fade_2--; } watchdog_timer(); fade_2=128; fade_4=127; while(fade_2!=0&ee_temp==0x08) { if(ee_temp!=0x08) { fade_2=0; } for(fade_3=128;fade_3>fade_4;fade_3--) { led_port=0x08; delay(1); } fade_3=128; fade_4--; for(fade_1=0;fade_1<fade_2;fade_1++) { led_port=0x20; delay(1); } fade_1=0; fade_2--; } watchdog_timer(); } void init() { led_port=0X00; /* led_r=1; delay_1ms(500); led_port=0X00; led_g=1; delay_1ms(500); led_port=0X00; led_b=1; delay_1ms(500); led_port=0X00; */ delay_1ms(2); WDT_CONTR=0x3f; delay_1ms(500); } //******************************** void main() { init(); Flag2=0; SP=0x60; //堆栈指针 EX0=1; //允许外部中断0,用于检测红外遥控器按键 EA=1; num=255; while(1) { calc(); } } //******************************************************************** /*------------------------外部中断0程序-------------------------*/ /*------------------主要用于处理红外遥控键值--------------------*/ void int0() interrupt 0 { uchar i; Flag2=0; /////// k=0; EX0=0; //检测到有效信号关中断,防止干扰 for(i=0;i<4;i++) { delay1000(); if(IR_RE==1){k=1;} //刚开始为9ms的引导码. } led_port=0X00; if(k==0) { IR_decode(); //如果接收到的是有效信号,则调用解码程序 if(date[3]>=0xe8) { if(date[3]<=0xfb) { temp1=date[3]; EEPROM_ERASE(0x2000); //STC_EEROM_0X2000 temp1 EEPROM_write(0x2000,temp1); EEPROM_read(0x2000); ee_temp1=ISP_DATA; ee_temp=ee_temp1&0x0f; /* temp=date[3]&0x0f; EEPROM_ERASE(0x2004); //STC_EEROM_0X2004 temp EEPROM_write(0x2004,temp); */ } else { EEPROM_read(0x2000); ee_temp1=ISP_DATA; ee_temp=ee_temp1&0x0f; } } delay2400(); delay2400(); delay2400(); delay_1ms(500); } EX0=1; //开外部中断,允许新的遥控按键 }
上传时间: 2016-07-02
上传用户:184890962
/*================================================================= 4扫16*16下入上出C语言程序, 低位起笔,数据反相。 预定义 **************************************************************/ #include #include //可使用其中定义的宏来访问绝对地址? bit ture=1; // 使能正反相位选择 bit false=0; // 使能反相 sbit SCK=P3^6; // EQU 0B6H ; 移位 sbit RCK=P3^5; //EQU 0B5H ; 并行锁存 //sbit P1_3=P1^3; //外RAM扩展读写控制,不能重复申明 sbit EN1=P1^7; //BIT sbit FB=0xD8; // FB作为标志 sfr BUS_SPEED=0xA1; //访问片外RAM速度设置寄存器 sfr P4SW=0xBB; //P4SW寄存器设置P4.4,P4.5,P4.6的功能 sfr P4=0xC0; // P4 EQU 0C0H sbit NC=P4^4; sbit CS=P4^6; //片选 sfr WDT_CONTR=0xC1; // 0C1H ;看门狗寄存器 sfr AUXR=0x8E; // EQU 08EH ;附件功能控制寄存器 sfr16 DPTR=0x82; sfr CLK_DIV=0x97 ; //时钟分频寄存器 const unsigned int code All_zk =256 ; // 0E11H ;原数据总字节 const unsigned int code am_zk =128 ; // 0E13H ;单幕数据量 const unsigned char code asp = 255; // asp数据相位字,如果是正相字,那么asp=0 bit basp=1; // asp数据相位字标记,如果是正相字,那么basp=0 const unsigned char code font[]= // 晶科电子LED数码(反相字) {0xBD,0x81,0xEF,0xFF,0xBD,0x81,0xF7,0xFF,0xEF,0xEB,0x80,0x9F,0xEF,0x8F,0xEF,0xEF,0x7F,0x7B,0x7B,0x7F,0xBF,0xEF,0xEF,0xFF,0x7F,0X00,0xFF,0xFF,0xFF,0x80,0xFE,0xFF, 0x81,0xBD,0x0F,0x0F,0x81,0xBD,0xF0,0xF0,0xEF,0xED,0xE7,0xE1,0xEF,0xE1,0xEE,0xEE,0x7F,0x7B,0x7B,0x7F,0xBF,0xEF,0xEF,0xFF,0x7F,0x7F,0x7F,0x03,0xFF,0xFF,0xFF,0xF0, 0xBD,0x81,0xEF,0xEF,0xBD,0x81,0xF7,0xF7,0xEF,0x2E,0xC7,0xEF,0xEF,0xEE,0xED,0xED,0xFF,0x03,0x03,0x7F,0x80,0xE0,0xE0,0xFF,0x5F,0x7F,0x7F,0xFF,0xFF,0xFF,0xFF,0xFB, 0xFF,0xBD,0xFF,0x0F,0xFF,0xBD,0xFF,0xF0,0xEF,0xEF,0xAB,0xEF,0xEF,0xEF,0xED,0xED,0xFF,0x7B,0x7B,0x03,0xFF,0xEF,0xEF,0xE0,0xBF,0x7F,0x7F,0xFF,0xFF,0xFF,0xDF,0xFD, 0xBD,0xFD,0xFD,0xFF,0xBD,0xED,0xBD,0xFF,0xDD,0xBD,0xDD,0xFF,0xFF,0xFF,0xFF,0xFF,0xCF,0xEF,0X00,0xEF,0xEB,0xEB,0x81,0xFB,0xC3,0xDA,0xF7,0xFF,0xDF,0xDF,0xEE,0xFF, 0x80,0xFD,0xFD,0xFF,0xC0,0xED,0xED,0xFF,0xE0,0xBD,0xBD,0xFF,0xFF,0xFF,0xFF,0xFF,0xB3,0X00,0xC7,0x6D,0x8D,0xEB,0xDD,0xF3,0xDB,0xDB,0xFB,0x40,0xDF,0xDF,0xEE,0xE0, 0xFF,0xFD,0xFD,0xFF,0xFF,0xFD,0xED,0xFF,0xFF,0xBD,0xBD,0xFF,0xFF,0xFF,0xFF,0xFF,0xFC,0xB7,0x2B,0xAB,0xDE,0xF7,0xDD,0xFB,0xFB,0x5B,0xC3,0xF7,0xEB,0xD0,0xEE,0xEF, 0xFF,0xFD,0xFD,0xF8,0xFF,0xBD,0xE1,0xC0,0xFF,0xBD,0xBD,0xE0,0xFF,0xFF,0xFF,0xFF,0xFF,0xD3,0xED,0xC7,0xFF,0xF7,0xDC,0xFB,0xFF,0xDB,0xD9,0xF7,0xF7,0xDF,0xC0,0xEE}; const unsigned char data xzL_data =0x08; //0603H;一幕一行字节数 const unsigned int data aL_data =0x20; //单幕单号线(单组线)数据量 const unsigned char data mov =0x03A ; //移动速度 const unsigned int data t_T =0x040A ; //0E0AH ; 05FAH; ;停留时间 const unsigned char data mu_num=0x02 ; //0602H ;幕数 unsigned int m; //m幕长变量<=am_zk unsigned char data_z; //数据寄存器 unsigned int xd; //数据指针寄存器 /*********************************************************************** 数据转移子函数 ===============================================================*/ char MOVD() { unsigned char f,nm; //nm幕数控制 unsigned char code *dptr; unsigned char xdata *xdptr = 0; f = asp ; for (m=0; m
上传时间: 2017-05-04
上传用户:sbfd010
/****************temic*********t5557***********************************/ #include <at892051.h> #include <string.h> #include <intrins.h> #include <stdio.h> #define uchar unsigned char #define uint unsigned int #define ulong unsigned long //STC12C2051AD的SFR定义 sfr WDT_CONTR = 0xe1;//stc2051的看门狗?????? /**********全局常量************/ //写卡的命令 #define write_command0 0//写密码 #define write_command1 1//写配置字 #define write_command2 2//密码写数据 #define write_command3 3//唤醒 #define write_command4 4//停止命令 #define TRUE 1 #define FALSE 0 #define OK 0 #define ERROR 255 //读卡的时间参数us #define ts_min 250//270*11.0592/12=249//取近似的整数 #define ts_max 304//330*11.0592/12=304 #define t1_min 73//90*11.0592/12=83:-10调整 #define t1_max 156//180*11.0592/12=166 #define t2_min 184//210*11.0592/12=194 #define t2_max 267//300*11.0592/12=276 //***********不采用中断处理:采用查询的方法读卡时关所有中断****************/ sbit p_U2270B_Standby = P3^5;//p_U2270B_Standby PIN=13 sbit p_U2270B_CFE = P3^3;//p_U2270B_CFE PIN=6 sbit p_U2270B_OutPut = P3^7;//p_U2270B_OutPut PIN=2 sbit wtd_sck = P1^7;//SPI总线 sbit wtd_si = P1^3; sbit wtd_so = P1^2; sbit iic_data = P1^2;//lcd IIC sbit iic_clk = P1^7; sbit led_light = P1^6;//测试绿灯 sbit led_light1 = P1^5;//测试红灯 sbit led_light_ok = P1^1;//读卡成功标志 sbit fengmingqi = P1^5; /***********全局变量************************************/ uchar data Nkey_a[4] = {0xA0, 0xA1, 0xA2, 0xA3};//初始密码 //uchar idata card_snr[4]; //配置字 uchar data bankdata[28] = {1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7,1,2,3,4,5,6,7}; //存储卡上用户数据(1-7)7*4=28 uchar data cominceptbuff[6] = {1,2,3,4,5,6};//串口接收数组ram uchar command; //第一个命令 uchar command1;// //uint temp; uchar j,i; uchar myaddr = 8; //uchar ywqz_count,time_count; //ywqz jishu: uchar bdata DATA; sbit BIT0 = DATA^0; sbit BIT1 = DATA^1; sbit BIT2 = DATA^2; sbit BIT3 = DATA^3; sbit BIT4 = DATA^4; sbit BIT5 = DATA^5; sbit BIT6 = DATA^6; sbit BIT7 = DATA^7; uchar bdata DATA1; sbit BIT10 = DATA1^0; sbit BIT11 = DATA1^1; sbit BIT12 = DATA1^2; sbit BIT13 = DATA1^3; sbit BIT14 = DATA1^4; sbit BIT15 = DATA1^5; sbit BIT16 = DATA1^6; sbit BIT17 = DATA1^7; bit i_CurrentLevel;//i_CurrentLevel BIT 00H(Saves current level of OutPut pin of U2270B) bit timer1_end; bit read_ok = 0; //缓存定时值,因用同一个定时器 union HLint { uint W; struct { uchar H;uchar L; } B; };//union HLint idata a union HLint data a; //缓存定时值,因用同一个定时器 union HLint0 { uint W; struct { uchar H; uchar L; } B; };//union HLint idata a union HLint0 data b; /**********************函数原型*****************/ //读写操作 void f_readcard(void);//全部读出1~7 AOR唤醒 void f_writecard(uchar x);//根据命令写不同的内容和操作 void f_clearpassword(void);//清除密码 void f_changepassword(void);//修改密码 //功能子函数 void write_password(uchar data *data p);//写初始密码或数据 void write_block(uchar x,uchar data *data p);//不能用通用指针 void write_bit(bit x);//写位 /*子函数区*****************************************************/ void delay_2(uint x) //延时,时间x*10us@12mhz,最小20us@12mhz { x--; x--; while(x) { _nop_(); _nop_(); x--; } _nop_();//WDT_CONTR=0X3C;不能频繁的复位 _nop_(); } ///////////////////////////////////////////////////////////////////// void initial(void) { SCON = 0x50; //串口方式1,允许接收 //SCON =0x50; //01010000B:10位异步收发,波特率可变,SM2=0不用接收到有效停止位才RI=1, //REN=1允许接收 TMOD = 0x21; //定时器1 定时方式2(8位),定时器0 定时方式1(16位) TCON = 0x40; //设定时器1 允许开始计时(IT1=1) TH1 = 0xfD; //FB 18.432MHz 9600 波特率 TL1 = 0xfD; //fd 11.0592 9600 IE = 0X90; //EA=ES=1 TR1 = 1; //启动定时器 WDT_CONTR = 0x3c;//使能看门狗 p_U2270B_Standby = 0;//单电源 PCON = 0X00; IP = 0x10;//uart you xian XXXPS PT1 PX1 PT0 PX0 led_light1 = 1; led_light = 0; p_U2270B_OutPut = 1; } /************************************************/ void f_readcard()//读卡 { EA = 0;//全关,防止影响跳变的定时器计时 WDT_CONTR = 0X3C;//喂狗 p_U2270B_CFE = 1;// delay_2(232); //>2.5ms /* // aor 用唤醒功能来防碰撞 p_U2270B_CFE = 0; delay_2(18);//start gap>150us write_bit(1);//10=操作码读0页 write_bit(0); write_password(&bankdata[24]);//密码block7 p_U2270B_CFE =1 ;// delay_2(516);//编程及确认时间5.6ms */ WDT_CONTR = 0X3C;//喂狗 led_light = 0; b.W = 0; while(!(read_ok == 1)) { //while(p_U2270B_OutPut);//等一个稳定的低电平?超时判断? while(!p_U2270B_OutPut);//等待上升沿的到来同步信号检测1 TR0 = 1; //deng xia jiang while(p_U2270B_OutPut);//等待下降沿 TR0 = 0; a.B.H = TH0; a.B.L = TL0; TH0 = TL0 = 0; TR0 = 1;//定时器晚启动10个周期 //同步头 if((324 < a.W) && (a.W < 353)) ;//检测同步信号1 else { TR0 = 0; TH0 = TL0 = 0; goto read_error; } //等待上升沿 while(!p_U2270B_OutPut); TR0 = 0; a.B.H = TH0; a.B.L = TL0; TH0 = TL0 = 0; TR0 = 1;//b.N1<<=8; if(a.B.L < 195);//0.5p else { TR0 = 0; TH0 = TL0 = 0; goto read_error; } //读0~7块的数据 for(j = 0;j < 28;j++) { //uchar i; for(i = 0;i < 16;i++)//8个位 { //等待下降沿的到来 while(p_U2270B_OutPut); TR0 = 0; a.B.H = TH0; a.B.L = TL0; TH0 = TL0 = 0; TR0 = 1; if(t2_max < a.W/*)&&(a.W < t2_max)*/)//1P { b.W >>= 2;//先左移再赋值 b.B.L += 0xc0; i++; } else if(t1_min < a.B.L/*)&&(a.B.L < t1_max)*/)//0.5p { b.W >>= 1; b.B.L += 0x80; } else { TR0 = 0; TH0 = TL0 = 0; goto read_error; } i++; while(!p_U2270B_OutPut);//上升 TR0 = 0; a.B.H = TH0; a.B.L = TL0; TH0 = TL0 = 0; TR0 = 1; if(t2_min < a.W/*)&&(a.W < t2_max)*/)//1P { b.W >>= 2; i++; } else if(t1_min < a.B.L/*a.W)&&(a.B.L < t1_max)*/)//0.5P //else if(!(a.W==0)) { b.W >>= 1; //temp+=0X00; //led_light1=0;led_light=1;delay_2(40000); } else { TR0 = 0; TH0 = TL0 = 0; goto read_error; } i++; } //取出奇位 DATA = b.B.L; BIT13 = BIT7; BIT12 = BIT5; BIT11 = BIT3; BIT10 = BIT1; DATA = b.B.H; BIT17 = BIT7; BIT16 = BIT5; BIT15 = BIT3; BIT14 = BIT1; bankdata[j] = DATA1; } read_ok = 1;//读卡完成了 read_error: _nop_(); } } /***************************************************/ void f_writecard(uchar x)//写卡 { p_U2270B_CFE = 1; delay_2(232); //>2.5ms //psw=0 standard write if (x == write_command0)//写密码:初始化密码 { uchar i; uchar data *data p; p = cominceptbuff; p_U2270B_CFE = 0; delay_2(31);//start gap>330us write_bit(1);//写操作码1:10 write_bit(0);//写操作码0 write_bit(0);//写锁定位0 for(i = 0;i < 35;i++) { write_bit(1);//写数据位1 } p_U2270B_CFE = 1; led_light1 = 0; led_light = 1; delay_2(40000);//测试使用 //write_block(cominceptbuff[4],p); p_U2270B_CFE = 1; bankdata[20] = cominceptbuff[0];//密码存入 bankdata[21] = cominceptbuff[1]; bankdata[22] = cominceptbuff[2]; bankdata[23] = cominceptbuff[3]; } else if (x == write_command1)//配置卡参数:初始化 { uchar data *data p; p = cominceptbuff; write_bit(1);//写操作码1:10 write_bit(0);//写操作码0 write_bit(0);//写锁定位0 write_block(cominceptbuff[4],p); p_U2270B_CFE= 1; } //psw=1 pssword mode else if(x == write_command2) //密码写数据 { uchar data*data p; p = &bankdata[24]; write_bit(1);//写操作码1:10 write_bit(0);//写操作码0 write_password(p);//发口令 write_bit(0);//写锁定位0 p = cominceptbuff; write_block(cominceptbuff[4],p);//写数据 } else if(x == write_command3)//aor //唤醒 { //cominceptbuff[1]操作码10 X xxxxxB uchar data *data p; p = cominceptbuff; write_bit(1);//10 write_bit(0); write_password(p);//密码 p_U2270B_CFE = 1;//此时数据不停的循环传出 } else //停止操作码 { write_bit(1);//11 write_bit(1); p_U2270B_CFE = 1; } p_U2270B_CFE = 1; delay_2(560);//5.6ms } /************************************/ void f_clearpassword()//清除密码 { uchar data *data p; uchar i,x; p = &bankdata[24];//原密码 p_U2270B_CFE = 0; delay_2(18);//start gap>150us //操作码10:10xxxxxxB write_bit(1); write_bit(0); for(x = 0;x < 4;x++)//发原密码 { DATA = *(p++); for(i = 0;i < 8;i++) { write_bit(BIT0); DATA >>= 1; } } write_bit(0);//锁定位0:0 p = &cominceptbuff[0]; write_block(0X00,p);//写新配置参数:pwd=0 //密码无效:即清除密码 DATA = 0X00;//停止操作码00000000B for(i = 0;i < 2;i++) { write_bit(BIT7); DATA <<= 1; } p_U2270B_CFE = 1; delay_2(560);//5.6ms } /*********************************/ void f_changepassword()//修改密码 { uchar data *data p; uchar i,x,addr; addr = 0x07;//block7 p = &Nkey_a[0];//原密码 DATA = 0x80;//操作码10:10xxxxxxB for(i = 0;i < 2;i++) { write_bit(BIT7); DATA <<= 1; } for(x = 0;x < 4;x++)//发原密码 { DATA = *(p++); for(i = 0;i < 8;i++) { write_bit(BIT7); DATA >>= 1; } } write_bit(0);//锁定位0:0 p = &cominceptbuff[0]; write_block(0x07,p);//写新密码 p_U2270B_CFE = 1; bankdata[24] = cominceptbuff[0];//密码存入 bankdata[25] = cominceptbuff[1]; bankdata[26] = cominceptbuff[2]; bankdata[27] = cominceptbuff[3]; DATA = 0X00;//停止操作码00000000B for(i = 0;i < 2;i++) { write_bit(BIT7); DATA <<= 1; } p_U2270B_CFE = 1; delay_2(560);//5.6ms } /***************************子函数***********************************/ void write_bit(bit x)//写一位 { if(x) { p_U2270B_CFE = 1; delay_2(32);//448*11.0592/120=42延时448us p_U2270B_CFE = 0; delay_2(28);//280*11.0592/120=26写1 } else { p_U2270B_CFE = 1; delay_2(92);//192*11.0592/120=18 p_U2270B_CFE = 0; delay_2(28);//280*11.0592/120=26写0 } } /*******************写一个block*******************/ void write_block(uchar addr,uchar data *data p) { uchar i,j; for(i = 0;i < 4;i++)//block0数据 { DATA = *(p++); for(j = 0;j < 8;j++) { write_bit(BIT0); DATA >>= 1; } } DATA = addr <<= 5;//0地址 for(i = 0;i < 3;i++) { write_bit(BIT7); DATA <<= 1; } } /*************************************************/ void write_password(uchar data *data p) { uchar i,j; for(i = 0;i < 4;i++)// { DATA = *(p++); for(j = 0;j < 8;j++) { write_bit(BIT0); DATA >>= 1; } } } /*************************************************/ void main() { initial(); TI = RI = 0; ES = 1; EA = 1; delay_2(28); //f_readcard(); while(1) { f_readcard(); //读卡 f_writecard(command1); //写卡 f_clearpassword(); //清除密码 f_changepassword(); //修改密码 } }
标签: 12345
上传时间: 2017-10-20
上传用户:my_lcs
在本课中,我们要用一个按键来实现跑马灯的 10 级调速。这又会涉及到键的去抖的问 题。 本课的试验结果是,每按一次按键,跑马速度就降低一级,共 10 级。 这里我们又增加了一个变量 speedlever,来保存当前的速度档次。 在按键里的处理中,多了当前档次的延时值的设置。 请看程序: ―――――――――――――――― #define uchar unsigned char //定义一下方便使用 #define uint unsigned int #define ulong unsigned long #include <reg52.h> //包括一个 52 标准内核的头文件 sbit P10 = P1^0; //头文件中没有定义的 IO 就要自己来定义了 sbit P11 = P1^1; sbit P12 = P1^2; sbit P13 = P1^3; sbit K1= P3^2; bit ldelay=0; //长定时溢出标记,预置是 0 uchar speed=10; //设置一个变量保存默认的跑马灯的移动速度 uchar speedlever=0; //保存当前的速度档次 char code dx516[3] _at_ 0X003b;//这是为了仿真设置的 //一个按键控制的 10 级变速跑马灯试验 void main(void) // 主程序 { uchar code ledp[4]={0xfe,0xfd,0xfb,0xf7};//预定的写入 P1 的值 uchar ledi; //用来指示显示顺序 uint n; RCAP2H =0x10; //赋 T2 的预置值 0x1000,溢出 30 次就是 1 秒钟 RCAP2L =0X00; TR2=1; //启动定时器 ET2=1; //打开定时器 2 中断 EA=1; //打开总中断 while(1) //主程序循环 { if(ldelay) //发现有时间溢出标记,进入处理 { ldelay=0; //清除标记 P1=ledp[ledi]; //读出一个值送到 P1 口 ledi++; //指向下一个 if(ledi==4) { ledi=0; //到了最后一个灯就换到第一个 } } if(!K1) //如果读到 K1 为 0 { for(n=0;n<1000;n++); //等待按键稳定 while(!K1); //等待按键松开 for(n=0;n<1000;n++); //等待按键稳定松开 speedlever++; if(speedlever==10)speedlever=0; speed=speedlever*3; //档次和延时之间的预算法则,也可以用查表方法,做出 不规则的法则 } } } //定时器 2 中断 timer2() interrupt 5 { static uchar t; TF2=0; t++; if((t==speed)||(t>30)) //比较一个变化的数值,以实现变化的时间溢出,同时限制了最慢速 度为 1 秒 { t=0; ldelay=1;//每次长时间的溢出,就置一个标记,以便主程序处理 } } ―――――――――――――――――――――― 请打开 lesson11 目录的工程,编译,运行,看结果: 按 K1,速度则降低一次,总共 10 个档次。
上传时间: 2017-11-06
上传用户:szcyclone
题目:基于51单片机的RS485从机系统设计 单片机接口资源配置: 1. 上电复位电路; 2. 晶振电路采用11.0592Mhz晶振; 3. 485接口电路(P3.7用于485芯片的收发控制,收发管脚接单片机的rxd和txd); 4. P2口通过外部跳线接相应的高低电平,配置从机地址为组号; 5. P3.6外接一发光二极管(注意串联电阻进行限流); 6. P3.2外接一按键,断开高电平,按下低电平; 7. 按键检测采用外部中断方式,下跳沿触发; 8. 单片机定时器0以模式1(16位模式)工作,产生50ms的定时中断,并在此基础上设计一单片机内部时钟(24小时制,能计数时、分、秒、50ms值); 9. 单片机串行通信采用模式1非多机通信方式,采用9600波特率以串行中断方式进行数据的收发通信,主机地址为0xF0,广播地址为0xFF。 系统功能需求: 1. 系统配置和自检功能: l 从机上电后进行初始化,通过读取P2口进行从机地址配置; l 发光二极管以每秒一次的频率闪烁(亮0.5秒,灭0.5秒); l 检测到一次按键按下操作后,熄灭发光二极管。 2. 数据接收和按键计时功能: l 从机接收主机程序(PC机上的串口调试程序)的按键允许命令帧并进行校验; l 校验正确并且目的地址是广播地址或者本从机的地址,通过发光二极管长亮指示,并允许按键操作; l 按键按下后,尽可能准确记录按键的动作时点(定时器的低8位、定时器的高8位、50ms值、秒、分、小时); l 按键操作只能响应一次,重复按键操作不响应; l 按键的动作时点记录后,发光二极管以每秒一次的频率闪烁(亮0.5秒,灭0.5秒)。 3. 数据发送功能: l 从机接收主机程序发来的时钟数据搜索命令帧并进行校验; l 如果校验正确并且数据帧的目的地址是本从机的地址,从机将前面记录的按键动作时点数据(定时器的低8位、定时器的高8位、50ms值、秒、分、小时)按附录中的时钟数据返回帧的帧格式回传给主机; l 时钟数据返回帧回传结束后,熄灭发光二极管。 4. 校验和生成和检测功能: l 发送数据帧时能自动生成数据帧校验和; l 每帧数据在发送帧尾前,发送一字节的当前帧数据的校验和; l 接收数据帧时能检测校验和并判断接收数据是否正确。 附录:帧定义 校验和的计算:除去帧头和帧尾后将帧中的其他数据求和并取低8位; 帧长:不计帧头、帧尾和校验和字节。 按键允许命令帧: 帧头 帧长 目的地址 源地址 命令字 校验和 帧尾 AA 04 FF F0 01 F4 66 时钟数据搜索命令帧: 帧头 帧长 目的地址 源地址 命令字 保留字 校验和 帧尾 AA 05 01 F0 03 00 F9 66 时钟数据返回帧: 帧头 帧长 目的地址 源地址 命令字 TL0 TH0 50ms 秒 分 时 校验和 帧尾 AA 0A F0 01 07 01 B6 09 03 00 00 C5 66 帧结构头文件frame.h(内容如下) //帧格式定义 #define FRAME_HEAD 0xAA //帧头 #define FRAME_FOOT 0x66 //帧尾 #define FRAME_LEN 0X00 //帧长 #define FRAME_DST_ADR 0x01 //目的地址 #define FRAME_SRC_ADR 0x02 //源地址 #define FRAME_CMD 0x03 //命令字 #define FRAME_DATA 0x04 //帧数据起始 //帧命令定义 #define READY 0x01 //按键允许命令 #define TIME_SERCH 0x03 //时钟数据轮询命令 #define TIME_BACK 0x07 //时钟数据返回命令 //地址定义 #define BROAD_ADR 0xFF //广播地址 #define MASTER_ADR 0xF0 //主机地址
上传时间: 2020-06-18
上传用户:umuo
宏晶 STC15F2K60S2开发板配套软件源码 基础例程30例/**********************基于STC15F2K60S2系列单片机C语言编程实现使用如下头文件,不用另外再包含"REG51.H"#include <STC15F2K60S2.h>***********************/#include "STC15F2K60S2.H"//#include "REG51.H" //sfr P4 = 0xC0;#define uint unsigned int #define uchar unsigned char /**********************引脚别名定义***********************/sbit SEL=P4^3; // LED和数码管选择引脚 高:LED有效 低:数码管有效 // SEL连接的单片机引脚必须为带有上拉电阻的引脚 或将其直接连接VCC#define data P2 // 数据输入定义 /**********************函数名称:Delay_1ms功能描述:延时入口参数:unsigned int t 表示要延时t个1ms 出口参数:无备注:通过参数t,控制延时的时间长短***********************/void Delay_1ms(uint t){ uchar j; for(;t>0;t--) for(j=110;j>0;j--) ;}/**********************函数名称:Led_test功能描述:对8个二极管进行测试,依次轮流点亮8个二极管入口参数:无出口参数:无备注: ***********************/void Led_test(){ uchar G_value=0x01; // 给变量赋初值 SEL=1; //高电平LED有效 while(1) { data=G_value; Delay_1ms(10000); G_value=G_value<<1; if(G_value==0X00) { data=G_value; Delay_1ms(10000); G_value=0x01; } }}/***********************主函数************************/void main(){ ///////////////////////////////////////////////// //注意: STC15W4K32S4系列的芯片,上电后所有与PWM相关的IO口均为 // 高阻态,需将这些口设置为准双向口或强推挽模式方可正常使用 //相关IO: P0.6/P0.7/P1.6/P1.7/P2.1/P2.2 // P2.3/P2.7/P3.7/P4.2/P4.4/P4.5 ///////////////////////////////////////////////// P4M1=0X00; P4M0=0X00; P2M0=0xff; P2M1=0X00; //将P2设为推挽 Led_test(); }
标签: STC15F2K60S2
上传时间: 2022-05-03
上传用户: