My program goes into the PORTB on change interrupt service routine, #INT_RB, even though I can't see any signals changing on these ports. I am using the CDC-library of CCS to send data via USB to the PC, but I can't find where CDC may be interfering with portB. Any suggestions?...
Do you mean that you get an INT_RB interrupt as soon as
you enable interrupts ?
If so, it's happening because you didn't clear the "change" condition
on Port B before you enabled interrupts.
You do this by reading port B.
Code:
#byte PortB = 6 // Address of Port B for the 16F series PICs
main()
{
char c;
port_b_pullups(true);
set_tris_b(0x10);
enable_interrupts(INT_RB);
c = PortB; // Read PortB before enabling global interrupts.
enable_interrupts(GLOBAL);
while(1);
}
Mark
Joined: 07 Sep 2003 Posts: 2838 Location: Atlanta, GA
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