2259 views|4 replies

1

Posts

0

Resources
The OP
 

51 single chip digital tube display [Copy link]

Why does the tens digit flash after this program is written into the microcontroller, but yours does not? Please give me some advice, thank you #include #define uchar unsigned char #define uint unsigned int void delay(uint i); void disp(uchar j); unsigned char led[]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f ,0x77,0x7c,0x39,0x5e,0x79,0x71}; uchar miao=0; void delay1s() { uchar i; for(i=0;i<20;i++) { while(!TF1); TF1=0; TH1=(65536-50000)/256; TL1=(65536-50000)%256; } } void main() { TMOD=0x10; TH1=(65536-50000)/256; TL1=(65536-50000)%256; TR1=1; while(1) { disp(miao); delay1s(); miao++; if(miao==60) miao=0 ; } } void disp(uchar j) { P2=0xfe; P1=led[j/10]; delay(100); P2=0xfd; P1=led[j%10]; delay(100); } void delay( uint i) { uint k; for(k=0;k
You should check this function, void disp(uchar j), carefully to see if there are any problems in the logic and circuit connection. Check yourself with the microcontroller pins to see if the operated pins are consistent with the actual segments.
Your led[j/10] and led[j%10] are less than 10, and P1 has not changed, so why are they flashing?

Did you intercept part of the code? What is the value of j in your code? As mentioned in the second post, if led[j/10], led[j%10], is less than 10, P1 will not achieve the expected effect! Please check whether it is the value of j that is the problem!

The ones digit flickers, but because of the problem with the interval time, the time for P2.0 to turn on is delay(100);, and the time for it to turn off is delay(100);+delay1s();, so it is not clear!

51 single chip digital tube display
This post is from 51mcu

Latest reply

The ones digit flickers, but because of the problem with the interval time, the time for P2.0 to turn on is delay(100);, and the time for it to turn off is delay(100);+delay1s();, so it is not clear!   Details Published on 2019-8-4 20:49
 

3471

Posts

11

Resources
2
 
You should check this function, void disp(uchar j), carefully to see if there are any problems in the logic and circuit connection. Check yourself with the microcontroller pins to see if the operated pins are consistent with the actual segments.
This post is from 51mcu
 
 
 

10

Posts

0

Resources
3
 
Your led[j/10] and led[j%10] are less than 10, and P1 has not changed, so why are they flashing?
This post is from 51mcu
 
 
 

291

Posts

0

Resources
4
 

Did you intercept part of the code? What is the value of j in your code? As mentioned in the second post, if led[j/10], led[j%10], is less than 10, P1 will not achieve the expected effect! Please check whether it is the value of j that is the problem!

This post is from 51mcu
 
 
 

5

Posts

0

Resources
5
 

The ones digit flickers, but because of the problem with the interval time, the time for P2.0 to turn on is delay(100);, and the time for it to turn off is delay(100);+delay1s();, so it is not clear!

This post is from 51mcu
 
 
 

Guess Your Favourite
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