Question: Design an automaic traffic light. When the traffic light does not detect a vehicle (using infrared transceiver), the traffic light (RGB LED) will continuously display

Design an automaic traffic light. When the traffic light does not detect a vehicle (using infrared transceiver), the traffic light (RGB LED) will continuously display RED.When a vehicle is detected, the traffic light will blink RED 3 times. before turning to GREEN. By the time it is GREEN, the 7segment DSP1 and DSP2 will display '10' and counting down each second. By the time the counting reaches 5, the traffic light turns form GREEN to YELLOW. The YELLOW will blinks each second until the count reaches 0 and turns RED.

#include "c:\miniide\hcs12.inc"

org $2000

movb #$FF, DDRP

bset PTP, $20

bset DDRB, 000011

bset DDRT, 010000

bclr DDRT, 001000

bclr PTT, 010000

loop brclr PTT, 001000,yes ;Detect car, go to yes. If not execute

; istruction below

bset PTP, $20 ;Red light ON

bra loop ;Loop

yes bclr PTP, $20 ;Red light OFF

ldy #500

jsr delayby1ms ;delay 0.5 second

bset PTP, $20 ;Red light ON

ldy #500

jsr delayby1ms ;delay 0.5 second

bclr PTP, $20 ;Red light OFF

ldy #500

jsr delayby1ms ;delay 0.5 second

bset PTP, $20 ;Red light ON

ldy #500

jsr delayby1ms ;delay 0.5 second

bclr PTP, $20 ;Red light OFF

ldy #500

jsr delayby1ms ;delay 0.5 second

bset PTP, $20 ;Red light ON

ldy #500

jsr delayby1ms ;delay 0.5 second

bclr PTP, $20 ;Red light OFF

bset PTP, $40 ;Green light ON

ldaa #1

movb #$FF, DDRB ;Configure Port B pins as output

movb #$F7, DDRP ;Configure Port P pins (PP7,PP6,PP5,

;PP4,PP2,PP1 and PP0) as output

ldx #disp1

seg movb 1,x+,ptb

movb 1,x+,ptp

ldy #10

jsr delayby100ms

cpx #disp1+8

bne seg

ldx #disp2

seg2 movb 1, x+,ptb

movb 1, x+,ptp

ldy #500

jsr delayby1ms

cpx #disp2+20

bne seg2

lbra loop ;End program. Using long loop.

; Go to the loop label

disp1 dc.b $67, $47

dc.b $7F, $47

dc.b $07, $47

dc.b $7D, $47

bne seg2

disp2 dc.b $6D,$67

dc.b $6D,$07

dc.b $66,$67

dc.b $66,$07

dc.b $4F,$67

dc.b $4F,$07

dc.b $5B,$67

dc.b $5B,$07

dc.b $06,$67

dc.b $3F,$27

#include "c:\miniide\delay.asm"

end

This is the code by MiniIDE software? using Dragon 12 board?. I need the code by codewarrior in c language? or assembly language that do the same thing with dragon 12 plus board. Thank you !

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!