Connecting Two Picaxe 18-A I.Cs together to count with 7 seg display

King Putt

New Member
I'm having a lot of trouble using two picaxe boards connected together to count numbers one to ninety-nine.

im using the following program for picaxe board no. 1
Code:
test:
 
if pin2 = 1 then flash1
 
goto test
 
test2:
 
if pin2 = 1 then flash2
 
goto test2
 
test3:
 
if pin2 = 1 then flash3
 
goto test3
 
test4:
 
if pin2 = 1 then flash4
 
goto test4
 
test5:
 
if pin2 = 1 then flash5
 
goto test5
 
test6:
 
if pin2 = 1 then flash6
 
goto test6
 
test7:
 
if pin2 = 1 then flash7
 
goto test7
 
test8:
 
if pin2 = 1 then flash8
 
goto test8
 
test9:
 
if pin2 = 1 then flash9
 
goto test9
 
test10:
 
if pin2 = 1 then flash10
 
goto test10
 
 
flash1:
 
let pins = %00011000
pause 1000
goto test2
 
flash2:
 
let pins = %11110011 
pause 1000
goto test3
 
flash3:
 
let pins = %11111000
pause 1000
goto test4
 
flash4:
 
let pins = %10011100
pause 1000
goto test5
 
flash5:
 
let pins = %11101100
pause 1000
goto test6
 
flash6:
 
let pins = %11101110
pause 1000
goto test7
 
flash7:
 
let pins = %00111000
pause 1000
goto test8
 
flash8:
 
let pins = %11111111
pause 1000
goto test9
 
flash9:
 
let pins = %11111100
pause 1000
goto test10
 
flash10:
 
let pins = %01111111
high 0
pause 1000
goto test
 
 
... and im using the following program for the second board:
 
test:
 
if pin1 = 1 then flash1
 
goto test
 
test2:
 
if pin0 = 1 then flash2
 
goto test2
 
test3:
 
if pin0 = 1 then flash3
 
goto test3
 
test4:
 
if pin0 = 1 then flash4
 
goto test4
 
test5:
 
if pin0 = 1 then flash5
 
goto test5
 
test6:
 
if pin0 = 1 then flash6
 
goto test6
 
test7:
 
if pin0 = 1 then flash7
 
goto test7
 
test8:
 
if pin0 = 1 then flash8
 
goto test8
 
test9:
 
if pin0 = 1 then flash9
 
goto test9
 
test10:
 
if pin0 = 1 then flash10
 
goto test10
 
 
flash1:
 
let pins = %00011000
pause 1000
goto test2
 
flash2:
 
let pins = %11110011 
pause 1000
goto test3
 
flash3:
 
let pins = %11111000
pause 1000
goto test4
 
flash4:
 
let pins = %10011100
pause 1000
goto test5
 
flash5:
 
let pins = %11101100
pause 1000
goto test6
 
flash6:
 
let pins = %11101110
pause 1000
goto test7
 
flash7:
 
let pins = %00111000
pause 1000
goto test8
 
flash8:
 
let pins = %11111111
pause 1000
goto test9
 
flash9:
 
let pins = %11111100
pause 1000
goto test10
 
flash10:
 
let pins = %01111111
pause 1000
goto test
The second board counts of its own accord as if it is not looking for an input.

Any help would be appreciated,

thanks,

Jamie Patel
 
Last edited by a moderator:

BeanieBots

Moderator
Please use the code tags for long listings.
Do you have the 0v lines connected as well?
Not sure why you are using two PICAXEs. It could be done with just one.
 

King Putt

New Member
Yes both boards are connected to 0v. How can i use just one board to control two seven segment displays?

thanks,

Jamie
 

BeanieBots

Moderator
Do a search on "multiplex".
If you can't find the answer, come back and someone will help out.
Not my strong point I'm afraid.
A couple of 4026 driver chips is another option that I would have thought would be easier and cheaper than two PICAXEs.

As for your original issue, I've not looked too closely at your code but it does sound like a floating input. Double check that you have used and are testing the right pins. Also check that neither serin nor reset have been left floating.
 
Last edited:

Rbeech

New Member
I am working on a similar problem. I am trying to develop a seconds counter that is activated by an external output.

So far I have built it in hardware using 4033s (similar to 4026), but am trying now to implement in PICAXE. So far I have almost got the counter working.

I intend to use half wave rectified 60 Hz for my time signal, and this is the code I have so far. NB: It is not fully functional yet, but might help you get some ideas.


Code:
symbol rightdigit = b0			'define variables
symbol leftdigit = b1
symbol seconds = b2
symbol leftseconds = b3
symbol rightseconds = b4
symbol shoton = pin0

setint %00000010, %00000010		'setinterrupt to check for HIGH on pin1 (Axestack 9)

rightdigit = %00111111			'set to 0
leftdigit = %10000000			'blank leading digit

main:
	gosub display
	
	goto main


display:
	pins = rightdigit			
	pins = leftdigit
	
	goto display

interrupt:
	inc seconds
	rightseconds = seconds//10
	lookup rightseconds, (%00111111, %00000110, %01011011, %01001111, %01100110, %01101101, %01111101, %00000111, %01111111, %01101111), rightdigit
	leftseconds = seconds/10
	lookup leftseconds, (%10000000, %10000110, %11011011, %11001111, %11100110, %11101101, %11111101, %10000111, %11111111, %11101111), leftdigit
	do while pin1 = 1:loop 				'Stay here if pin1 is still high
	setint %00000010, %00000010
	return
The MSD of each number is set to 0 or 1, and this output is used to switch (using a NOT gate on one, and a straight transistor on the other) the common line on each of the 7segs. As you will see, during the display subroutine, the two digits are alternately lit.
 

Photo-Worx

New Member
I used a 28X1 and this code.

I did a little project that counted from 0 to 99 on a 2-dig. 7-seg display.
I used the 28X1 and put the wires to the 'ones' digit on the regular output pins and the wires for the 'tens' digit on the 'pinsc' output. It worked extremely well and was very easy to set up.
Just remember to use common cathode displays. I had to use two ULN2003AN chips to run my common anode dual display.

Anyway, here is the code I used for a simple count up counter.


Code:
; PICAXE 28X1 dual 7 segment display 01
; Dual 7 segment display program for the 28X1 will count from 00 to 99
; Copyright 2007 Daniel Wright

Initialize:

data 0,(%00111111,%00000110,%01011011,%01001111,%01100110,%01101101,%01111101,%00000111,%01111111,%01101111) ‘ save array 1 values in EEPROM
data 20,(%00111111,%00000110,%01011011,%01001111,%01100110,%01101101,%01111101,%00000111,%01111111,%01101111)‘ save array 2 values in EEPROM
let dirsc=%11111111

main:

for b2=20 to 29	'start tens loop
read b2,b3		'read tens value of array 2
let pinsc=b3

for b0 = 0 to 9 	‘start ones loop
read b0,b1 		‘read ones value of array 1
let pins=b1
pause 1000
let pins = %00000000
next b0 		‘next character ones loop

let pinsc = %00000000
next b2		'next character tens loop

goto main

end
Hope this helps. :D

Dan
 
Top