CATEGORII DOCUMENTE |
Aeronautica | Comunicatii | Electronica electricitate | Merceologie | Tehnica mecanica |
.
Simularea semaforizaii unei intersectii
Schema electrica a circuitului pentru simularea semaforizarii
LIST P=16f628
#include p16f628.inc
cblock 20h
COUNT1 ;First counter for our delay loops
COUNT2 ;Second counter for our delay loops
COUNT3
endc
org 0h
goto start
org 4h
retfie
delay
Loop1
decfsz COUNT1, 1 ;Subtract 1 from 255
goto Loop1 ;If COUNT is zero, carry on.
decfsz COUNT2,1 ;Subtract 1 from 255
goto Loop1 ;Go back to the start of our loop.
Loop2
decfsz COUNT1, 1 ;Subtract 1 from 255
goto Loop2 ;If COUNT is zero, carry on.
decfsz COUNT2,1 ;Subtract 1 from 255
goto Loop2 ;Go back to the start of our loop.
decfsz COUNT3,1
goto Loop1
return
start
bcf STATUS, RP1
bcf STATUS, RP0
clrf PORTA
clrf PORTB
movlw b'00000111'
movwf CMCON
bsf STATUS, RP0
movlw b'00000111'
movwf OPTION_REG
clrf TRISA
clrf TRISB
clrf OPTION_REG
bcf STATUS, RP0
movlw b'11111111'
movwf PORTA
movwf PORTB
clrf INTCON
bsf INTCON, GIE
; bsf INTCON, TOIE
movlw .12
movwf TMR0
clrf CONTOR
bucla
;st1
movlw b'01000101'
movwf PORTA
movlw b'00011010'
movwf PORTB
movlw .10
movwf COUNT3
call delay
;st2
movlw b'01001010'
movwf PORTA
movlw b'01001010'
movwf PORTB
movlw .5
movwf COUNT3
call delay
;st3
movlw b'00011010'
movwf PORTA
movlw b'10100101'
movwf PORTB
movlw .10
movwf COUNT3
call delay
;st4
movlw b'10001010'
movwf PORTA
movlw b'00101010'
movwf PORTB
movlw .5
movwf COUNT3
call delay
goto bucla
end
Tabel cu starile logice
Stari |
Port |
Biti |
|||||||
RA | |||||||||
RB |
|
||||||||
RA | |||||||||
RB | |||||||||
RA | |||||||||
RB | |||||||||
RA | |||||||||
RB |
Politica de confidentialitate | Termeni si conditii de utilizare |
Vizualizari: 1075
Importanta:
Termeni si conditii de utilizare | Contact
© SCRIGROUP 2024 . All rights reserved