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