CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

VBAT/Pin A5 on PIC16LF19156: cannot use as IO

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
dluu13



Joined: 28 Sep 2018
Posts: 395
Location: Toronto, ON

View user's profile Send private message Visit poster's website

VBAT/Pin A5 on PIC16LF19156: cannot use as IO
PostPosted: Thu Jun 11, 2020 2:13 pm     Reply with quote

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: 288

View user's profile Send private message

PostPosted: Thu Jun 11, 2020 2:24 pm     Reply with quote

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

View user's profile Send private message Visit poster's website

PostPosted: Thu Jun 11, 2020 2:32 pm     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group