14-segment LED Display Project - Electronics Forums

Author Topic: 14-segment LED Display Project  (Read 14278 times)

ElectroNick

  • The forum moderator
  • Administrator
  • Full Member
  • *****
  • Posts: 154
  • Karma: +3/-0
  • The soldering iron is ON!
    • View Profile
    • Electronics Blog
14-segment LED Display Project
« on: September 23, 2011, 01:07:23 PM »
14-segment LED displays occupy an awkward  place among the displays: they are driven very much like 7-segment ones, i.e. need less I/O than your full-blown 5x7 or 8x8 LED matrix but they are still able to show alpha characters. Not as nice alpha characters as LED matrices of course but still recognizable and much better than 7-segment ones. In fact, there are characters that are impossible to show with any degree of clarity on a 7-segment that 14-segment does just fine.

I wanted to post one of my older projects from when I was just starting playing with these. I did not quite get to the alpha characters (only digits are programmed in the code) but the hardware is there and if anyone needs alphas, you can relatively easily update the code (an PIC assembler, below)

   
Code: [Select]
;***************************************************************
title "PIC Sample code: PIC16F628"
;Designed for 16F88 @4Mhz
;***************************************************************
LIST p=16F628 ;tell assembler what chip we are using
#include <p16F628.inc>
__CONFIG _CP_OFF & _PWRTE_OFF & _DATA_CP_OFF & _LVP_OFF & _BODEN_OFF & _MCLRE_OFF & _PWRTE_ON & _WDT_OFF & _INTRC_OSC_NOCLKOUT
ERRORLEVEL -302
;***************************************************************
#define Data PORTA,6
#define Clock PORTA,7
#define Digit1 PORTA,1
#define Digit2 PORTA,0
#define Button PORTB,2

cblock 0x20
low_nibble
high_nibble
count1
count2
count3
count4
dc1
dc2
dc3
endc
org 0x0000

movlw 0x0A
movwf count2

movlw 0x0A
movwf count3

movlw 0x2F
movwf count4

movlw 0x07
movwf CMCON ;turn comparators off (make it like a 16F84)
    bsf STATUS, RP0 ;select bank 1
    movlw b'00000000' ;set PortA all outputs
movwf TRISA ;set PortA all outputs
    movlw b'00000100' ;set PortB2 input   
    movwf TRISB
bcf STATUS, RP0 ;select bank 0

Start




Display

movlw .01
btfsc  Button   ; check for button press (Button low)
Call delay10 ;
    btfsc  Button   ; check for button press (Button low)
Call reset_counts ; reset count2, count3


BSF Digit2 ; Bit set (on common anode) turns the digit OFF
BCF Digit1
movf count2,W
call seg_low_lookup
movwf low_nibble
movf count2,W
call seg_high_lookup
movwf high_nibble
CALL Showchar

MOVLW d'1' ;delay 0.1 sec
CALL delay10
;CALL Clr_Display

;GOTO Start

BSF Digit1
BSF Digit2

BSF Digit1
BCF Digit2

movf count3,W
call seg_low_lookup
movwf low_nibble
movf count3,W
call seg_high_lookup
movwf high_nibble
CALL Showchar



MOVLW d'1' ;delay 0.25 sec
CALL delay10
;CALL Clr_Display

decfsz count4,f
GOTO Display
MOVLW 0x2F
MOVWF count4


decfsz count3,f
GOTO Display
MOVLW 0x0A
MOVWF count3

decfsz count2,f
GOTO Start
MOVLW 0x0A
MOVWF count2

GOTO Start
;***************************************************************
;***************************************************************

reset_counts
movlw 0x0A
movwf count2

movlw 0x0A
movwf count3

retlw 0


delay10              ; delay W x 10ms
        movwf  dc3   ; delay = 1+Wx(3+10009+3)-1+4 -> Wx10.015ms
dly2    movlw  .13   ; repeat inner loop 13 times
        movwf  dc2   ; -> 13x(767+3)-1 = 10009 cycles
        clrf   dc1   ; inner loop = 256x3-1 = 767 cycles
dly1    decfsz dc1,f
        goto   dly1
        decfsz dc2,f ; end middle loop
        goto   dly1
        decfsz dc3,f ; end outer loop
        goto   dly2
        retlw  0



Showchar


movlw .8
movwf count1
bcf Clock

Loop bsf STATUS, C
rrf high_nibble,f ; Rotate lownibble in place to the right
btfsc STATUS, C ;is carry = "0"?
bsf Data ; if not, set Data line to "1"
btfss STATUS, C ;is carry = "1"?
bcf Data ; if not, set Data line to "0"

bsf Clock ;generate one clock
nop

bcf Clock

;movlw .01 ; Delay 1/10 s before moving further
;Call delay10 ;

decfsz count1,f ; have we rotated 8 times already?
goto Loop ; repeat if not

movlw .8
movwf count1
bcf Clock

Loop2 bsf STATUS, C
rrf low_nibble,f ; Rotate lownibble in place to the right
btfsc STATUS, C ;is carry = "0"?
bsf Data ; if not, set Data line to "1"
btfss STATUS, C ;is carry = "1"?
bcf Data ; if not, set Data line to "0"

bsf Clock ;generate one clock
nop

bcf Clock

;movlw .01 ; Delay 1/10 s before moving further
;Call delay10 ;

decfsz count1,f ; have we rotated 8 times already?
goto Loop2 ; repeat if not

retlw 0

Clr_Display
bsf Data
movlw .16
movwf count1
Loop1
bsf Clock ;generate one clock
nop
nop
nop
bcf Clock
decfsz count1,f ; have we rotated 16 times already?
goto Loop1 ; repeat if not

retlw 0


seg_low_lookup
; in:  number in W
; out: low nibble of the 14-seg code in W in format B'abcdefgh'
;andlw   B'00001111'
addwf   PCL,f
; format B'abcdefgh'
nop
retlw B'00000011' ;0 - a,b,c,d,e,f
retlw B'10011110' ;1 - b,c,h
retlw B'00101111' ;2 - a,b,d,j,m
retlw B'01001110' ;3 - a,d,h,j,k
retlw B'10011011' ;4 - b,c,f,j,n
retlw B'01001111' ;5 - a,c,d,j,p
retlw B'01000011' ;6 - c,d,e,f,j,n
retlw B'01111110' ;7 - a,h,l
retlw B'01000110' ;8 - a,c,d,e,h,j,n,p
retlw B'00001011' ;9 - a,b,c,d,f,j,n

;-------------------------------------------

seg_high_lookup
; in:  number in W
; out: high nibble of the 14-seg code in W in format B'abcdefgh'
;andlw   B'00001111'
addwf   PCL,f
; format B'jklmnpxx'
nop
retlw B'11111111' ;0 - a,b,c,d,e,f
retlw B'11111111' ;1 - b,c,h
retlw B'01101111' ;2 - a,b,d,j,m
retlw B'01111111' ;3 - a,c,d,h,j
retlw B'01110111' ;4 - b,c,f,j,n
retlw B'01111011' ;5 - a,f,n,m
retlw B'01110111' ;6 - c,d,e,h,j,n
retlw B'11011111' ;7 - a,h,l
retlw B'01110011' ;8 - a,c,d,e,h,j,n,p
retlw B'01110111' ;9 - a,b,f,j,n

;-------------------------------------------

END


A little word of caution: this is a project I haven't touched in a few years, so, although I believe the code be working, I can't actually guarantee it is. Same goes for the schematic. It should be fine in general but please verify it if you're building your own. There may be a gaffe or two related to drawing mistakes. The scheme works as you can see on the photos but I may or may not made a few mistakes drawing it in Eagle  :-[ .
« Last Edit: September 29, 2011, 12:19:29 AM by ElectroNick »

Electronics Forums

14-segment LED Display Project
« on: September 23, 2011, 01:07:23 PM »

smeezekitty

  • Trusted Member
  • *
  • Posts: 14
  • Karma: +0/-0
  • I have a soldering iron and I'm not afraid to use it!
    • View Profile
Re: 14-segment LED Display Project
« Reply #1 on: December 05, 2012, 05:09:29 PM »
Now try driving it with an attiny13 ;)

ElectroNick

  • The forum moderator
  • Administrator
  • Full Member
  • *****
  • Posts: 154
  • Karma: +3/-0
  • The soldering iron is ON!
    • View Profile
    • Electronics Blog
Re: 14-segment LED Display Project
« Reply #2 on: December 05, 2012, 05:45:57 PM »
Now try driving it with an attiny13 ;)
Sure! All it will need is an extra 74HC164 or perhaps a single Maxim LED driver chip will replace the entire circuit except for the MCU. I still love the 14-segment LEDs - retro feeling is second only to the NIXI tubes. Perhaps I'll actually redo this project one day ...

smeezekitty

  • Trusted Member
  • *
  • Posts: 14
  • Karma: +0/-0
  • I have a soldering iron and I'm not afraid to use it!
    • View Profile
Re: 14-segment LED Display Project
« Reply #3 on: December 06, 2012, 11:58:16 PM »
Now try driving it with an attiny13 ;)
Sure! All it will need is an extra 74HC164 or perhaps a single Maxim LED driver chip will replace the entire circuit except for the MCU. I still love the 14-segment LEDs - retro feeling is second only to the NIXI tubes. Perhaps I'll actually redo this project one day ...
Another cool retro item is vacuum florescent displays.

ElectroNick

  • The forum moderator
  • Administrator
  • Full Member
  • *****
  • Posts: 154
  • Karma: +3/-0
  • The soldering iron is ON!
    • View Profile
    • Electronics Blog
Re: 14-segment LED Display Project
« Reply #4 on: December 07, 2012, 12:15:09 AM »
Another cool retro item is vacuum florescent displays.
True. Except for providing them with all the different voltages they need to operate (if they don't have a board attached that takes care of that).
I once got a grab bag of displays from All Electronics or a similar outfit - can't recall now - and most of the displays there were those "bare" VFDs. And "bare" LCDs, too, to make it more interesting :) I'm still waiting for having enough time to figure out how to feed those with proper power. Most of those VFDs are 7-segments and would make awesome clocks if I can bring myself to dealing with all that's needed to light them up...

smeezekitty

  • Trusted Member
  • *
  • Posts: 14
  • Karma: +0/-0
  • I have a soldering iron and I'm not afraid to use it!
    • View Profile
Re: 14-segment LED Display Project
« Reply #5 on: December 08, 2012, 02:05:19 PM »
Another cool retro item is vacuum florescent displays.
True. Except for providing them with all the different voltages they need to operate (if they don't have a board attached that takes care of that).
I once got a grab bag of displays from All Electronics or a similar outfit - can't recall now - and most of the displays there were those "bare" VFDs. And "bare" LCDs, too, to make it more interesting :) I'm still waiting for having enough time to figure out how to feed those with proper power. Most of those VFDs are 7-segments and would make awesome clocks if I can bring myself to dealing with all that's needed to light them up...
VFDs usually only need two supplies.
The filament is generally between 2 and 4.5 voltages.
The supply for the anode and grid supply is between 7 and 50 volts depending on the type of display (this is easily produced with a 1 transistor boost converter - I have even powered a while display with two AA batteries this way).
You can search for more information on driving VFDs online.
The hardest part is actually how many lines they require to control.

 

Related Topics

  Subject / Started by Replies Last post
2 Replies
13553 Views
Last post December 14, 2012, 04:14:52 PM
by ElectroNick
14 Replies
16395 Views
Last post February 25, 2013, 12:24:16 PM
by ElectroNick
68 Replies
37646 Views
Last post January 03, 2014, 09:51:22 PM
by ElectroNick