Build-A-Burger
Full Member level 1
- Joined
- Oct 27, 2010
- Messages
- 95
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,286
- Location
- Wyoming
- Activity points
- 2,102
I've got a program I've been pulling my hair out over the last couple days. I've got 2 interrupts: one uses timer2 to turn some lights on and off on PORTD. The other interrupt is the serial port which has buffers, error-handling, etc. They seem to both work OK. The problem is I'm using a state table in the main loop to call several functions when a certain key is pressed on the serial terminal. (Putty.exe) I can call a function in the other modules (timer.asm and serial.asm) and pass the param in the W register and it works fine. But for some reason, the W register never changes when I call a function from one of the state table functions. I've stepped thru it using the debugger from MPLAB (MPLAB sim only) and looked at the dissassembly code. The state table only modifies the PCL register but checks to see if the PCLATH is needed but I'm not going out of the first 2k code boundary so I could easily take that part of the code out as long as the code executes within the same 2k boundary and the PCL doesn't increment over FF. I've even tried setting a global variable declaring it Global in the other module and extern in the main.asm. I have all the code up on my website at **broken link removed**
The main loop is in testnewstuff.asm
the serial functions and ISR are in testnewstuff_serial.asm
the timer functions and ISR are in testnewstuff_timer.asm
The main loop is in testnewstuff.asm
the serial functions and ISR are in testnewstuff_serial.asm
the timer functions and ISR are in testnewstuff_timer.asm