Celestialsphere
New Member
Hello,
I have a problem with a Seven segment display not showing the numbers 1,2,3 and 7 in a simple looping count.
First some specs:
PICAXE 28A
74HC595 Shift register driving a common cathode display. I have tried two different shift register chips so it's not the chip that's the problem.
All other numbers are showing correctly while looping from 0 to 9 except the numbers 1,2,3 and 7 where the displays a tiny flicker for these numbers but they don't show. There is a pause of 0.65 seconds between each change of numbers.
I am using the code as provided by westaus55 but modified in the 'Main:' routine to show a basic count up and the symbols for the output pin are different to suit my board.
Any ideas what's going on here?
Cheers
Andrew (Celestialsphere)
I have a problem with a Seven segment display not showing the numbers 1,2,3 and 7 in a simple looping count.
First some specs:
PICAXE 28A
74HC595 Shift register driving a common cathode display. I have tried two different shift register chips so it's not the chip that's the problem.
All other numbers are showing correctly while looping from 0 to 9 except the numbers 1,2,3 and 7 where the displays a tiny flicker for these numbers but they don't show. There is a pause of 0.65 seconds between each change of numbers.
I am using the code as provided by westaus55 but modified in the 'Main:' routine to show a basic count up and the symbols for the output pin are different to suit my board.
Any ideas what's going on here?
Cheers
Andrew (Celestialsphere)
Code:
; Define Hardware pins for IO
SYMBOL sdata = output5 ; serial data on pin 5
SYMBOL sclk = output3 ; serial clock on pin 3
SYMBOL latch = output4 ; latch data to 595 outputs on pin 4
; define aliases names for variables used
SYMBOL bitcntr = b3 ; control for serial shifting of data out
SYMBOL digit = b4 ; extracted digit from 3 digit value 0 - 999
SYMBOL digout = b5 ; encoded value 7-seg display to the output with serial shifting
SYMBOL mask = b6 ;
SYMBOL decpnt = b7
;*************************************************************
; PROGRAM STARTS HERE
;*************************************************************
Init:
Low sclk ; make sure the clock and data lines are low in advance
Low sdata
Main:
FOR w0 = 0 TO 9 ; display 0 to 9
digit = w0
GOSUB Shiftout
pulsout latch,5
pause 650
NEXT w0
GOTO Main ; loop through the values 0.00 to 999 forever
;*************************************************************
; SUBROUTINES
;*************************************************************
;----------------------------------------------------------------------------------------
Shiftout:
; Find the display code for 7-seg display corresponding to the digit value 0 -9
LOOKUP digit, ($7D,$60,$5E,$7A,$63,$3B,$3F,$70,$7F,$7B), digout
;
;----------------------------------------------------------------------------------------
; Then shift data out serially - most significant bit first
FOR bitcntr = 1 TO 8 ; one loop per bit
mask = digout & $80 ; Mask out the MSB
LOW sdata
IF mask = 0 THEN skipMSB
HIGH sdata
skipMSB: pulsout sclk,1 ; pulse clock line for 10us
digout = digout * 2 ; shift value left ready for next bit
NEXT bitcntr
RETURN
;*************************************************************
; END OF SUBROUTINES
;*************************************************************