View previous topic :: View next topic |
Author |
Message |
dluu13
Joined: 28 Sep 2018 Posts: 395 Location: Toronto, ON
|
VBAT/Pin A5 on PIC16LF19156: cannot use as IO |
Posted: Thu Jun 11, 2020 2:13 pm |
|
|
Hi,
I am having trouble getting Pin A5 to behave as an IO on a PIC16LF19156 and CCS PCM 5.078. According to the datasheet, if I set the fuse for NOVBATEN, I should be able to use Pin A5 as an IO.
Here is my code that shows I was unable to use A5 as output:
Code: | #include <16LF19156.h>
#DEVICE ADC=12
#fuses BROWNOUT
#fuses BORV27
#fuses LVP
#fuses RSTOSC_HFINTRC_32MHZ
#fuses NOVBATEN
#fuses NOEXTOSC // needed to enable PIN_A7 as I/O
#use delay(clock=32000000)
int main(int argc, char** argv)
{
while (1)
{
delay_ms(1000);
output_toggle(PIN_A4);
output_toggle(PIN_A5);
output_toggle(PIN_A6);
output_toggle(PIN_A7);
}
return 0;
} |
According to the LST file, the VBATEN bit is 1, which means Pin A5 should be used as general purpose IO. Do you have any ideas why this is the case? |
|
|
gaugeguy
Joined: 05 Apr 2011 Posts: 303
|
|
Posted: Thu Jun 11, 2020 2:24 pm |
|
|
The datasheet says it can be a general purpose input, not general purpose I/O.
No output capability. |
|
|
dluu13
Joined: 28 Sep 2018 Posts: 395 Location: Toronto, ON
|
|
Posted: Thu Jun 11, 2020 2:32 pm |
|
|
Ah man... I always miss things like this. In the configuration register page, it says setting NOVBATEN will make A5 a "GPIO".
On the table of pins, it says "general purpose input".
I guess that's one mystery solved...
Thanks |
|
|
|