| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 604 人关注过本帖
标题:用keil中程序错误,不知道怎么改
只看楼主 加入收藏
cyi1015
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2015-4-22
收藏
 问题点数:0 回复次数:0 
用keil中程序错误,不知道怎么改
#include<reg51.h>
#include<intrins.h>
#define uchar unsigned char
#define uint unsigned int
bit flag;

uchar code table[]={0x30,0x31,0x32,0x33,0x34,0x35,0x36,0x37,0x38,0x39};
uchar code tab[]="Yulin  University";
uchar code table1[]="Gas  strength0.5%";

sbit lcdrs=P3^0;   
sbit lcdrw=P3^1;
sbit lcden=P3^2;
sbit start=P3^4;

sbit eoc=P3^3;     
sbit oe=P3^5;
sbit CLK=P3^6;

uchar shi,ge,shi1,bai1,num;
uint temp;
uchar count;

void delay(uint z)
{
    uint x,y;
    for(x=z;x>0;x--)
        for(y=110;y>0;y--);
}

void dely500(void)
{
    unsigned char i;
    for(i=250;i>0;i--)
    {
        _nop_();
    }
}

void write_com(uchar com)
{
    lcdrs=0;
    P1=com;
    delay(1);
    lcden=1;
    delay(1);
    lcden=0;
}

void write_data(uchar date)
{
    lcdrs=1;
    P1=date;
    delay(1);
    lcden=1;
    delay(1);
    lcden=0;
}

void init()      
{
    oe=0;
    lcden=0;
    lcdrw=0;
    write_com(0x38);
    write_com(0x0c);
    write_com(0x06);
    write_com(0x01);
    write_com(0x80);
    temp=0;
    TMOD=0x01;
    TH0=(65536-500)/256;
    TL0=(65536-500)%256;
    EA=1;
    ET0=1;
    TR0=1;
}
 
void voltage(uchar ge,uchar shi,uchar bai1)
{
        shi=temp/1000;
        ge=temp%1000/100;
        shi1=temp%100/10;
        bai1=temp%10;
        write_com(0x80);
        for(num=0;num<16;num++)
        {
            write_data(tab[num]);
        }
        write_com(0xc0);
        for(num=0;num<6;num++)
        {
            write_data(table1[num]);
        }
        write_com(0xc7);
        write_data(table[shi]);
        delay(1);
        write_com(0xc8);
        write_data(table[ge]);
        delay(1);
        write_com(0xc9);
        write_data('.');
        delay(1);
        write_com(0xca);
        write_data(table[shi1]);
        delay(1);
        write_com(0xcb);
        write_data(table[bai1]);
        delay(1);
        write_com(0xcc);
        for(num=0;num<2;num++)
        {
            write_data(table2[num]);
        }

        start=0;
        start=1;
        start=0;
        while(!eoc);   
        oe=1;
        temp=P2;
        oe=0;
        temp=(temp*2*1*98.039216/100);

        if(temp>=200)
        {
            for(count=200;count>0;count--)
            {
                P0_7=~P0_7;
                dely500();
            }
            for(count=200;count>0;count--)
            {
                P0_7=~P0_7;
                dely500();
                dely500();
            }
        }
}

void timer0() interrupt 1
{
    TH0=(65536-500)/256;
    TL0=(65536-500)%256;
    CLK=~CLK;   
}
void main()
{  
    init();
       while(1)
       {     
        voltage(ge,shi,bai1);
    }
}




Build target 'Target 1'
compiling wasi.c...
wasi.c(113): error C202: 'table2': undefined identifier
wasi.c(129): error C202: 'P0_7': undefined identifier
wasi.c(134): error C202: 'P0_7': undefined identifier
Target not created.
搜索更多相关主题的帖子: University include count start 
2015-04-22 10:07
快速回复:用keil中程序错误,不知道怎么改
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.015871 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved