Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

4x4 Keypad Interrupt on Change PORTB

Status
Not open for further replies.
I'm off on holidays tomorrow, so i think ill leave it till when i get back.
I didn't think it would be this hard lol.

One last thing before i go.

What does the COMF instruction mean.
Im guessing it means complement F.
But i never knew what complement did?
 
I'm off on holidays tomorrow, so i think ill leave it till when i get back.
I didn't think it would be this hard lol.

One last thing before i go.

What does the COMF instruction mean.
Im guessing it means complement F.
But i never knew what complement did?

hi,
Enjoy your holiday.

Look at this link for the COMF and others.

**broken link removed**
 
Problems with wake-up from sleep

I too am having problems with the interrupt-on-PORTB and waking from sleep.
I'm using Oshonsoft PIC18 and it's very nice piece of kit.
I'm sure that the pull-ups do work in Oshonsoft, since I use them on PortB pins 5-7 and my pushbuttons pull to ground. I use INTCON2.RBPU = 0 to enable pull-ups (note the bit has to be cleared, not set to enable pull-up resistors).
So when I use the test condition If PORTB.5=0 it works, when the button is pressed.

I have the problem that when I enable interrupt on PORTB change, it fires all the time, even when a button isn't pressed. Code to put the PIC to sleep is this:

tmpbyte0 = PORTB 'dummy read of PORTB
INTCON.RBIE = 1 'enable interrupt on change for PORTB[4-7]
High PORTE.2 'for testing
'actually put the device to sleep
WaitMs 500
ASM: sleep
ASM: nop


My wakeup interrupt code reads:
If INTCON.RBIF = 1 Then
'testing
Low PORTE.2 'led to show we've woken from sleep
INTCON.RBIE = 0 'clear bit
... do rest of wakeup routine here ....
End if

But no sooner has my PIC gone to sleep, than it wakes up again and the LED goes out again!
I've tried enabling global interrupts and putting the wakeup code in the interrupt, and also disabling global interrupts and putting the wakeup code after the sleep command. In both cases, the led lights to say the PIC is going to sleep, then goes out indicating that the wakeup routine has executed.
Did anyone get anywhere with this one? I'd love some help too.......


Hi,
The pullup feature dosnt appear to work in Oshonsoft, I will have to confirm this.?
Look at these two attachments, they may help.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top