18x inputs to outputs?

hippy

Technical Support
Staff member
No, I never found a way to do that.

The PICAXE updates the internal port direction bits every command so any attempt to poke to the underlying hardware registers is quickly thwarted. For the 18X it's necessary to keep data which says what the direction bits must be to allow I2C operations and, luckily for us, the way it was implemented is that this $AE shadow register is what the Output Pin directions are written from.

There's no need to make the Input Pins' directions programmable, so no shadow register availabe for that.
 

hippy

Technical Support
Staff member
Now that made me think !

The data line has got to be bi-directional to send the KeyLed data ... however, unlike I2C, the switching of line direction can be done entirely within the commands, so as soon as the PICAXE moves onto the next command the inputs can be forced to be inputs again.

It's only because once I2C has been enabled the SDA/SCL lines must be kept as inputs so a shadow register is used to store the direction bits. Rev-Ed could have used a single bit to indicate if I2C were enabled or not and forced specific bits in TRISB whenever it was updated. Fortuitously they did not do that, and have made the 18X much more powerful and flexible in the process.
 
Top