Hi, this is my first post so I will try to keep it brief. Im working on a basic test program to upgrade later to a large program. I have a single interrupt working right now with RB0, I want to use up to 3 external interupts, RB0 - RB2. I'm posting my current code below, I am using MicroCode Studio with a 18F4550. Later I may want to use the USB funtion on this also, but I'm lost on USB right now.
Code:
Trisb.0 = 1
Trisb.7 = 0
INTCON2.7 = 0' Enable PORTB pullups, and falling edge on B0 interrupt
On Interrupt Goto myint ' Define interrupt handler
INTCON = %10010000 ' Enable INT0 interrupt
loop:
PORTB.7 = 1 ' Turn LED on
Goto loop ' Do it forever
' ****** Interrupt handler *******
Disable ' No interrupts past this point
myint:
PORTB.7 = 0 ' If we get here, turn LED off
Pause 500 ' Wait .5 seconds
INTCON.1 = 0 ' Clear interrupt flag
Resume ' Return to main program
Enable
I would like to perform something that lets me use something like myint0 myint1 myint2 labels. im just using a button right now to trigger the RB0, my next step is to have a 4x4 keypad using a 74922 chip , I can tie the 922's data ready pin to RB0 for the keypad interrupt, that uses 1 interrupt, the 4bit output of the keypad I would like to use with PORTB 4-7 , i can move the last 4 bits to a variable then read the variable as a 4bit number 0-15. but for right now, lets just try to get INT 0-2 working with PORTB 5,6,7 as output leds.each INT should work with Each output seperately.
Bookmarks