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 CCS Technical Support

16F913 / 16F916, Problem with PORT C

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



Joined: 06 Dec 2005
Posts: 59

View user's profile Send private message

16F913 / 16F916, Problem with PORT C
PostPosted: Tue Dec 06, 2005 1:05 pm     Reply with quote

Dear,

PCWH 3.236
MPLAB 7.22
PIC 16F916

If I set the Port C as an output using

Code:

fast_io(c);
set_tris_c(0);


the pins RC3-7 are already acting as an output but the pins RC0-2 are still acting as an input. The pin RC0-2 can alternatively used to drive an LCD device and so I thinks that this may be the problem. What can I do to get the port c completely as an output?

Thanks for helping
Best Regards
nilsener
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Tue Dec 06, 2005 1:23 pm     Reply with quote

If you look at the pin diagram in the 16F916 data sheet, you'll see that
those pins are shared with the VLCD module. Then if you look at the
LCDCON register description, you'll see that the VLCDEN bit is set = 1
(i.e., it's enabled) after reset. So those pins are not in digital i/o
mode after reset.

Then if you look at the CCS startup code in the .LST file, you'll see
that they don't turn that bit off. They don't change LCDCON at all.

So to turn off that bit, one quick way is to add the line shown in bold,
to your program, below:
Quote:
#use fast_io(c)

void main()
{
setup_lcd(LCD_DISABLED);

set_tris_c(0);

while(1);
}
Guest








PostPosted: Wed Dec 07, 2005 2:47 am     Reply with quote

Thanks PCM programmer, it runs now!

Regards
nilsener
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