Hello,
I need help building the actual circuit on my breadboard for this project. The following is my code:
My design should meet the following:
The order of lights should be East-West Green (8 seconds), Green Arrow (6
seconds, flashing 2 times per second, 50% duty cycle), Yellow (4 seconds),
and then Red. The North-South lights should follow in the appropriate
sequence with the same timing parameters.
Can anyone please help me with actually building the circuit please?
I need help building the actual circuit on my breadboard for this project. The following is my code:
Rich (BB code):
list p=12F609 ; list directive to define processor
#include <p12F609.inc> ; processor specific
__CONFIG _MCLRE_ON & _CP_OFF & _WDT_OFF & _INTOSCIO &_IOSCFS_4MHZ
; _MCLRE_ON enables external Reset
; _CP_OFF turns off "Code Protection"
; _WDT_OFF disables the Watchdog Timer
; _INTOSCIO selects the internal RC oscillator as the time base
; Variable Definitions
UDATA ; Beginning of Uninitialized Data
dc1 RES 1 ; delay loop counter
dc2 RES 1 ; delay loop counter
dc3 RES 1
; Code section
RESET CODE 0x000 ; Processor resets to start of program memory
; MAIN
start
banksel TRISIO;
movlw b'001000';
movwf TRISIO; Setting GP0, GP1, GP2, GP4 and GP5 as inputs
lights_cycle
banksel GPIO;
movlw b'100001';
movwf GPIO; GNS, REW ON (Figure3)
call delay; 2s
call delay; 2s
call delay; 2s
call delay; 2s
banksel GPIO;
movlw b'100011';
movwf GPIO; GaNS, REW ON (Figure4)
call delay; 2s
call delay; 2s
call delay; 2s
banksel GPIO;
movlw b'100111';
movwf GPIO; YNS, REW ON (Figure5)
call delay; 2s
call delay; 2s
;4s delay
banksel GPIO;
movlw b'010110';
movwf GPIO; GEW, RNS ON (Figure6)
call delay; 2s
call delay; 2s
call delay; 2s
call delay; 2s
banksel GPIO;
movlw b'010100';
movwf GPIO; GaEW, RNS ON (Figure7)
call delay; 2s
call delay; 2s
call delay; 2s
banksel GPIO;
movlw b'010000';
movwf GPIO; YEW, RNS ON (Figure8)
call delay; 2s
call delay; 2s
goto lights_cycle
delay
movlw .100;
movwf dc1;
movlw .200;
movwf dc2;
movlw .07;
movwf dc3;
dly1 nop ;
decfsz dc1,f;
goto dly1;
decfsz dc2,f;
goto dly1;
decfsz dc3,f;
goto dly1;
return
END
The order of lights should be East-West Green (8 seconds), Green Arrow (6
seconds, flashing 2 times per second, 50% duty cycle), Yellow (4 seconds),
and then Red. The North-South lights should follow in the appropriate
sequence with the same timing parameters.
Can anyone please help me with actually building the circuit please?
Last edited by a moderator: