let dirs = %00000000 with 08/08M

tarzan

Senior Member
Why doesn’t “let dirs = %00000000” work with 08/08M.
I have to use
low 0
low 1
low 2
low 4
if I want to make inputs - outputs and set them low, so that I can use “let pins =”
 

Bloody-orc

Senior Member
oh sorry. had forgotten that (not using 08 much). anyway. when you use
let dirs = %00000000
then you hope to get pins to outputs? you cant. the are inputs then. to get all outputs then use
let dirs = %11111111

if you did that also, then i'll keep my mouth shut cause i dont know what might mbe wrong.
 

hippy

Technical Support
Staff member
For a native PICmicro, when setting the direction control ( TRISA etc ) zero is output, one is input. Easy to remember because zero looks like the O of Output and a one looks like the I of Input.

For the entire PICAXE range, the quivilent 'dirs' bits are the other way round, zero is input, one is output.

Why it's different I don't know, but it's unlikely to change because it would break too much existing code. It catches me out all the time. One solution is to alias 'dirs' with 'outputs' which can make coding less error prone ...

- SYMBOL outputs = dirs
-
- outputs = %0001111 ' 1=Output

It would be possible to implement suitable commands in the compiler without needing to change firmware but that would be in the hands of Rev-Ed ...

- INPUTS %00001111
- OUTPUTS b0
- LET inputs = %00001111
- LET outputs = b1
 

Technical

Technical Support
Staff member
The inverted 0 and 1 is historical for program compatibility with other systems. For the 28X, 40X you can use the conventional logic with let tris= rather than let pins=, but this is not implemented on the 08/08M. We may look at adding this into a later release.
 
Top