18M2 "pins ="

tim griff

In the old days when I used older picaxe chip if I want the output pins to represent a binary number I typed

pins = b1
I'm in the process of switching to 18M2's

my code
lookup hr_ten, (63,6,91,79, 102,109, 125, 7, 127,111,0,64), onrelay
let pinsb = onrelay

On the simulator the correct variable is shown in "outpinsB"
How do I get this value to pins to drive the darlington chip

I've played with setting the B port to be outputs , but have got myself in a pickle, any help please


tim griff

~Thanks for the reply

On the simulator the value of "onrelay" is correct in outpinsB , am I correct in thinking that this value needs to be in pinsB to drive the darlington chip.

I have changed the code to

lookup min_unit, (63,6,91,79, 102,109, 125, 7, 127,111,0,64), onrelay
LET dirsB = %11111111
let pinsB = onrelay

what am I doing wrong? thanks


Technical Support
Staff member
Your code should be working so the problem may not be in driving the Darlington Array but in using its outputs. These are open-collector outputs so will only be open-collector (floating) or pulled towards 0V. You will need some kind of load between collector and +V to see any output activations.

Perhaps describe the results you are seeing as that will help point to what is wrong.

In your LOOKUP I would recommend changing the decimal numbers to binary so it is easier to see which output pins they drive. For example; 109 is %01101101. That also makes it easier to check the numbers used are correct as well as what bits should be set in the 'onrelay' variable and on the output pins.

tim griff

Hippy, Thanks for your help. I thought I was comfortable with darlingtons but will all the visitors gone today I hope to get the logic probe out and sort it!.............
I take your advice on changing the LOOKUP to binary,but the reason I did this is I need to send out from both boards the sum of 127(i've allocated a binary number to each segment). If I want to display number 1 I need to send 6 to the "onrelays" and 121 to the "off relays"

lookup hr_ten, (63,6,91,79, 102,109, 125, 7, 127,111,0,64), onrelay
let pinsb = onrelay

let offrelay = 127-onrelay
let digit_out= 0
serout c.1, N2400,(offrelay,digit_out)

I think I've attached a picture of the project

Regards Tim


tim griff


Thanks for all the help.

I've put the GPS and driving the "onrelays" on one board and driving the "offrelays" and digit control( multiplexed positive) on another board ( connected by SERIN/OUT).

Fault --my code moved onto the next digit on the first board before the second board had finished it's work



Senior Member
HEY, that looks like my old Heathkit digital clock shown here.
Still working after 30(?) years or so.
I did replace the light bulbs with LED's, Tired of changing burned out bulbs and loose sockets.
Still have the original manuals/schematics.
Last edited: