28X1 output help

AlexanderB

New Member
well for my A Level DT project i need to have 12 outputs not the standard 8 on a picaxe, so i turned to the 28x1 as it has the extra "portc outputs" but i've come into a bit of issus with writing to the outputs.
currently i have the standard output pins being writen like

Code:
 let pins = %11010001
which form the understanding i've been taught will put outputs 0,4,6 & 7 high (correct?)

so in theory could you use

Code:
 let pinsc = %11010001
to put the outputs 0,4,6 & 7 on Portc to high, or would that just change them to be outputs. (or is that the samething?)

I have read the bit in the PICAXE manual about it but i found it slightly confusing.

cheers for your help
 

hippy

Ex-Staff (retired)
Welcome to the PICAXE forum.

Yes, "let pinsc = %11010001" will set Port C outputs 0, 4, 6 and 7 high, but first you have to use a "let dirsc = %11010001" to set the pins as output pins. These pins set to 1 will become outputs, those 0 will be inputs, eg use "let dirsc=%11111111" to make them all outputs.
 

AlexanderB

New Member
YAY and with the
"let drisc=%...."
would that have to be repeated before every time i use the Pinsc = or just at the beginning of the program?.

and for that i'm guessing that
"let dirsc=%11111111"
doesn't set any of the outputs to be high but just formats them to be outputs. correct?
 

hippy

Ex-Staff (retired)
Just one 'let dirsc=%..." needed at the begining of the program.

And, no, 'let dirsc=%..." doesn't actually set the level of the pins, When they become outputs each pin will usually get the output levels previously set ( low after reset ) ...

let dirsc = %11111111 ' All outputs ( low )
let pinsc = %11111111 ' Set all pins high
let dirsc = %00000000 ' All inputs
let dirsc = %11111111 ' All outputs ( high from previous pinsc= )
 

Andrew Cowan

Senior Member
Pin low = internally connected to 0V
Pin high = internally connected to +V
Pin set as input = pin 'floating', with high impedance.

A
 
Top