Q
Can I program Port 1 and 3 as input or output, ie is it to send logic 1 or
logic 0 via port 1 and 3? In the document, it says, whenever you write 0, it
becomes input. It also says P1.2-P1.7 cannot be configured as digital output.
But it should drive base of a transistor connected to P1.2-P1.7 if I write 1 to
P1.2-P1.7.
A
Each of the pins of Port 3 can be an input or an output. If you write a 0 to
the bit location in the P3 register, the pin outputs a digital low. If you
write a 1 to the bit location, the pin is pulled high by an internal pull-up
and in addition, a strong pull up is active briefly, to speed up the 0-1
transition.
Pins P1.0 and P1.1 fucntion like the port 3 pins. All the other port 1 pins can
only be digital inputs or analog inputs (to the ADC). To get them to be digital
inputs, you need to write a 0 to the bit location in the P1 register. To get
them to be ADC input pins, write a 1 to the port bit and configure ADCCON2.3~0
to select the required channel.
There is no output circuitry on P1.2~P1.7 so thay CANNOT even be used to drive
transistor bases, as you describe.