Quote Originally Posted by sayzer
That is what I meant.

For example:

Code:
While PORTB.0 = 0 
  do a kind of loop here...
wend

While PORTA.0 = 1
  do another kind of loop here...
wend

These two while statements can not execute et the same time.

---------------
True... because of the way the program is written it will repeatedly service the PortB loop until such time as PORTB.0 = 1

If you want BOTH loops to be serviced then there is a way of doing that. Admittedly they wont be serviced simultaneously but each will be repeatedly serviced

Code:
ExampleLoop:

If PORTB.0 = 0 then
  do a kind of loop here...
Endif

If PORTA.0 = 1
  do another kind of loop here...
Endif

Goto ExampleLoop
I have a project where a PIC is decoding IR signals and also receiving short commands over a serial port. The main loop is basically

Code:
Main:
Gosub CheckForIR
Gosub CheckForSerial
Goto Main
The IR check takes the most time but that is the main activity that the PIC has to do. Serial data is received by the USART so will buffer upto two characters. Servicing the Serial data normally takes only 1ms so that it returns more or less immediately unless serial data is received at which point it waits in the serial loop a bit longer to receive any extra data as that now becomes the priority.

Its not true multi tasking but everything does get done OK