Hi Jessey,
Probably what you want to do is set up flags for each input and make them a bit in the PICs EEPROM. (By storing them in the PIC's EEPROM, you can restart your program pretty much where your left off.) For example, let's call your first switch Input0. We'll call the flag for this switch In0. The same setup would be used for the other switches. You can also set a flag for "new start" and "restart" and have a routine check for the status of this bit before continuing on with the program.
When your system is first setup, In0 will be set to 0. When the switch condition = 0 and the flag = 0 nothing would be done as it was already setup as normal. Now your loop that checks the inputs would "scan" all the switches. When there is a difference between Input(x) and Flag(x) your IF..Then sequence would select the appropriate subroutine to go to. If the current loop value (either 1 or 0) is the same as the flag, then nothing really needs to be done. If there is a change the program would then handle it, change the status flag and resume the normal program.
I do most of my programs like this and for me it works quite well.
HTH,
BobK
I know there must be several ways to handle this type of programming but I like to keep my programs real easy to follow. Maybe someone else will jump in here during the day an enlighten you AND ME! When I get off of work this evening I see if I can send you a sample of code that I used.
Bookmarks