Tool/software: Code Composer Studio
The code below sets up a traffic light, starting at green for 10 secs, then to yellow(green and red together) for 5 seconds and lastly red for 5 seconds. I would like to implement a button interrupt into the code to be recognized once every minute and act as a crosswalk indicator. The button once pushed will delay 1 second then go to the yellow light (green and red together) and proceed from there.
Any help is appreciated.
;Clock/Timer
clr.b &DCOCTL
mov.b &CALBC1_1MHZ, &BCSCTL1
or.w #DIVA_2, &BCSCTL1
mov.b #DCO0+DCO1, &DCOCTL
mov.b #LFXT1S_2, &BCSCTL3
mov.w #TASSEL_1 + MC_0 + TACLR + ID_3 + TAIE, &TA0CTL
mov.w #TASSEL_1 + MC_0 + TACLR + ID_3 + TAIE, &TA1CTL ; ACLK, Stopped, CLEAR TAR
mov.w #CCIE, &TA0CCTL0 ; CCR0 interrupt enabled
mov.w #9375, &TA0CCR0 ;
mov.w #CCIE, &TA0CCTL1 ; CCR0 interrupt enabled
mov.w #3750, &TA0CCR1
mov.w #CCIE, &TA0CCTL2
mov.w #5625, &TA0CCR2
;I/O
clr.b &P1OUT
mov.b #0xFF, &P1DIR
bic.b #BIT3, &P1DIR
bis.b #BIT3, &P1OUT
bis.b #BIT3, &P1IN
bis.b #BIT3, &P1REN
bis.b #BIT6, &P1OUT
or.w #MC_1, &TA0CTL
mov.w #GIE+LPM3, SR ;goto LPM enable interrupts
jump jmp jump
TIMERA0_ISR:
xor.b #BIT0, &P1OUT
xor.b #BIT6, &P1OUT
reti
TIMERA01_ISR:
add.w &TA0IV, PC
reti
jmp yellow
jmp red
reti
reti
reti
yellow:
bis.b #BIT0, &P1OUT
reti
red:
xor.b #BIT6, &P1OUT
reti
loop: ;Polling Loop
bit.b #BIT3, &P1IN
jz WALK
bic.b #BIT3, &P1OUT
WALK:
bit.b #BIT3, &P1IN
jnz loop
bis.b #BIT6, &P1OUT
jmp loop