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

weird problem with pic16f886

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



Joined: 04 Apr 2006
Posts: 117
Location: Brasil

View user's profile Send private message Send e-mail MSN Messenger

weird problem with pic16f886
PostPosted: Fri Jan 18, 2008 4:12 pm     Reply with quote

Hi people,

I was working on pic16f886 and i a weird problem happened.

the weak pullups on PORT_B just didnt work with PIN_B0 and PIN_B1.

I configured the pins as digital I/O and set the pullups with the following code:


Code:

    set_tris_b (0x07);  // b0, b1 and b2 as inputs
    *0x189=0;   //ANSELH = 0;  -> digital I/Os   
    port_b_pullups (TRUE);  // WPUB = 0 - weak pullups on



to fixed the problem I needed to put external pullups on those pins (B1 and B2), B0 worked fine.

anybody has a clue to what happened ?

regards.
_________________
Andre
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Jan 18, 2008 4:48 pm     Reply with quote

Post your compiler version.
andreluizeng



Joined: 04 Apr 2006
Posts: 117
Location: Brasil

View user's profile Send private message Send e-mail MSN Messenger

PostPosted: Fri Jan 18, 2008 9:17 pm     Reply with quote

IDE 4.032
PCB 4.032
PCM 4.032
PCH 4.032
_________________
Andre
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Fri Jan 18, 2008 10:59 pm     Reply with quote

The CCS start-up code has a lot of problems in your version. However,
that's not the main cause of your problem.

In your version, the Port B pullups can be individually enabled or disabled
for every pin in Port B. So you shouldn't use TRUE or FALSE with the
port_b_pullups() function. You should use a bitmask. Set a bit = 1
to enable a pullup, and set a bit = 0 to disable it. This is explained in
the 16F886 and the CCS manual. Because 'TRUE' is defined as 0x01,
when you do this you are really only enabling the pullup on pin B0:
Code:
port_b_pullups (TRUE);
andreluizeng



Joined: 04 Apr 2006
Posts: 117
Location: Brasil

View user's profile Send private message Send e-mail MSN Messenger

PostPosted: Sat Jan 19, 2008 9:08 am     Reply with quote

PCM, i got your point... but before I use port_b_pullups function, I directly set the register WPUB with 0xFF value, and it didnt work too. Probably I made something wrong.

however, I will try your sugestion.

thanks

regards.
_________________
Andre
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