Is this possible?

rmitch

New Member
I want to make an up and down counter, and multiplex a 3 digit 7 segment display. Can a picaxe be programmed to do this with out other ics?

i want a compact unit. mabe 2 inch by 2 inch.
I drew a schematic containing 3 counter ics and 3 driver ics
and a picaxe to control inputs, I havent tested it yet. but I would like to multiplex the display, and reduce the size.

any coments or suggestions.
 

hippy

Technical Support
Staff member
I'd say it can be done using a 20M upwards ( any except 08, 08M, 14M ).

A technique called charlieplexing can drive seven 7-segment displays using just an 8-bit control bus. People have had problems with getting this to work and to work without flicker or being very dim but I believe it should work. I don't have any 7-segment displays to prove it with though.
 

Tom2000

Senior Member
Here's the url for the article that deals with charlieplexing seven-segment displays.

I've always meant to play with this idea to see if and how it really works, but like hippy, finding enough displays in my junkbox is problematic. I'd probably have to mix common-anode and common-cathode displays. :)

http://www.instructables.com/id/Charlieplexing-7-segment-displays/

Other than charlieplexing, you can mux your display directly if you have enough input and output pins. You'd common the lines from the segments of all displays and connect them to either seven or eight pins of the micro. (Eight for decimal point; seven without)

The common lead from each display would connect to its own I/O pin.

(Don't forget series resistors... place one in each commoned segment line, for a total of seven or eight resistors.)

So, if you have either 10 or 11 pins available on your processor, you can mux your display without other hardware.

Good luck!

Tom
 

manuka

Senior Member
The new 8 output 20M is certainly worth looking for this,perhaps using the D.P. output as a carry line activation for the next 7 segment display. As you'll need to keep multiple segments lit when showing the likes of 888 etc, keep the total total current needs in mind however! In a worst case 7 x 3 = 21 will be lit!

How rapidly are you counting? Charlieplexing, although very nifty, involves considerable wiring & often has annoying flicker. Classical 7 seg counting may still have mileage - check 4510 & 4511 circuits.
 
Last edited:

marcos.placona

Senior Member
I could never figure out how charlieplexing would be coded using a picaxe, I've seen it in C on the instructables tutorial though. @rmitch if you come up with any idea, I'd like to see how it works
 

moxhamj

New Member
If you want a compact unit, maybe have a look at the new organic led displays on ebay. Go to the US ebay (www.ebay.com) and search LCD Module. Lots of LCD ones will come up, but also there will be organic led ones (called OLED) Basically, these Glow.

And interfacing to the modules is described in the 3rd manual (plus lots of optimisations on this forum). The code is the same as for LCD modules.

So yes, it is possible without any other chips. Up till recently the 18X has been the standard chip for driving these displays, though there have been some very interesting posts recently showing it can be done on a 14M.
 
Last edited:

MoonGoon

Member
I can vouch that Charlieplexing works on PICAXE.
5x 7-segment displays on a 28X1 @ 20Mhz works very nicely, no flicker, dimness is an issue easily overcome.
The code really isnt hard either. No more than a dozen or so commands per display. Plus the codes for each number you want to put on them. (3 commands per number) Depending on how "perfect" you want it, the code gets more involved, but not hard. just more of the same.

just thought id put this here if anyone was interested, thats all.
 

marcos.placona

Senior Member
I can vouch that Charlieplexing works on PICAXE.
5x 7-segment displays on a 28X1 @ 20Mhz works very nicely, no flicker, dimness is an issue easily overcome.
The code really isnt hard either. No more than a dozen or so commands per display. Plus the codes for each number you want to put on them. (3 commands per number) Depending on how "perfect" you want it, the code gets more involved, but not hard. just more of the same.

just thought id put this here if anyone was interested, thats all.
Would you be able to post some schematics and code samples? I'm not really doing anything related to that now, but I'd love to understand how it works.

Cheers
 

MoonGoon

Member
Here is a snipet of code to display the values in variables b4, b5, b6, b7, b8
This code will obviously only work if the wiring is correct to accompany it. I was using the PORTC pins on a 28X1.
There are issues with dimness, use a low R value like 47R to solve that. You will find that digits with less segments (eg 1) will be brighter than digits with more segments (eg 8). The pause routene solves this.

Code:
first_Display:	
		on b4 gosub No_Nil, No_1, No_2, No_3, No_4, No_5, No_6, No_7, No_8, No_9, No_0, No_Blank
		peek $87, b0
			if bit1 = 0 then low portc 1 high portc 7 else low portc 1 endif
		let b13 = b4
                gosub pause 
		let pinsc =%00000000

second_Display:	
		on b5 gosub No_Nil, No_1, No_2, No_3, No_4, No_5, No_6, No_7, No_8, No_9, No_0, No_Blank
		peek $87, b0
			if bit2 = 0 then low portc 2 high portc 7 else low portc 2 endif
		let b13 = b5
                gosub pause
		let pinsc =%00000000

third_Display:	
		on b6 gosub No_Nil, No_1, No_2, No_3, No_4, No_5, No_6, No_7, No_8, No_9, No_0, No_Blank
		peek $87, b0
			if bit3 = 0 then low portc 3 high portc 7 else low portc 3 endif
		let b13 = b6
                gosub pause
		let pinsc =%00000000

fourth_Display:	
		on b7 gosub No_Nil, No_1, No_2, No_3, No_4, No_5, No_6, No_7, No_8, No_9, No_0, No_Blank
		peek $87, b0
			if bit4 = 0 then low portc 4 high portc 7 else low portc 4 endif
		let b13 = b7
                gosub pause
		let pinsc =%00000000

fifth_Display:	
		on b8 gosub No_Nil, No_1, No_2, No_3, No_4, No_5, No_6, No_7, No_8, No_9, No_0, No_Blank
		peek $87, b0
			if bit5 = 0 then low portc 5 high portc 7 else low portc 5 endif
		let b13 = b8
                gosub pause
		let pinsc =%00000000

'Pause values ----------------------------------------------------------

pause:
       select case b13
                case 1          pause 0
                case 4,7        pause 1
                case 5,2,3      pause 2 
                case 6,9        pause 3
                case 8          pause 4
       endselect
RETURN

'Value Displays ---------------------------------------------------------
	
        No_Nil: 	'dash"
		dirsc =%00001000
		let pinsc =%00001000
	RETURN
	No_1:			
		dirsc =%00000110
		let pinsc =%00000110
	RETURN
	No_2:		
		dirsc =%01011011
		let pinsc =%01011011
	RETURN
	No_3:		
		dirsc =%01001111
		let pinsc =%01001111
	RETURN
	No_4:		
		dirsc =%01100110
		let pinsc =%01100110
	RETURN
	No_5:		
		dirsc =%01101101
		let pinsc =%01101101
	RETURN
	No_6:		
		dirsc =%01111101
		let pinsc =%01111101
	RETURN
	No_7:		
		dirsc =%00000111
		let pinsc =%00000111
	RETURN
	No_8:		
		dirsc =%11111111
		let pinsc =%11111111
	RETURN
	No_9:		
		dirsc =%01101111
		let pinsc =%01101111
	RETURN
	No_0:		
		dirsc =%00111111
		let pinsc =%00111111
	RETURN
This should tempt your taste buds if your interested Marcos
 

MoonGoon

Member
Sorry i dont have the schematic, it wouldnt post for me.

Pin 7 is the "shadow Ground" pin.
The ground for Display 1 is PortC1, display 2 PortC2 etc.
 

Mycroft2152

Senior Member
MG,

Post your schematic, a photo of the schematic drawn on a piece of paper will work.

Perhaps it is the same one as on the MAXIM site?

I tried your code snippet, two errors came up. the PAUSE command gives a syntax error; and there is a missing subroutine called "no_Blank"

Myc
 

MoonGoon

Member
Sorry but the code i posted, i just typed up here at work.

My actual code has a lot more going on than just running a display so its imbedded amoungst alot more code.

I may have put a space somewhere by accident maybe when i wrote it. I dont have a compiler with me to check. Ill check it when i get home and repost. Thanks for spotting.

I really only wrote this to give people an idea of what is going on. I think it does that even with a small syntax error with a Pause command.

The schematic is similar to the MAXIM site one, but i have changed it a little to suit my own preferences and the PICAXE 28X1 pins.
 

MoonGoon

Member
Ok, i chucked it through the combiler.
Syntax checks out. Except obviously, if you havnt spotted, it wont run fully on the simulator due to the Peek command being used. Unless there is an undate im not aware of because it wont run on mine. I have to load it onto my 28X1 to physically see if it works. But it does.

The below code will display 1, 2, 3, 4, 5 on 5x 7-segment displays respectively.

Code:
let b4 = 1
let b5 = 2
let b6 = 3
let b7 = 4
let b8 = 5

Main:

first_Display:	
		on b4 gosub No_Nil, No_1, No_2, No_3, No_4, No_5, No_6, No_7, No_8, No_9, No_0
		peek $87, b0
			if bit1 = 0 then low portc 1 high portc 7 else low portc 1 endif
		let b13 = b4
                gosub Pause_time
		let pinsc =%00000000

second_Display:	
		on b5 gosub No_Nil, No_1, No_2, No_3, No_4, No_5, No_6, No_7, No_8, No_9, No_0
		peek $87, b0
			if bit2 = 0 then low portc 2 high portc 7 else low portc 2 endif
		let b13 = b5
                gosub Pause_time
		let pinsc =%00000000

third_Display:	
		on b6 gosub No_Nil, No_1, No_2, No_3, No_4, No_5, No_6, No_7, No_8, No_9, No_0
		peek $87, b0
			if bit3 = 0 then low portc 3 high portc 7 else low portc 3 endif
		let b13 = b6
                gosub Pause_time
		let pinsc =%00000000

fourth_Display:	
		on b7 gosub No_Nil, No_1, No_2, No_3, No_4, No_5, No_6, No_7, No_8, No_9, No_0
		peek $87, b0
			if bit4 = 0 then low portc 4 high portc 7 else low portc 4 endif
		let b13 = b7
                gosub Pause_time
		let pinsc =%00000000

fifth_Display:	
		on b8 gosub No_Nil, No_1, No_2, No_3, No_4, No_5, No_6, No_7, No_8, No_9, No_0
		peek $87, b0
			if bit5 = 0 then low portc 5 high portc 7 else low portc 5 endif
		let b13 = b8
                gosub Pause_time
		let pinsc =%00000000

goto main

'Pause values ----------------------------------------------------------

Pause_time:
       select case b13
                case 1          pause 0
                case 4,7        pause 1
                case 5,2,3      pause 2 
                case 6,9        pause 3
                case 8          pause 4
       endselect
RETURN

'Value Displays ---------------------------------------------------------
	
        No_Nil: 	'dash"
		dirsc =%00001000
		let pinsc =%00001000
	             RETURN
	No_1:			
		dirsc =%00000110
		let pinsc =%00000110
	             RETURN
	No_2:		
		dirsc =%01011011
		let pinsc =%01011011
	             RETURN
	No_3:		
		dirsc =%01001111
		let pinsc =%01001111
	             RETURN
	No_4:		
		dirsc =%01100110
		let pinsc =%01100110
	             RETURN
	No_5:		
		dirsc =%01101101
		let pinsc =%01101101
	             RETURN
	No_6:		
		dirsc =%01111101
		let pinsc =%01111101
	             RETURN
	No_7:		
		dirsc =%00000111
		let pinsc =%00000111
	             RETURN
	No_8:		
		dirsc =%11111111
		let pinsc =%11111111
	             RETURN
	No_9:		
		dirsc =%01101111
		let pinsc =%01101111
	            RETURN
	No_0:		
		dirsc =%00111111
		let pinsc =%00111111
	             RETURN
I dont have the schematic, but attached is the pins and which segment they are attached to on which display. If it helps at all. I think it might be hard to read.

Also, the Pause_time values, may have to changed for your particular 7-segment display depending on Vf and Current values etc.

Example: the ground of Display 3 is attached by wire to the "d" segment of Display 2. and then to "d" of Display 1. Then into PORTC 3.

The "GND" as indicated on uC pin7 is not a real Ground. Its just the pin im allocating the name ground for ease of labeling. The GND is different for each display.

if that makes sense. If not, please ask.
 

Attachments

Top