资源描述:
《凌阳61 1602语音电子钟c程序》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、凌阳611602语音电子钟C程序#include#defineE0x0008#defineRW0x0004#defineRS0x0002//#includevoidplay(playnum);constunsignedintfchar[]={"jianwuHYZ"};constunsignedintfirst[]={"PressKey5Play"};staticunsignedintnum[10]={'0','1','2','3','4','5','6','7','8','9'};//staticintAddre
2、ss[10]={0x3f00,0x8600,0xdb00,0xcf00,0xe600,0xed00,0x7d00,0x8700,0xff00,0xef00};staticintaddres[10]={0xc000,0xf900,0xa400,0xb000,0x9900,0x9200,0x8200,0xf800,0x8000,0x9000};enumplaynum{A_0,A_1,A_2,A_3,A_4,A_5,A_6,A_7,A_8,A_9,A_10,A_11,A_12,A_DIAN,A_FEN,A_MIAO,A_LC,A_SW,A_XW,A_WS,A_
3、XZSK};unsignedinthour=23,min=5,sec=0,key;//voidIRQ4(void)__attribute__((ISR));voidFIQ(void)__attribute__((ISR));__asm(".externalF_FIQ_Service_SACM_A2000");voidinit_io();voidinit_lcd_1602();voidwr_com(unsignedintcom);voidwr_data(data);voidshow_lcd_1602();voiddelay(unsignedintj);ch
4、arscankey();unsignedintkey2,playnum,flag=0;intmain(){*P_IOA_Dir=0xff00;*P_IOA_Attrib=0xff00;*P_IOA_Data=0xff00;*P_IOB_Dir=0xffff;*P_IOB_Attrib=0xffff;//*P_IOB_Data=0xffff;*P_TimeBase_Setup=0x0004;//*P_INT_Ctrl=C_IRQ4_1KHz
5、C_IRQ2_TMB
6、C_FIQ_TMA
7、C_IRQ6_TMB1;*P_INT_Ctrl=C_IRQ2_TMB
8、C_
9、FIQ_TMA
10、C_IRQ6_TMB1
11、C_IRQ6_TMB2;//*P_INT_Ctrl=C_IRQ2_TMB
12、C_FIQ_TMA
13、C_IRQ6_TMB1
14、C_IRQ5_2Hz;*P_TimerB_Ctrl=C_SourceC_4096Hz;*P_TimerB_Data=0xffff-4095;//注意不是减4096后来发现的错误要溢出才会来一次//*P_TimerA_Ctrl=C_SourceC_4096Hz;//*P_TimerA_Data=0xffff-400;init_io();init_lcd_1602();__asm("intirq,fiq
15、");while(1){key=scankey();if(key==0x1000)playtime();*P_Watchdog_Clear=1;//*P_INT_Ctrl=C_IRQ4_1KHz
16、C_IRQ2_TMB
17、C_FIQ_TMA
18、C_IRQ6_TMB1;//__asm("intirq,fiq");if(flag==1){show_lcd_1602();flag=0;}}return0;}voidinit_io(){*P_IOA_Dir=0xff00
19、(*P_IOA_Dir&0x00ff);*P_IOA_Attrib=0xff00
20、(*P_IOA_
21、Attrib&0x00ff);*P_IOB_Dir=0x000f
22、(*P_IOB_Dir&0xfff0);*P_IOB_Attrib=0x000f
23、(*P_IOB_Attrib&0xfff0);}voidinit_lcd_1602(){wr_com(1);delay(15);wr_com(0x38);wr_com(0x0e);wr_com(0x06);}voidwr_com(unsignedintcom){delay(1);//*P_IOB_Buffer&=~RS;*P_IOB_Buffer&=~RS;*P_IOB_Buffer&=~RW;*P_IOB_
24、Buffer
25、=E;*P_IOA_Buffer=(com<<8)
26、(*P_IOA