Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

For PIC 1 6 F 6 2 8 A a ) There are two traffic lights in the Proteus file and they have red, yellow

For PIC16F628A
a) There are two traffic lights in the Proteus file and they have red, yellow and green LEDs. Among these LEDs, the ones for the vehicle are placed on the 0th,1st and 2nd pins of PORTB, respectively; The ones for the pedestrian are connected to the 3rd,4th and 5th pins, respectively. While the time allowed for traffic on the road to pass is 10 seconds, the time allowed for pedestrians to pass is 3 seconds. The duration of the yellow light that will turn on when switching from red to green and from green to red is 1 second.
b) There is also a button for pedestrians. While the green light is on for vehicles and the red light is on for pedestrians, when pedestrians press this button, vehicle traffic will stop and it will turn green for pedestrians and red for vehicles.
I can't set the delay time in item a and I couldn't do item b.
My codes :
LIST P=16F628A
INCLUDE "P16F628A.INC"
__CONFIG _INTRC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_ON & _MCLRE_ON & _BODEN_OFF & _LVP_OFF & _CP_OFF
;-----------------------------------------------------------
SAYAC1 EQU h'20'
SAYAC2 EQU h'21'
DALLAN EQU h'22'
BL EQU h'23'
ORG h'00' ;Program kodlarnn balangc
BANKSEL TRISB ;BANK1'e ge
CLRF TRISB ;PortB'nin tm ulark
MOVLW H'FF' ;W - h'FF'
MOVWF TRISA ;PortA'nn tm ular giri
BANKSEL PORTB ;BANK0'a ge
MOVLW h'07' ;W saklaycya b00000111 ykle
MOVWF CMCON ;PORTA girileri dijital I/O
CLRF PORTB ;PortB'yi sfrla
BASLA
MOVLW h'00' ;b'00000000' saysn W'ye ykle
MOVWF DALLAN ;DALLAN = W
DONGU
MOVF DALLAN, W ;W = DALLAN
ANDLW B'00001111' ;W'nin st drt bitini sfrla
CALL CEV7SEG ;Kod evirme alt programnar.
MOVWF PORTB ;Kodu 7 segment displayde gster
INCF DALLAN, F ;DALLAN = DALLAN +1
MOVF DALLAN, W ;
MOVWF BL ;
MOVLW h'F' ; W saklaycsna 0 ykle
SUBWF DALLAN, f ; W=BL-W
BTFSC STATUS, Z ; ZERO BACAI 0SE ATLA
GOTO BASLA ; DONGU 2YE GT
MOVF BL, W ;
MOVWF DALLAN ;
CALL GECIKME ;Gecikme yap
BTFSS PORTA,0 ;PortA'nn 0. bit'i 0 m?
CALL YAYA
GOTO DONGU ;Yeni bir say iin baa dn.
YAYA
MOVLW h'09' ;b'00000000' saysn W'ye ykle
MOVWF DALLAN ;DALLAN = W
CEV7SEG
ADDWF PCL,F ;PCL=PCL+W(DALLAN)
RETLW h'21' ;0
RETLW h'21' ;1
RETLW h'21' ;2
RETLW h'21' ;3
RETLW h'21' ;4
RETLW h'21' ;5
RETLW h'21' ;6
RETLW h'21' ;7
RETLW h'21' ;8
RETLW h'12' ;9
RETLW h'0C' ;A
RETLW h'0C' ;b
RETLW h'0C' ;C
RETLW h'12' ;d
RETLW h'00' ;E
RETLW h'00' ;F
GECIKME ;Gecikme alt program
MOVLW h'FF'
MOVWF SAYAC1
DONGU1
MOVLW h'FF'
MOVWF SAYAC2
DONGU2
DECFSZ SAYAC2, F
GOTO DONGU2
DECFSZ SAYAC1, F
GOTO DONGU1
RETURN
END
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions