pic16f887 portb on mikro c

Status
Not open for further replies.

georgetwo

Member
Hi everyone!
I am just getting close to c language with mikro c compiler with pic16f887 .
At present, Im finding problems trying to initialise my portb pin state change interrupt. I have tried reading datasheet but cant find solution.I only know there is a intcon, config_reg, iocb and cant fix them together .I need ur help to configure It.
thanks
 
You're looking to set RBIE and GIE in the intcon reg, The IOCB sets which pins you want to affect a change. once an interrupt occurs clear RBIF in the intcon reg.

REMEMBER to clear your ANSELH reg as some RB pins are analogue inputs by default...

Sorry!! The option reg is for enabling weak pullups and INT pin triggering on portb
 
Last edited:
In hitech C, they have defined all the bits aswell so you CAN type just RBIE. Unfortunately I dont use Mikro C so you're own with definitions.
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…