The code works perfectly using OSHON PIC simulator. When I run the code in the PIC, it appears to hang, with no execution of the interrupt code. If I just call either routine from the interrupt it works fine.
The full code compiles to a 3K hex file with 400 out of the 8000 code memory addresses used. I was thinking that I am having paging errors. I will post the whole code if necessary but ir appears all messy when I paste it into the post editing box.
You don't appear to be saving and restoring any registers?, I suggest you check the requirements for this.
I would also suggest you reconsider your method, ISR's should be as short and fast as possible - it's also bad practice to call subroutines from them, due to the small stack size.
As I've already said, you're not saving and restoring any registers in the ISR - if you don't it WILL crash - read the datasheets, and check my tutorials that use interrupts. Try my seven segment LCD tutorial, which uses timer interrupts.
Sorry Nigel. I am about to look at your tutorial. What seems to be confusing me is that it works in the simulator so my simplistic view is should work in reality but as I have now discovered, the theories and the realities differ greatly.
Sorry Nigel. I am about to look at your tutorial. What seems to be confusing me is that it works in the simulator so my simplistic view is should work in reality but as I have now discovered, the theories and the realities differ greatly.
Still no joy. Saving and restoring the registers as shown in your tutorial but still hangs. Have hooked it up to MPLAB ICD2 but cannot get the ICD2 to see the character arrive at the UART. I am at a complete loss.
I can execute simple math routines within the interrupt, turn leds on and off at the ports with no problem. As soon as I try to use the rx_command value into the w register and try an subtract a literal....all stops. Use a literal inplace of the rx_command file, no problems.
I have to solve this as I am totally at a stop but certainly at the moment I do not know how. Have spent hours and no further forward.
Sending at 19200, individual characters. PC software sends one character (ASCII) and then waits before sending other. Although no handshaking is set up it works well as the pic only transmits on receipt of a character.
The software worked before the character differentition was added. I even looked at the line with a logical analyser just in case. The scope was certainly showing the correct character. Not sure if you have tried it yet with OSHON, but I found it worked great.
The labels are in the right place, it is just when I pasted the code in the box to post it, it just reformated the layout. Yes, the EXIT you see is just a label.
I have tried saving the W, STATUS, PCLATH etc and it still does not work
From a more basic point of view, why are you making it far more complicated than it needs to be?, there seems no reason to be using interrupts at all on such a simple program.
Sorry Eric, I have been fiddling. Doing other bits and pieces inbetween. The ASM attached now I have just tested and I will leave alone until I hear from you. I have never tried to assemble in with OSHON, I used MPLAB. I just test the .HEX file with the simulator.