找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 1580|回复: 1
打印 上一主题 下一主题
收起左侧

求大神帮忙看下程序怎么改

[复制链接]
跳转到指定楼层
楼主
ID:258066 发表于 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

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享淘帖 顶 踩
回复

使用道具 举报

沙发
ID:149988 发表于 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)应用错误
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|51黑电子论坛 |51黑电子论坛6群 QQ 管理员QQ:125739409;技术交流QQ群281945664

Powered by 单片机教程网

快速回复 返回顶部 返回列表