hi to every1 !!
i hav a task : make a program on assembler , simulating traffic lights in two directions , with two versions: 1) with software's control timer using TMR0 ; 2) with interrupt of TMR0 .
the first part of this task is totally completed ( except circuit of algorithm ) and no problem with this , so every switching of lights is controlled fully by timer 0 . okay . but now i am stuck by hours with second part . since it is a quite stupid idea to to force a chip to count digits with counters with BTFSS/BTFSC in macro ( due to power consumption 4 example ) , is there any way to use the first part of task to perform the second part of task ? maybe any other way ?
interrupt should be whatever me wish , 4 example "by appearing of 0 on PORTA,4 ( by switching ON SA4 ) , start interrupt and make yellow colour blinks for some time then go back to main loop "
i have tried and its ( maybe ) impossible cause tmr0 controls the changes of lights in the same time ! !
please , any opinions or ideas are welcomed !
i hav a task : make a program on assembler , simulating traffic lights in two directions , with two versions: 1) with software's control timer using TMR0 ; 2) with interrupt of TMR0 .
the first part of this task is totally completed ( except circuit of algorithm ) and no problem with this , so every switching of lights is controlled fully by timer 0 . okay . but now i am stuck by hours with second part . since it is a quite stupid idea to to force a chip to count digits with counters with BTFSS/BTFSC in macro ( due to power consumption 4 example ) , is there any way to use the first part of task to perform the second part of task ? maybe any other way ?
interrupt should be whatever me wish , 4 example "by appearing of 0 on PORTA,4 ( by switching ON SA4 ) , start interrupt and make yellow colour blinks for some time then go back to main loop "
i have tried and its ( maybe ) impossible cause tmr0 controls the changes of lights in the same time ! !
please , any opinions or ideas are welcomed !

Code:
list p=16f628
#include <p16f628.inc>
__config _CP_OFF & _WDT_OFF & _BODEN_ON & _PWRTE_ON & _INTRC_OSC_NOCLKOUT & _MCLRE_OFF & _LVP_OFF
cblock 0x22
counter_1
counter_2
endc
;================== beginprogram ==================
org 0x00
clrf PORTB
bcf STATUS,RP1
bsf STATUS,RP0
movlw b'11000000'
movwf TRISB
bcf STATUS,RP0
banksel OPTION_REG
movlw b'11010111'
movwf OPTION_REG ;prescaler — 1:256
banksel TMR0
movlw .0
movwf TMR0 ;unset tmr
main_loop
bsf PORTB,4
bsf PORTB,1
bcf PORTB,2
bcf PORTB,3
bcf PORTB,0
movlw .92
movwf counter_1
loop_1
call delay
decfsz counter_1,f
goto loop_1
movlw .4
movwf counter_2
loop_2
bcf PORTB,4
movlw .8
movwf counter_1
loop_3
call delay
decfsz counter_1,f
goto loop_3
bsf PORTB,4
movlw .8
movwf counter_1
loop_4
call delay
decfsz counter_1,f
goto loop_4
decfsz counter_2,f
goto loop_2
bsf PORTB,2
bsf PORTB,3
bcf PORTB,4
movlw .31
movwf counter_1
loop_5
call delay
decfsz counter_1,f
goto loop_5
bsf PORTB,0
bsf PORTB,5
bcf PORTB,2
bcf PORTB,3
bcf PORTB,1
movlw .92
movwf counter_1
loop_6
call delay
decfsz counter_1,f
goto loop_6
movlw .4
movwf counter_2
loop_7
bcf PORTB,5
movlw .8
movwf counter_1
loop_8
call delay
decfsz counter_1,f
goto loop_8
bsf PORTB,5
movlw .8
movwf counter_1
loop_9
call delay
decfsz counter_1,f
goto loop_9
decfsz counter_2,f
goto loop_7
bsf PORTB,2
bsf PORTB,3
bcf PORTB,5
movlw .31
movwf counter_1
loop_10
call delay
decfsz counter_1,f
goto loop_10
goto main_loop
;********* subroutine *********
delay
btfss INTCON,T0IF
goto delay
bcf INTCON,T0IF
banksel TMR0
movlw .0
movwf TMR0
return
;********* subroutineend *********
end
;================== end ==================