Hello Leonel,,

just had a brain fart to take care of your blinky light...


Code:
Switching var byte;
  LightCount var Word
  Counter1 var word
  Counter2 Var word
  LightCount=0
  Loop:
  Counter1=0
  Counter2=0
  Loop2:
   if Counter1< 20
     if Counter2 <1000
     if switching=1 then Pause 1  'Pause 1/1000 of a second to make 20
     if switching=0 then Pause 2  'Pause 1/500 of a second to make 40

     LightCount=LightCount+1
     If LightCount=20000 then
       LightCount=0
       Blink light = on
       Pause 200  'pause 1/5 of a second to light up the light.
       Blink Light = off
     endif


     if Portb.0=1 then 
            turn on switch.
            goto Loop
      endif

      if Portb.1=1 then 
            turn on switch.
            goto Loop
      endif

      if Portb.2=1 then 
            turn on switch.
            goto Loop
      endif

      ....
      ....    (for each of your eight switches)


        Counter2=Counter2+1;
     Endif
     
     if(Counter2>=1000)
       Counter1=Counter1+1;
       counter2=0;
     endif
   endif
   if Counter1<20 goto Loop2

  Portb=0;  'turn off ALL of the switches!
  goto Loop:
I put a separate counter for the blinky... stuck the blinky in the routine so that it will be called all the time, removed it from the end of the routine and since you said it doesn't matter too much on the exact time.... well...

Dwayne