Seven Segment Display via 74HC595 Shift Register - certain numbers not showing?

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)

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
;*************************************************************
 

nick12ab

Senior Member
Have you ensured that pin 13 of the shift register is connected to ground? The problem numbers appear to be the only numbers that don't use segment F.
 

Celestialsphere

New Member
Thank you for the advice Nick. The circuit is wired up correctly and I have even breadboarded a whole new one to be sure but to not avail.

I tried isolating the F segment to see if that did anything but no.

It's got me stumped. :(
 
Last edited:

nick12ab

Senior Member
The code looks OK and I'm sure it has something to do with segment F - which you appear to have used as the first bit so therefore what you thought was segment F might not have been what I say it is.

The bitmap below shows your segment data and the red row is the one in question and notice that that bit of any byte is low only for the affected numbers.

bitmap.PNG

You can check whether this is causing the problem by commenting out your current TABLE command and creating another which is the same but the affected bit is high in every byte and see if the problem goes away or not. If the problem goes away, then it must be a problem with that bit. It could be connected to the _MR pin.
 

hippy

Ex-Staff (retired)
The circuit is wired up correctly and I have even breadboarded a whole new one to be sure but to not avail.
Remove the 7-seg displays, and test each segment to ensure there are no faults with the displays themselves.

With the 7-seg removed, write some test programs that set just one output of the shift registers at a time, check that output and only that output is on, etc.

Also post your full circuit diagram so that can be checked.
 

westaust55

Moderator
This single digit display project is based upon my code and schematic here:
http://www.picaxeforum.co.uk/showthread.php?13687-3-digit-display-using-74HC595

After the tests as suggested by hippy a photo, or one of each side if on a proto board, of the project taken straight on and clear so wiring/traces can be followed may help identify a problem.

For those helping, note that in my project the LED segments are not wired In Sequence for ease of wiring on a proto board.
 

Celestialsphere

New Member
Thankyou very much to all of you for all the suggestions that have been posted. I have to study tonight but I hope I will solve this on the weekend.

In low light the missing numbers briefly show but very very dimmly.

My plan of attack - keeping in mind the fact that all the other numbers work :
- Test the each element of the display individually off the board with a battery and resistor then test various elements in combination just to be sure (especially around the F segment).
- Check the connections (and sequence) between the shift register and the display.
- Write a program to cycle through the segments individually.
- Then I will try using a different PICAXE to eliminate a source chip problem ( I have already tried a different shift register so I'm thinking that's not the problem).

Thanks again. I will keep you posted.

Andrew
 
Last edited:

Celestialsphere

New Member
Problem solved ! Problem solved !

First I checked the display was working properly with a power supply and resistor - all good. Whilst doing that I noted the pin to segment connections and wrote on the side of display for future reference.

Next I rewired my breadboard just to be sure. Then I decided to check the power wires I have been using - late last night as I was finishing up I noted that one was possibly broken at the alligator clip to wire connection. Because the display was partially working I didn't put two and two together but that turned out to be the underlying source of the problem.

To explain - the bad wire was supposed to be supplying the V+ to the shift register and the seven segment display but obviously wasn't doing this. The ground wire is OK. So the V+ to the shift register was being supplied via the three serial data/serial clock/latch lines from the PICAXE directly !
By connecting a good cable from the power supply V+ to the shift register / seven segment display combination, the display lights up much brighter and the numbers cycle through perfectly. :p
Maybe something in the internals of the shift register to do with the F segment needs a bit more kick to work for some reason?

So lesson learnt - Check the power supply is coming from the right place !

Now I can push on with my project which is a device to be mounted on a remote controlled (RC) boat to measure the depth of the boat club lake...

Thank you so much to everyone for all your assistance. I hope someone else can profit by my experience.

Cheers from cold, windy Melbourne, Australia !

Andrew (Celestialsphere)
 

Buzby

Senior Member
Excellent diagnostic work and reporting !.

It's always appreciated when the solution to a problem is reported in the forum.

Thanks.
 

Paix

Senior Member
I once had a TTL problem that gave me a display on a very simple scope like some of the adverts for up market scopes eons ago. Sort of a 3D data display.

The problem turned out to be a missing 0V connection to the particular package and the changing gate inputs appeared to be getting summed passively. Nice display, but the circuit didn't work until the 0V connection was made.

A bit like watching someone's tail light cluster working like a one armed bandit because of a bad earth connection.

I did once see a turn indicator operating OK, but in a slightly strange manner. It wasn't until I got close that I could see that the cluster was half full of water and the bulb was under water. Obviously had a super grommet around the neck of the bulb. A gold fish or two would have set it off nicely.

Glad you got your project working OK Celestialsphere and many thanks for the super feedback.
 
Top