A little 7 segment led project

MikeGyver

Senior Member
On page 22 of manual 3 it shows 2 4026B's connected together. Can 3 displays be controlled by using 3 4026B's daisy chained together?

My project shouldn't be too hard. I'm using three 7 segment led's to display milivolts seen at an analog input pin (readadc10).
So for example when 8 milivolts, display _ _ 8... when 1 volt display 100... when 2.43V display 243 etc.

It only needs to read 0-255 milivolts and hopefully refresh close to real time.
I'm kind of a noob and I figured I'd post up and get some ideas while I'm waiting for parts.
 

Rickharris

Senior Member
Yes the overflow pin sends a signal to the next 4026 to say i have reached 10.

You can do this as many time as you like.

The ONLY issues is that the display is refreshed by setting all to zero and then pulsing the output as many times as necessary to get to the number you want so update can be a bit slow and visible with more then 2 displays.

Play around with it.
 

westaust55

Moderator
If you are willing to be a little more adventurous, you could look at using some 74HC595 latched 8 bit shift registers. These can also be cascaded like the 4026 decade counters.

While they will not count up for you in the same manner and you will need to set up the byte value for each digit (which is very easy to achieve) you can communicate with a simple serial output command structure using just 3 wires/signals from the PICAXE and pre-load the three (or more) values internally into the shift registers. Then transfer and latch the data over to the 74HC595 outputs. That way you will not see the counting/shifting of data and the digits all change to the new values simultaneously.


If you do a search on this forum for 74HC595 you will find a number of past threads and even diagrams on cascading these chips.
 
Last edited:

Michael 2727

Senior Member
3 Digits work fine using 4026s,
Use a FOR / NEXT loop to spit out the count pulses.
(use NO pauses between the high-pin?, low-pin? for fastest counts)
Somewhere around p: 43 in picaxemanual2.pdf.
A 1000 count takes less than 1 sec.
Temperature counts (room Temp Deg ºC) fast as a blink.
 

Texy

Senior Member
On page 22 of manual 3 it shows 2 4026B's connected together. Can 3 displays be controlled by using 3 4026B's daisy chained together?

My project shouldn't be too hard. I'm using three 7 segment led's to display milivolts seen at an analog input pin (readadc10).
So for example when 8 milivolts, display _ _ 8... when 1 volt display 100... when 2.43V display 243 etc.

It only needs to read 0-255 milivolts and hopefully refresh close to real time.
I'm kind of a noob and I figured I'd post up and get some ideas while I'm waiting for parts.
....you'll need 4 displays if you want to show millivolts up to a volt or more surely?
8 millivolts, display _ _ _ 8...when 1 volt display 1000...
when 2.43V display 2430 etc.

OK, just re-read your final paragraph, your example contradicts the 0-255mv requirement.

Texy
 
Last edited:

MikeGyver

Senior Member
....you'll need 4 displays if you want to show millivolts up to a volt or more surely?
8 millivolts, display _ _ _ 8...when 1 volt display 1000...
when 2.43V display 2430 etc.

OK, just re-read your final paragraph, your example contradicts the 0-255mv requirement.

Texy
hah oops sorry, my mistake.

The reading will never go below .20 so the third decimal place .00X can be neglected. So yeah, just 3 digits in this fashion X.XX
 

MikeGyver

Senior Member
I got the thing breadboarded and working, but I'm having an issue with overflowing.

I'm using 2 sensors, one being placed upstream of a cooler and the other placed downstream. I'm subtracting the 2 word values to display the difference value on the LED display.

let w5 = w4 - w2

How can I keep w5 from going 'negative' and overflowing?
 

wapo54001

Senior Member
Just curious -- why not use a 3.5 digit lcd voltmeter display set to read 1.999V? Or if you want only two decimal places, set to read 19.99V? Easy to implement, compact. Unless you just want to play with the circuit as described?
 

BeanieBots

Moderator
Depends slightly on what you want to happen if it overflows.
This will set w5 to 0 if w2 is bigger than w4 which would cause an 'overflow'.

if w4 >= w2 then
w5 = w4 - w2
else
w5 = 0
endif
 

MikeGyver

Senior Member
Just curious -- why not use a 3.5 digit lcd voltmeter display set to read 1.999V? Or if you want only two decimal places, set to read 19.99V? Easy to implement, compact. Unless you just want to play with the circuit as described?
This isn't really something I NEED, I just enjoy learning about electronics and making stuff. ;)

Thanks Beanie, your suggestion worked very well.
 
Last edited:

westaust55

Moderator
As an alternative,

you could use a decimal point as a negative indicator, then as a mod to what BeanieBots


Code:
symbol off = 0
symbol on = 1
symbol dp = bit x ; set a bit or whatever to drive the decimal point

if w4 >= w2 then
w5 = w4 - w2
dp = off
else
w5 = w2 =- w4
dp = on
endif
 

MikeGyver

Senior Member
Ok, lets refine this a little bit...

Here's the problem... each time the LED displays 'refresh', they blink (as they instantly count up again), and it's almost too annoying to for the intended application.

So I'm trying to make it refresh ONLY if the value w2 changes.

Any ideas?

Code:
main: 
	setfreq m8
	
	readadc10 1,w1              `read temperature sensor
	let w2 = w1 * 100/202       `adjust reading for LED display
	gosub clock
	pause 1000
	goto main 
	
clock: 
	pulsout 6,1                 ‘reset LED display to 0
	if w2 = 0 then endclk
	for w3 = 1 to w2            ‘start a for...next loop
	pulsout 7,1                 ‘pulse clock line
	next w3                     ‘next loop
	
endclk:
	return
 

MikeGyver

Senior Member
Ok I came up with this and it seems to work.
Now how can I get it to require a change of value equal to 2 or more to refresh? (to keep it from bouncing back and forth between 2 values)

Code:
main: 
	setfreq m8
	readadc10 1,w1
	let w2 = w1 * 100/202
	gosub clock
	pause 500
	let w4 = w2
	goto main 
	
clock:
	if w2 = w4 then goto main
	pulsout 6,1             ‘reset display to 0
	if w2 = 0 then endclk
	for w3 = 1 to w2        ‘start a for...next loop
	pulsout 7,1             ‘pulse clock line
	next w3                 ‘next loop
	
endclk:
	return
 
Top