Hi, can someone help point me in the right direction. I have a simple program that takes push button inputs and then sends them by IR led link to a receiver. It uses the printf function to drive the LED and the KBI on P0 for the p/button inputs.
The program compiles ok and the printf works if I do a printf("rtrt") just before entering the main loop where the program is supposed to sit until a KBI is detected. Problem is I cannot trigger the interrupt. Additionally, I get an L16 'unused code, ignored for . . . etc' message for the interrupt service routine. So, I think that the compiler or linker is not seeing the isr. I don't think its a hardware issue. I've checked wiring and voltage level changes on the P0 pins.
Any thoughts on this?
thanks
Jason
Long time since I worked with the 8051, but yes - the common way for processors to implement power save is that they sleep until a wakeup event. Then they perform the interrupt and then continue with the next instruction.
To continue to sleep, you would have to do something like:
for (;;) { sleep(); // sleep until interrupt or reset if (should_wake_up_permanently) break; if (have_a_command) { handle_command(); } }
Note that depending on processor architecture and debugging interface, JTAG dongles etc may not support sleep mode, so in some situations, you may have to conditionally remove the sleep command in debug builds, unless you just debug in the simulator.