標題: 求大神幫忙看下程序怎么改 [打印本頁]
作者: guojian123 時間: 2017-12-6 10:26
標題: 求大神幫忙看下程序怎么改
#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
作者: 不倒翁.WZT 時間: 2017-12-6 19:04
標題: RE: 求大神幫忙看下程序怎么改
報警:Pro_main.C(27): error C267: 'While': requires ANSI-style prototype是因為While(1)中w用了大寫W應該w。
Pro_main.C(29): error C202: 'Key_Change': undefined identifier中 'Key_Change'沒有定義。
Pro_main.C(32): error C202: 'View_Change': undefined identifier中View_Change沒有定義。
Pro_main.C(33): error C202: 'Key_Value': undefined identifier中Key_Value沒有定義
Pro_main.C(34): error C141: syntax error near '}'中switch(Key_Value)應用不當
Pro_main.C(35): error C202: 'View_Change': undefined identifier中View_Change沒有定義
沒有定義
Pro_main.C(38): error C202: 'stop': undefined identifier中stop'沒有定義
Pro_main.C(41): error C183: unmodifiable lvalue中View_Data[0]==0x30錯誤
Pro_main.C(45): error C183: unmodifiable lvalue中View_Data[0]==0x30錯誤
Pro_main.C(46): error C183: unmodifiable lvalue中View_Data[0]==0x30錯誤
Pro_main.C(47): error C183: unmodifiable lvalue中View_Data[0]==0x30錯誤
Pro_main.C(49): error C202: 'View_Con': undefined identifier中View_Con'沒有定義
Pro_main.C(50): error C141: syntax error near '}'中switch(View_Con)應用錯誤
| 歡迎光臨 (http://www.denmoz.com/bbs/) |
Powered by Discuz! X3.1 |