MrDEB
Well-Known Member
good points Dr G
the switch is a 4 position switch pin 1 = Time1 pin 2 = ground pin 3 = Time2 pin 4 = Time3 pin 5 = ground pin 6 = Time 4
here is the code that I used to verify that I have a hardware issue and not a code issue. Is what is occurring is when the rotary switch is set on Time4, the position 4 (player4) led is enabled, the two green then two yellow leds are enabled in sequence. Then the Mst_led is enabled ,then the code jumps out of the loop and player10 led is enabled to indicate the sub has ended. In the Time1 _ Time 3 sequences the code does not jump out of the sub UNTIL the Master_swt is depressed.
the switch is a 4 position switch pin 1 = Time1 pin 2 = ground pin 3 = Time2 pin 4 = Time3 pin 5 = ground pin 6 = Time 4
here is the code that I used to verify that I have a hardware issue and not a code issue. Is what is occurring is when the rotary switch is set on Time4, the position 4 (player4) led is enabled, the two green then two yellow leds are enabled in sequence. Then the Mst_led is enabled ,then the code jumps out of the loop and player10 led is enabled to indicate the sub has ended. In the Time1 _ Time 3 sequences the code does not jump out of the sub UNTIL the Master_swt is depressed.
basic code
sub et_select()
REPEAT' master_swt=1
IF Time1=0 //port A.2
THEN Et_time=500
DELAYMS(500)
pLAYER1 = 1 //indicates switch position
Green1=0 //500ms time1
DELAYMS(Et_time) //5000ms time3
TOGGLE(Green1)
Green2=0 //500ms time1
DELAYMS(Et_time) //5000ms time3
TOGGLE(Green2)
Yellow1=0 //3500ms time1
DELAYMS(Et_time) //5000ms time3
TOGGLE(Yellow1)
Yellow2=0 //500ms time1
DELAYMS(Et_time) //5000ms time3
TOGGLE(Yellow2)
MST_LED = 1
DELAYMS(500)
TOGGLE(MST_LED)
DELAYMS(500)
pLAYER1 = 0
END IF
IF Time2=0 //port A.3
THEN Et_time=700
pLAYER2=1 //indicates switch position
Green1=0 //500ms time1
DELAYMS(Et_time) //5000ms time3
TOGGLE(Green1)
Green2=0 //500ms time1
DELAYMS(Et_time) //5000ms time3
TOGGLE(Green2)
Yellow1=0 //3500ms time1
DELAYMS(Et_time) //5000ms time3
TOGGLE(Yellow1)
Yellow2=0 //500ms time1
DELAYMS(Et_time) //5000ms time3
TOGGLE(Yellow2)
MST_LED = 1
DELAYMS(500)
TOGGLE(MST_LED)
DELAYMS(500)
pLAYER2 = 0 //turn off position led
END IF
IF Time3=0 //port A.4
THEN Et_time=1000
pLAYER3=1 //indicates switch position
Green1=0 //500ms time1
DELAYMS(Et_time) //5000ms time3
TOGGLE(Green1)
Green2=0 //500ms time1
DELAYMS(Et_time) //5000ms time3
TOGGLE(Green2)
Yellow1=0 //3500ms time1
DELAYMS(Et_time) //5000ms time3
TOGGLE(Yellow1)
Yellow2=0 //500ms time1
DELAYMS(Et_time) //5000ms time3
TOGGLE(Yellow2)
MST_LED = 1
DELAYMS(500)
TOGGLE(MST_LED)
DELAYMS(500)
pLAYER3 = 0
END IF
IF Time4=0 //port A.4
THEN Et_time=1000
pLAYER4=1 //indicates switch position
Green1=0 //500ms time1
DELAYMS(Et_time) //5000ms time3
TOGGLE(Green1)
Green2=0 //500ms time1
DELAYMS(Et_time) //5000ms time3
TOGGLE(Green2)
Yellow1=0 //3500ms time1
DELAYMS(Et_time) //5000ms time3
TOGGLE(Yellow1)
Yellow2=0 //500ms time1
DELAYMS(Et_time) //5000ms time3
TOGGLE(Yellow2)
MST_LED = 1
DELAYMS(500)
TOGGLE(MST_LED)
DELAYMS(500)
pLAYER4 = 0
END IF
' MST_LED = 0
'DELAYMS(1500)
UNTIL Master_Swt=0 delayms(500) //exit routine
end sub
WHILE TRUE
et_select()
for x = 0 to 5
player10=1
delayms(1000)
toggle(player10)
delayms(500)
next
wend
[end/QUOTE]