' {$STAMP BS2} ' *************************************************** ' * * ' * PROGRAM:TrfContl.bs2 * ' * * ' * AUTHOR:J.C. Jones * ' * * ' * DATE:June 1, 2005 * ' * * ' * DESCRIPTION: Simulating a traffic control * ' * system. * ' * * ' *************************************************** ' ' ******************************************** ' * declare variables * ' ******************************************** blink var nib bws var byte ' ******************************************** ' * set input & outputs * ' ******************************************** output 4 'blue led output 5 ' main red led output 6 ' main yel led output 7 ' main grn led output 8 ' side red led output 9 ' side yel led output 10 'side grn led input 11 ' trip switch for side traffic ' ********************************************* ' * start function, run through the leds * ' ********************************************* start: for blink = 4 to 10 high blink pause 1500 low blink next high 7 ' make main green high 8 ' make side red ' ********************************************** ' * norm function, leds set for main grn * ' * keep checking for switch closure * ' ********************************************** norm: button 11,0,255,250,bws,0,norm ' *********************************************** ' * sidelight function, cycle side street light * ' * to grn, main to red * ' *********************************************** sidelight: ' *********************************************** ' * until loading is changed can't use activity * ' * light as part of timer action * ' * start 15 sec timer and show activity led * ' * for blink = 1 to 15 * ' * low 4 * ' * pause 500 * ' * high 4 * ' * pause 500 * ' * next * ' *********************************************** pause 15000 'main goes to yellow for 5 seconds low 7 high 6 pause 5000 low 6 high 5 low 8 high 10 low 7 low 8 pause 5000 goto start ' ********************************************** ' * function: stopaction * ' * bring all led's to low,by making all * ' * pins inputs, stop program * ' * at present, program never goes to * ' * stopaction * ' ********************************************** stopaction: DIRS = %0000000000000000 END