View Feed
group-icon
Coffee Room
Discuss anything here - everything that you wish to discuss with fellow engineers.
12832 Members
Join this group to post and comment.
eccentronix
eccentronix • May 2, 2008

Ignore Input from PIC

I'm using the PIC 16-series to program something. I was wondering if anyone knows how I can ignore a certain input... E.g. i want to turn off the 5th bit of Port B(which I have initialised as my input) so that the program code that I have written may ignore any input at that pin.. How may I be able to do that?... and ofcourse, switch it on again at a later time in the program...
In summary:
1) ignore/turn off bit-5 of portB
2)switch on/enable it back again

any ideas?...it's urgent...
😕
arga
arga • May 9, 2008
Assuming you want to do this in C then mask the 5th bit off. If the variable 'A' is you input register then:

A &= 0x0010;

Add a conditional to turn it on and off.

Frank

Share this content on your social channels -