标题: 求大神帮忙看下程序怎么改 [打印本页]
作者: 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.51hei.com/bbs/) |
Powered by Discuz! X3.1 |