I have been using MPLAB to write code in asm to control the speed and direction of a small electric motor. I wish to use 4 buttons for forward, reverse, halt and emergency stop. There is a wireless link between the hand held controller and the motor. I have produced code to generate a pwm signal for the motor, which works, but my problem is that I need to detect when a button has been pressed. In other words I need to use an interrupt, but am not really sure how to use the interrupt.
The program is likely to spend most of its time in the pwm sub-routine. An interrupt will jump me into the ISR, but what should I do when I get there, and how do I cancel the pwm sub-routine RETURN. In the ISR I assume I need to check which button has been pressed, but what about that sub-routine RETURN. How do I get rid of that.
I have been using a 16F630. Should I use something like a 16F785 which contains a pwm generator, and so avoid the need to write pwm code.
Thanks in advance for any help.
Eddie Price