Hello Leonel,
I am going to assume what I posted was correct...Here is some code to look at...Using my code, I added just a few things to allow for all your switches.
Code:
Switching var byte;
Counter1 var word
Counter2 Var word
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
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!
Blink light = on
Pause 200 'pause 1/5 of a second to light up the light.
Blink Light = off
goto Loop:
The above code will take care of your switches, but the problem comes with your Blinky light every 20 seconds. If a person keeps pressing switches, your light will not blink every 20 seconds. Thus some kind of internal timer is needed to take care of your blinky to have it blink every 20 seconds.
Dwayne
Ability to Fly:
Hurling yourself towards the ground, and missing.
Engineers that Contribute to flying:
Both optimists and pessimists contribute to the society. The optimist invents the aeroplane, the pessimist the parachute
Pilots that are Flying:
Those who know their limitations, and respect the green side of the grass...
Bookmarks