Hi Darrel,
thanks for your help on this one - it really had me stumped!
There's no need to DISABLE/ENABLE inside the handler. An interrupt source can't interrupt itself like it would in ON INTERRUPT.
Cool - I didn't realise that!
But I think what's happening is that the handler is being called multiple times before the rest of the program see's the data.
As a test, try something like this ...
Code:
hserin 100,timeout [databyte(1), databyte(2)]
@ INT_DISABLE RX_INT ; Disable RX Interrupt
@ INT_RETURN
This should return the first 2 bytes then disable the RX_INT.
The USART will overflow and stop working after that unless it is re-enabled quickly.
I have tried what you asked me to above and it works every time! I've got it capturing all the bytes now by:
Code:
hserin 100,timeout, [databyte(0), databyte(0), databyte(1), databyte(2), databyte(3), databyte(4), databyte(5)]
@ INT_DISABLE RX_INT
(the duplicate; databyte(0), databyte(0), just removes the $FD as I don't need it)
I'm
not saying this is the way to properly receive data in an interrupt.
It's just a test to help understand what's going wrong.
<br>
I'm now trying to re-enable the interrupt at some point after the data has been read by the rest of the program but it's not working at the moment. I will keep trying and update this thread later.
Cheers to all
Rob
Bookmarks