Newb needs help with loop issues
I am sure that this will be completely easy for most of you but I haven't got a clue. I am writing code for use with a pic microcontroller and I am having problems with my while statements. My program uses hex values but it shouldn't be any different. I am assigning a char (pinout) to the port that I am recieving inputs from.
Here is my problem:
I need to read the port and hold the value to keep the while loop repeating until a different certain input is given through the port.
Here is some code, maybe seeing it will help more.
Code:
switch (pinout)
{
case 0x01:
message911();
break;
case 0x02:
urgent();
break;
case 0x04:
MoveL();
break;
case 0x08:
MoveR();
break;
}
This switch statement works and will run the correct void.
My problem is with the loop statement for the void.
Code:
void message911()
{
while((pinout == 0x00) || (pinout == 0x01))
{
.....
pinout = portD;
}
My problem is that "pinout' has to return to 0x00. "Pinout" is 0x01 for a milisecond. Just enough time to enter the void. After that it goes to 0x00 and remains there.
I need the loop to continue until "pinout" is 0x02, 0x04, or 0x08. Any suggestions would help alot. Also, this is my first post so no flaming, pls. :D