CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

multiplexing 7 segment display

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
evaradharaj



Joined: 15 Jan 2009
Posts: 60

View user's profile Send private message Visit poster's website

multiplexing 7 segment display
PostPosted: Tue Oct 19, 2010 10:29 pm     Reply with quote

Hi,

I am using PIC 16f877a for displaying the counter which is of 0 to 9999. I am using 4 seven segment leds.

There I am having flickering problem. I have changed the delay to many numbers in milliseconds, but I can't eliminate the flickering problem.

Here I have given the code, please correct my mistake.

I am using common cathode 7 segment led and I am giving ground to the 7 segment led by means of switching the transistor(BC548).

I am using Port C0, C1, C2, C3 pins for switching transistors and port B for displaying the digits.

Code:

b = 0xFC;

output_B(digit[b]);
output_c(0x01);
delay_ms(5);
output_c(0x00);

output_B(digit[b]);
output_c(0x02);
delay_ms(5);
output_c(0x00);

output_B(digit[b]);
output_c(0x04);
delay_ms(5);
output_c(0x00);

output_B(digit[b]);
output_c(0x08);
delay_ms(5);
output_c(0x00);

I am displaying '0' in all 4 digits. But i am having flickering effect. The 0 is coming properly in all digits.

Thanks in advance,

Regards,
Varadharaj E
_________________
embedding innovation in engineers
Douglas Kennedy



Joined: 07 Sep 2003
Posts: 755
Location: Florida

View user's profile Send private message AIM Address

PostPosted: Wed Oct 20, 2010 6:16 am     Reply with quote

Well the eye can begin to see flickering at around 1/80th of a second or about 12.5 ms. You have 4 digits each with a 5ms on time so every digit gets action every 20 ms so flickering is not unexpected. Leds switch very fast so try delay values in the high us range.
John P



Joined: 17 Sep 2003
Posts: 331

View user's profile Send private message

PostPosted: Wed Oct 20, 2010 6:35 am     Reply with quote

I'm not sure that the problem is the 5msec delays, though that's an awful technique. How often is this routine executed? If there's a delay in the rest of the progam, it could cause the interval between operations of the LED digits to be long enough to be visible.

I would set up a repetitive timer interrupt to run at (let's say) 400 Hz. Then every time the interrupt executes, send out the data for one digit and increment a counter that cycles through the 4 digits. That way, you will know that each digit will be illuminated for 2.5msec, 100 times a second. You aren't wasting time with the delay routine, so your processor will have more time to do other things.
evaradharaj



Joined: 15 Jan 2009
Posts: 60

View user's profile Send private message Visit poster's website

PostPosted: Thu Oct 21, 2010 10:11 pm     Reply with quote

Thanks John and Kennedy for your valuable comments. For incrementing the counter I am planning to use the timer 0 interrupt.

Please tell me, can I use the in built function delay_ms() for delay between the digits shifting and timer interrupt for incrementing the count?

Thanks and Regards,
Varadharaj E
_________________
embedding innovation in engineers
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group