书上代码运行错误,求高手指教
部分代码如下,书上的代码怎么会这么多错误?#include<reg52.h>#defineuintunsignedint#defineucharunsignedcharu...
部分代码如下,书上的代码怎么会这么多错误?
#include<reg52.h>
#define uint unsigned int
#define uchar unsigned char
uchar code table[]={
0x3f,0x06,0x5b,0x4f,
0x66,0x6d,0x7d,0x07,
0x7f,0x6f};
uchar disp[4];
sbit ST =P3^0;
sbit 0E = P3^1;
sbit E0C =P3^2;
sbit CLK =P3^3;
sbit p17 =P1^7;
int getdata,temp;
void delay(uint z);
void display();
void initial();
void main()
{
initial();
while(1)
{
0E =0;
ST =0;
ST =1;
ST =0;
while(E0C==0);
0E =1;
getdata =P0;
0E =0;
。。。
错误如下
DIANYA.C(10): error C281: illegal floating point constant
DIANYA.C(10): error C141: syntax error near '0E', expected '<id>'
DIANYA.C(23): error C281: illegal floating point constant
DIANYA.C(28): error C281: illegal floating point constant
DIANYA.C(30): error C281: illegal floating point constant
DIANYA.C(42): error C141: syntax error near ')'
DIANYA.C(43): error C141: syntax error near ')'
DIANYA.C(47): error C202: 'TM0D': undefined identifier
DIANYA.C(55): error C132: 'interrupt1': not in formal parameter list
DIANYA.C(55): error C141: syntax error near '{'
DIANYA.C(56): error C244: 'TH0': can't initialize, bad type or class
DIANYA.C(56): error C132: 'TH0': not in formal parameter list
DIANYA.C(57): error C244: 'TL0': can't initialize, bad type or class
DIANYA.C(57): error C132: 'TL0': not in formal parameter list
DIANYA.C(58): error C244: 'CLK': can't initialize, bad type or class
DIANYA.C(58): error C132: 'CLK': not in formal parameter list
DIANYA.C(59): error C141: syntax error near '}'
目标未创建 展开
#include<reg52.h>
#define uint unsigned int
#define uchar unsigned char
uchar code table[]={
0x3f,0x06,0x5b,0x4f,
0x66,0x6d,0x7d,0x07,
0x7f,0x6f};
uchar disp[4];
sbit ST =P3^0;
sbit 0E = P3^1;
sbit E0C =P3^2;
sbit CLK =P3^3;
sbit p17 =P1^7;
int getdata,temp;
void delay(uint z);
void display();
void initial();
void main()
{
initial();
while(1)
{
0E =0;
ST =0;
ST =1;
ST =0;
while(E0C==0);
0E =1;
getdata =P0;
0E =0;
。。。
错误如下
DIANYA.C(10): error C281: illegal floating point constant
DIANYA.C(10): error C141: syntax error near '0E', expected '<id>'
DIANYA.C(23): error C281: illegal floating point constant
DIANYA.C(28): error C281: illegal floating point constant
DIANYA.C(30): error C281: illegal floating point constant
DIANYA.C(42): error C141: syntax error near ')'
DIANYA.C(43): error C141: syntax error near ')'
DIANYA.C(47): error C202: 'TM0D': undefined identifier
DIANYA.C(55): error C132: 'interrupt1': not in formal parameter list
DIANYA.C(55): error C141: syntax error near '{'
DIANYA.C(56): error C244: 'TH0': can't initialize, bad type or class
DIANYA.C(56): error C132: 'TH0': not in formal parameter list
DIANYA.C(57): error C244: 'TL0': can't initialize, bad type or class
DIANYA.C(57): error C132: 'TL0': not in formal parameter list
DIANYA.C(58): error C244: 'CLK': can't initialize, bad type or class
DIANYA.C(58): error C132: 'CLK': not in formal parameter list
DIANYA.C(59): error C141: syntax error near '}'
目标未创建 展开
1个回答
2013-11-16
展开全部
你好!
从你贴出来的代码看 0E 前面是字母 O 不是数字的零,其它的买代码,不明情况!
从你贴出来的代码看 0E 前面是字母 O 不是数字的零,其它的买代码,不明情况!
追问
void timer0()interrupt1
{
TH0=(65536-20)/256;
TL0=(65536-20)%256;
CLK=~CLK;
}上面回答的很好,剩下的错误都出在这个代码里面,错误提示在上面55-59,您费心了。
追答
你好!
你的 void timer0()interrupt 1 ,1 的前面有个空格;
还有什么问题吗
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询