BasicMicroUK - Forums

www.basicmicro.co.uk
It is currently Tue Apr 24, 2018 1:09 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 2 posts ] 

How Useful Was This Article to You? (Rankings Poll)
Poll ended at Fri Nov 06, 2009 9:19 pm
Very Useful (2 Rankings Points) 0%  0%  [ 0 ]
Somewhat Useful (1 Rankings Point) 0%  0%  [ 0 ]
Not Very (No Rankings Point) 0%  0%  [ 0 ]
Total votes : 0
Author Message
 Post subject: Seven segment mulpitlex display
PostPosted: Sat Aug 08, 2009 5:23 pm 
Offline
Citizen

Joined: Mon Apr 02, 2001 6:00 pm
Posts: 17
Four digit display could be used for a clock.
Four BCD digits are translated to seven segement output.
Seven segments are wired with bit0-7 attached to segment A-G and decimal point to Bit7

Conclusion: It can be done 2 millisecond seem about the best time for display not to flicker.
But output of display driven direct from pic is dim due to week sink/source current of output ports.



*************
CPU = 16F876
MHZ = 20
CONFIG 16382


;Basically there are 3 parts to this program


;1) the BCD portion
;2) the translation lookup table
;3) the multiplex display



;display digits
donothing var byte
counter var word
temp1 var byte
temp2 var byte
digits var nib(4)

;Seven segment display bytes

segment var byte(4)
TrisA=$00
TrisB=$00 ;outputs lower nib
trisC=$00 ;outputs
CLEAR

main:
if donothing=0 then
counter=counter+1
endif

donothing=donothing+1; Waste some time to see if display can keep up

gosub multiplex

goto main

multiplex: ;Common anode output of 4 digits lookup table would be opposite for common cathode.
for temp1=0 to 3
digits(temp1)=counter.nib(temp1) ;lookup seven segment output, load into output byte
lookup digits(temp1), [%11000000,%11111001,%10100100,%10110000,%10011001,%10010010,%10000010,%11111000,%10000000,%10011000,%10001000,%10000011,%10100111,%10100001,%10000100,%10001110],segment(temp1)
next

portC=segment(0);set output of LSB
portA.bit0=1;stobe output
pause 2
portA.bit0=0;

portC=segment(1);set next seen segment output ;and strobe
portA.bit1=1
pause 2
portA.bit1=0

portC=segment(2)
portA.bit2=1
pause 2
portA.bit2=0

portC=segment(3)
portA.bit3=1
pause 2
portA.bit3=0

Return


Top
 Profile  
 
 Post subject: Re: Seven segment mulpitlex display
PostPosted: Sat Aug 08, 2009 9:26 pm 
Offline
Master

Joined: Mon Aug 18, 2008 1:26 am
Posts: 799
Location: CA bay Area
Thanks for the project, FC. Do you have any suggestions as to how to create a timer to measure out the seconds, minutes, and hours to actually use this as a clock? Say, like, an timer overflow interrupt?
Take care.

_________________
kenjj
http://blog.basicmicro.com/
http://kjennejohn.wordpress.com/


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 0 guests


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 post attachments in this forum

Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

phpBB SEO