Hi all, I've tried hooking up a 3 digit common cathode 7 segment display for a countdown timer project. Having a little troublem getting this working correctly, should I be using some form of driver IC to get this working correctly? Currently using a 16F872 with a 4mhz oscillator.
I can select each of the displays and write a value to each of them separately, so presumably there is some form of driver IC required to be connected for this to work. The display I am using is this (BC56-12EWA): http://www.rapidonline.com/pdf/57-0244.pdf
Any advice would be appreciated.
Thanks
Tom
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You don't have to use a driver. But you need to scan each display often. Here is an example i tried in 2008 but was not pleased because i was using 6 7-segments and the brightness was not there. Later I did use a driver that took care of all the scanning .
#chip 16F886, 8
#config OSC = INTRC_IO
' Variables
#define DisplayCount 6
#define DisplayPortA PORTB
#define DisplayPortB PORTB
#define DisplayPortC PORTB
#define DisplayPortD PORTB
#define DisplayPortE PORTB
#define DisplayPortF PORTB
#define DispSelectA Set PORTA.0 off: Set PORTA.1 on: Set PORTA.2 on: Set PORTA.3 on: Set PORTA.4 on: Set PORTA.5 on
#define DispSelectB Set PORTA.0 on: Set PORTA.1 off: Set PORTA.2 on: Set PORTA.3 on: Set PORTA.4 on: Set PORTA.5 on
#define DispSelectC Set PORTA.0 on: Set PORTA.1 on: Set PORTA.2 off: Set PORTA.3 on: Set PORTA.4 on: Set PORTA.5 on
#define DispSelectD Set PORTA.0 on: Set PORTA.1 on: Set PORTA.2 on: Set PORTA.3 off: Set PORTA.4 on: Set PORTA.5 on
#define DispSelectE Set PORTA.0 on: Set PORTA.1 on: Set PORTA.2 on: Set PORTA.3 on: Set PORTA.4 off: Set PORTA.5 on
#define DispSelectF Set PORTA.0 on: Set PORTA.1 on: Set PORTA.2 on: Set PORTA.3 on: Set PORTA.4 on: Set PORTA.5 off
'The last block of constants connects the first 4 pins on PORTA to either ground (off) or Vdd (on). Each constant is a macro which is called when the matching display is about to be written to. It needs to connect all of the cathodes to Vdd, except for the one that is to be used which must be connected to ground.
'Make sure that you call the DisplayValue and/or DisplayChar routines very frequently! GCBASIC doesn't do this automatically.
#define inchrs PORTC.3
#define incmin PORTC.4
#define incsec PORTC.2
RTCinit
'Pin Direction
DIR PORTA OUT
DIR PORTB OUT
dir inchrs in
dir incmin in
dir incsec in
hours =0
mins =0
secs = 5
dim Message(10)
Message() = "Hello "
Mainloop:
sayhello
secs =0
mins =0
hours =0
timeloop:
secs = secs +1 ' Increment seconds
if secs < 60 then goto fins ' yes, done
secs = 0 'Clear seconds
mloop:
mins = mins+1 ' Increment minutes
if mins < 60 then goto fins ' yes, done
mins = 0 ' clear minutes
hloop:
hours = hours +1 ' Increment hours
if hours < 24 then goto fins ' yes, done
hours =0 ' Clear hours
fins:
'hour disp
tens=hours/10
DisplayValue 6,tens
ones=hours-tens*10
Wait 8 ms
DisplayValue 5,ones
Wait 8 ms
'min disp
tens=mins/10
DisplayValue 4,tens
ones=mins-tens*10
Wait 8 ms
DisplayValue 3,ones
Wait 8 ms
'sec disp
tens=secs/10
DisplayValue 2,tens
Wait 8 ms
ones=secs-tens*10
DisplayValue 1,ones
'AdjustTime
Wait 8 ms
if (inchrs =0) AND (incsec = 1) then goto hloop
if (incmin =0) AND (incsec = 1) then goto mloop
goto fins
This was stretching scanning to the limit. 3 7-sement did not look too bad.
GL
mike
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Cheers Mike, you are spot on mate. I've altered it to use Timer1 and an interrupt to increment the time value and just had a 10ms delay between writing values to the displays and it works well :)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi all, I've tried hooking up a 3 digit common cathode 7 segment display for a countdown timer project. Having a little troublem getting this working correctly, should I be using some form of driver IC to get this working correctly? Currently using a 16F872 with a 4mhz oscillator.
I can select each of the displays and write a value to each of them separately, so presumably there is some form of driver IC required to be connected for this to work. The display I am using is this (BC56-12EWA): http://www.rapidonline.com/pdf/57-0244.pdf
Any advice would be appreciated.
Thanks
Tom
tom,
You don't have to use a driver. But you need to scan each display often. Here is an example i tried in 2008 but was not pleased because i was using 6 7-segments and the brightness was not there. Later I did use a driver that took care of all the scanning .
This was stretching scanning to the limit. 3 7-sement did not look too bad.
GL
mike
Cheers Mike, you are spot on mate. I've altered it to use Timer1 and an interrupt to increment the time value and just had a 10ms delay between writing values to the displays and it works well :)