本帖最后由 乐乐ing 于 2016-8-12 11:14 编辑
刚开始接触
单片机。
看的是老郭的视频,
下面一段程序,照着视频敲得,但还是提示语法错误,求解
- #include<reg52.h>
- #include<intrins.h>
- #define uint unsigned int
- #define uchar unsigned char;
- uchar temp,aa,numdu,numwe,bai,shi,ge;
- uchar code table[]={
- 0x3f,0x06,0x5b,0x4f,
- 0x66,0x6d,0x7d,0x07,
- 0x7f,0x6f,0x77,0x7c,
- 0x39,0x5e,0x79,0x71};
- sbit dula=P2^6;
- sbit wela=P2^7;
- void delay(uint );
- void display(uchar ,uchar ,uchar);
- int main()
- {
-
- temp=126;
- bai=temp/100;
- shi=temp%100/10;
- ge=temp%10;
- while(1)
- {
- display(bai,shi,ge);
- }
- }
- void delay(uint z)
- {
- uint x,y;
- for(x=z;x>0;x--)
- for(y=110;y>0;y--)
- ;
- }
- void display(uchar bai,uchar shi,uchar ge)
- {
- dula=1;
- P0=table[bai];
- dula=0;
- wela=1;
- P0=0xfe;
- wela=0;
- delay(5);
- dula=1;
- P0=table[shi];
- dula=0;
- wela=1;
- P0=0xfd;
- wela=0;
- delay(5);
- dula=1;
- P0=table[ge];
- dula=0;
- wela=1;
- P0=0xfb;
- wela=0;
- delay(5);
- }
复制代码
编译的时候,总是提示
34行与14行在分号附近有错误,求解,谢谢啦
大师你好哈
一周热门 更多>