Log in

View Full Version : PIC12F675 triso question?



Gruntus
- 12th May 2023, 15:33
Good day all
I'm pretty new to the fancy PIC world and I feel that I'm understanding most of what I'm reading. One of the things that is confusing me is triso.
For the PIC12F675 I have seen example code with triso=%00000000 and
triso=%000000
The code I'm playing with has outputs on gpio.0 and gpio.1, the rest are digital inputs.
Would triso=%111100 be correct or am I missing the way 1's and 0's work.

Thanks

Ioannis
- 12th May 2023, 16:38
First of all it is TRISIO and not TRISO. You missed the I.

Then the general case is that registers are 8 bit wide. But in the 12F675 case you have access to only the least 5 bits.

So the best way to define TRISIO is to use the 8 bit format, although 5 bits will work fine too like this:

TRISIO=%00011100 is the same as TRISIO=%11100 and that would set GPIO.0 and GPIO.1 as outputs while GPIO.2, GPIO.3 and GPIO.4 as inputs.

The rest does not matter since 675 does not have that pins I/O.

It is like the numbers, 05 is the same as 5, right?

Hope this is clear.

Ioannis

Gruntus
- 15th May 2023, 17:21
That makes perfect sense, thank you.