I don't think this is a required command since I am only using HIGH and LOW on the ports which I understand automatically set the port to input or output, but that doesn't stop me from wanting to understand doing this better.
If I look at the chip data sheet I see that the gpio register starts at 5h and the trisio starts at 85h. <b>Physical</b> pins are as such:
1 - +5v
2 - port 5 I/O
3 - port 4 I/O
4 - port 3 / MCLR
5 - port 2 I/O
6 - port 1 I/O
7 - port 0 I/O
8 - ground
So, I want to make ports 0,1,2,4 and 5 as outputs, port 3 either as MCLR or not used at all. Pins 1 and 8 obviously serve there own purpose. Here is a graphic of the registers:
I believe I should be able to use POKE $85, <b>?</b> to set the I/O to output on the pins I need, but at the same time not interfere with the other ports. In my mind, since I want all but the MCLR to be outputs it would look like: <b>POKE $85,%0001000</b> or even <b>POKE $85,%00000000</b> since some are ignored and setting pin 3 to MCLR=ON in my programmer it will select the proper bit on it's own.
Am I somewhat close on my logic? Using the PBC manual this seems reasonable.
Thanks.
Bart
Bookmarks