#include <reg52.h> #include <intrins.h> #define uint unsigned int #define uchar unsigned char #define ulong unsigned long #define LCD_DATA P0 #define LCD_1602_DATA LCD_DATA code unsigned char View_Data[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f}; sbit LCD_RS=P2^5; sbit LCD_RW=P2^6; sbit LCD_E=P2^7; sbit Maibo=P3^2; sbit speaker=P2^4; void lcd_1602_word(uchar Adress_Com,uchar Num_Adat,uchar *Adress_Data); void delay5ms(void); void LCD_WriteData(uchar LCD_1602_DATA); void LCD_WriteCom(uchar LCD_1602_COM); void Tim_Init(); void InitLcd(); void main() { InitLcd(); Tim_Init(); lcd_1602_word(0x80,16,"Pulse Rate: "); TR0=1; TR1=1; While(1) { if(Key_Change) { Key_Change=0; View_Change=1; switch(Key_Value) } if(View_Change) { View_Change=0; if(stop==0) { if(View_Data[0]==0x30) View_Data[0]=' '; } else { View_Data[0]=' '; View_Data[1]=' '; View_Data[2]=' '; } switch(View_Con) } } } void Timel() interrupt 3 { static uchar Key_Con,Maibo_Con; TH1=0xd8; TL1=0xf0; switch(Key_Con) { case 0: { } case 1: { } case 2: { } } switch(Maibo_Con) { case 0: { } case 4: { } } } void lcd_1602_word(uchar Adress_Com,uchar Num_Adat,uchar *Adress_Data) { uchar a=0; uchar Data_Word; LCD_WriteCom(Adress_Com); for(a=0;a<Num_Adat;a++) { Data_Word=*Adress_Data; LCD_WriteData(Data_Word); Adress_Data++; } } void LCD_WriteData(uchar LCD_1602_DATA) { delay5ms(); LCD_E=0; LCD_RS=1; LCD_RW=0; _nop_(); LCD_E=1; LCD_DATA=LCD_1602_DATA; LCD_E=0; LCD_RS=0; } void LCD_WriteCom(uchar LCD_1602_COM) { delay5ms(); LCD_E=0; LCD_RS=0; LCD_RW=0; _nop_(); LCD_E=1; LCD_DATA=LCD_1602_DATA; LCD_E=0; LCD_RS=0; } void InitLcd() { delay5ms(); delay5ms(); LCD_WriteCom(0x38); LCD_WriteCom(0x38); LCD_WriteCom(0x38); LCD_WriteCom(0x06); LCD_WriteCom(0x0c); LCD_WriteCom(0x01); delay5ms(); delay5ms(); } 报错: yjxs.c(27): warning C206: 'While': missing function-prototype yjxs.c(27): error C267: 'While': requires ANSI-style prototype yjxs.c(28): error C141: syntax error near '{' yjxs.c(29): error C202: 'Key_Change': undefined identifier yjxs.c(31): error C202: 'Key_Change': undefined identifier yjxs.c(32): error C202: 'View_Change': undefined identifier yjxs.c(33): error C202: 'Key_Value': undefined identifier yjxs.c(34): error C141: syntax error near '}' yjxs.c(35): error C202: 'View_Change': undefined identifier yjxs.c(37): error C202: 'View_Change': undefined identifier yjxs.c(38): error C202: 'stop': undefined identifier yjxs.c(49): error C202: 'View_Con': undefined identifier yjxs.c(50): error C141: syntax error near '}' Target not created
|