7 segment display: how I've done it.

Svejk

Senior Member
The basics are this:

- pins 0 to 3 of a 14M chip are used to drive a CMOS 4511 BCD to 7 segment decoder
- pin 4 will pulse the CMOS 4017 counter
- the 4017 counter will switch the 7 segment catode via an ULN2003

The code is:

Code:
'Picaxe 14M

symbol no      = b13		'this number will be displayed
symbol digit   = b12
symbol countpin = 4


main:

  no = 128


  digit = no/100

  on digit gosub no0, no1, no2, no3, no4, no5, no6, no7, no8, no9

  gosub displayoff


  digit = no // 100 / 10

  on digit gosub no0, no1, no2, no3, no4, no5, no6, no7, no8, no9

  gosub displayoff


  digit= no // 100 // 10

  on digit gosub no0, no1, no2, no3, no4, no5, no6, no7, no8, no9
  gosub displayoff
pulsout countpin, 1
    
goto main   

No0:
  pins = %00000000
  return
  
No1:
  Pins = %00000001
  return
  
No2:
  pins = %00000010
  return
  
No3:
  Pins = %00000011
  return
  
No4:
  pins = %00000100
  return
  
No5:
  Pins = %00000101
  return
  
No6:
  Pins = %00000110
  return
  
No7:
  pins = %00000111
  return
  
No8:
  Pins = %00001000
  return
  
No9:
  pins = %00001001
  return
  

DisplayOff:
  pins = %00011111
  return


Notes:
- I've done it on breadboard as I needed quick a display away from computer and unfortunately I have no photos.
- It can be extended to 8 digits
- the code is not optimised at all.
- the schematics does _not_ show the current limiting resistors for 7 segment display
 

Attachments

Last edited:

westaust55

Moderator
Svejk,

congratulations on getting your project working :)

There is a simpler way to output the signals to the CMOS 4511 BCD to 7 segment decoder


where you have the lines:
on digit gosub no0, no1, no2, no3, no4, no5, no6, no7, no8, no9​
try:
pins = digit​
then you do not need the subroutines 0 to 9 either.
 

westaust55

Moderator
Always a pleasure to help those who are willing to give their project some effort themselves :) ,
rather than a please give me a circuit and program to do xxxx . . . . :rolleyes:
 

MartinM57

Moderator
Nice circuit - thanks for sharing.

How would I go about changing the display brightness - say for different night/day brightnesses? Hardware, software or both....?
 

fernando_g

Senior Member
Nice circuit - thanks for sharing.

How would I go about changing the display brightness - say for different night/day brightnesses? Hardware, software or both....?
You can use the 4511's Blanking Input (pin 4) with the Picaxe's PWM output to do precisely that.
 
Top