2824 views|6 replies

44

Posts

0

Resources
The OP
 

The compiler keeps reporting an error, saying there is an error here. I have looked at it many times but can't find where the problem is. [Copy link]

Dear experts:

Please help me check, the compiler keeps reporting an error, saying there is an error here, I have looked many times but can't find where the problem is
#include<reg52.h> //52 MCU header file
#include <intrins.h> //Contains the library of left and right circular shift sub-functions
#define uint unsigned int //macro definition
#define uchar unsigned char //macro definition
#define time 3000 //Macro definition of timing initial value time
sbit dula=P2^6;
sbit wela=P2^7;
uchar code tabLEDu[]={ //Display data encoding--segment code
0x3f,0x06,0x5b,0x4f,
0x66,0x6d,0x7d,0x07,
0x7f,0x6f,0x77,0x7c,
0x39,0x5e,0x79,0x71,
0x76,0x79,0x38,0x3f,0};
uchar code tablewe[]={ //Display data encoding--bit code
0xfe,0xfd,0xfb,0xf7,0xef,0xdf};
uchar num,numwe,numdu,i;
uint bai,shi,ge;
void init();
void display();
void display0(uint bai,uint shi,uint ge); //The compiler keeps reporting an error, saying there is an error here

void delay();

void main()
{
init();
while(1)
{
if(num==1)
{
num=0;
display();
}
for(i=0;i<34;i++)
{

static uint a = 432;

a--;

bai=a/100;

shi=(a/10)%10;
ge=a%10;
display0(uint bai,uint shi,uint ge);
delay();
}
}
}
void init()
{
numwe=0;
numdu=8;
TMOD=0x10;
TH1=(65536-time)/256;
TL1=(65536-time)%256;
EA=1;
ET1=1;
TR1=1;
}
void timer1() interrupt 3
{
TR1=0;
TH1=(65536-time)/256;
TL1=(65536-time)%256;
TR1=1;
num++;
}
void display()
{
numdu--;
if(numdu==1)
numdu=7;
dula=1;

P0=tabledu[numdu];

dula=0;

wela=1;
P0=tablewe[numwe];

wela=0;

numwe++;

if(numwe==6)

numwe=0;

}

void display0(uint bai,uint shi,uint ge)

{
dula=1;
P0=tabledu[bai];
dula=0;
wela=1;
P0=0xf7;
wela=0;
dula=1;
P0=tabledu[shi];
dula=0;
wela=1;
P0=0xef;
wela=0;
dula=1;

P0=tabledu[ge];

dula=0;

wela=1;

P0=0xdf;

wela=0;

}

void delay(void) //Error -0.000000000023us Delay 100ms

{

uchar a,b;

for(b=221;b>0;b--)

for(a=207;a>0;a--);

}

This post is from 51mcu

Latest reply

  Details Published on 2021-5-31 15:02
 

1942

Posts

2

Resources
2
 

I can't see the content of your error report, so I can't help you find the problem.

This post is from 51mcu
 
 
 

1790

Posts

0

Resources
3
 

Just take a look at the readability of this post.

When placing code, you can use pictures or "code snippets" in advanced mode.

This post is from 51mcu
 
 
 

4005

Posts

0

Resources
4
 

Didn't see

This post is from 51mcu
 
 
 

650

Posts

8

Resources
5
 
This post was last edited by 29447945 on 2021-5-31 11:33

Look at the first floor below

This post is from 51mcu
 
 
 

650

Posts

8

Resources
6
 

There is no need to use uint in this call. Just give the parameters directly. Remove the three uints.

This post is from 51mcu
 
 
 

7422

Posts

2

Resources
7
 
29447945 Published on 2021-5-31 11:32 There is no need to use uint in the call here, just give the parameters directly, remove the three uint

This post is from 51mcu
 
Personal signature

默认摸鱼,再摸鱼。2022、9、28

 
 

Just looking around
Find a datasheet?

EEWorld Datasheet Technical Support

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京B2-20211791 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号
快速回复 返回顶部 Return list