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

pic18f86j90 RB4 and RB5 pullups are read as 0

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
[email protected]



Joined: 24 Mar 2010
Posts: 24

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

pic18f86j90 RB4 and RB5 pullups are read as 0
PostPosted: Tue Oct 02, 2018 3:31 am     Reply with quote

Hi,

I am using pic18f86j90 with CCS ver 4.099.

My firmware has some basic inits (like ports, A/D and some more modules) and then comes the following code:

if ((input(HW_KEY_OK) == 0)&&(input(HW_KEY_AUTO) == 0))
{
DigitDisplay(CHR_R, CHR_S, CHR_T);
ResetEEprom();
DigitDisplay(CHR_E, CHR_N, CHR__d);
}

HW_KEY_OK is RB4 and HW_KEY_AUTO is RB5 with pullups enabled.

The problem: while both switchs(HW_KEY_OK and HW_KEY_AUTO) are not pressed sometimes the code inside the "if" is executed and sometimes not. This is driving me crazy.

I looked at the RB4,RB5 signals using oscilloscope and they are always high (pulled-up) even when problem occurs.

Does someone have a clue what's going on here?

Regards,
Gil
_________________
Gil F.
Ttelmah



Joined: 11 Mar 2010
Posts: 19553

View user's profile Send private message

PostPosted: Tue Oct 02, 2018 4:12 am     Reply with quote

They are probably not reliably high.

The internal pull-ups are very low current sources. Just 30uA typically. It doesn't take much EMI, for a line pulled up with this small current, to be momentarily taken low enough to not be seen as 'high'.
Are you absolutely sure you are enabling the pull-ups?. You realise 'TRUE' would not enable them?. They are per bit settable on this chip.
[email protected]



Joined: 24 Mar 2010
Posts: 24

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

PostPosted: Tue Oct 02, 2018 6:16 am     Reply with quote

Sorry for misleading. The error is not in the code displayed above.

Case closed
_________________
Gil F.
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