; before you proceed with the delay time, make sure you have modified reg9s12.h for TSCR2 #include C:\Users\ayomi\Desktop\dragon\3dlab\REG9S12.h org $2000 movb #$07,ddrb ; setting chs.0-2 as output pins loop movb #$01,portb ; green LED for 3 seconds (Ch.0) ldx #300 jsr delay movb #$02,portb ; yellow LED for 1 second (Ch.1) ldx #100 jsr delay movb #$04,portb ; red LED for 3 seconds (Ch.2) ldx #300 jsr delay bra loop ; branch back to label loop swi ; the following routine provides 10 ms delay delay movb #$90,TSCR1 ; enable TCNT and fast flags clear movb #$06,TSCR2 ; configure prescale factor to 64 movb #$01,TIOS ; enable OC0 ldd TCNT addd #3750 ; start OC operation std TC0 ; with 10ms time delay brclr TFLG1,$01,* ; if equal, C0F in TFLG1 is set to 1 dbne x,delay rts
Use the Assembly code below and a dragon 12 jr to create a traffic light take a screenshot of the dragon 12 running show connection slots and code
; before you proceed with the delay time, make sure you have modified reg9s12.h for TSCR2
#include C:\Users\ayomi\Desktop\dragon\3dlab\REG9S12.h
org $2000
movb #$07,ddrb ; setting chs.0-2 as output pins
loop movb #$01,portb ; green LED for 3 seconds (Ch.0)
ldx #300
jsr delay
movb #$02,portb ; yellow LED for 1 second (Ch.1)
ldx #100
jsr delay
movb #$04,portb ; red LED for 3 seconds (Ch.2)
ldx #300
jsr delay
bra loop ; branch back to label loop
swi
; the following routine provides 10 ms delay
delay movb #$90,TSCR1 ; enable TCNT and fast flags clear
movb #$06,TSCR2 ; configure prescale factor to 64
movb #$01,TIOS ; enable OC0
ldd TCNT
addd #3750 ; start OC operation
std TC0 ; with 10ms time delay
brclr TFLG1,$01,* ; if equal, C0F in TFLG1 is set to 1
dbne x,delay
rts
![](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F5ecf1484-f95f-4119-9858-43c8382b92c0%2Fea6bd7e6-b657-4298-869e-67f1ab6f548d%2Ftc4nz2_processed.jpeg&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Trending now
This is a popular solution!
Step by step
Solved in 2 steps
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
![Concepts of Database Management](https://www.bartleby.com/isbn_cover_images/9781337093422/9781337093422_smallCoverImage.gif)
![Prelude to Programming](https://www.bartleby.com/isbn_cover_images/9780133750423/9780133750423_smallCoverImage.jpg)
![Sc Business Data Communications and Networking, T…](https://www.bartleby.com/isbn_cover_images/9781119368830/9781119368830_smallCoverImage.gif)