Hello list, I'm new to the forums, but they have been very helpful!
Perhaps someone can help me with this snag... I'm using Hardware Serial Interrupts on a 18F452 reading in midi data. From the LED I have in the interrupt, I can tell the interrupt is operational, and I know that I'm reading the RCREG register because it clears the RCIF flag allowing main loop to run again.
Even though these two things are happening, the RCREG variable I'm putting into inByte is showing up as an empty value. Does anyone know why this could be happening? Code is below...
Code:DEFINE OSC 20 DEFINE HSER_BAUD 31250 On Interrupt Goto myint ' Define interrupt handler (PBP Gimme) RCSTA = $90 'didnt want to look up the binary for these ;) TXSTA = $24 INTCON = %11000000 ' Enable peripheral interrupts PIE1.5 = 1 ' Enable Serial Interrupt loop: LOW led 'main loop Goto loop ' INTERRUPT HANDLER Disable ' PBP Command - No interrupting past this point myint: ' If we get here, an interrupt has been thrown INTCON = 0 ' clear INTCON (maybe redundant) if PIR1.5 = 1 THEN ' If Serial Interrupt (for mult interrupts) HIGH led inByte = RCREG ' if this clears RCREG, then this will also ' reset the PIR1.5 flag, therefore allowing ' main loop to run again ENDIF INTCON = %11000000 ' Clear external interrupt flag Resume ' Glorified PBP "Return" to main program Enable
Bookmarks