Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

it can be finished without running the code 1. The flashing LEDs in Part 1 go too fast. The reason is that this micro runs

it can be finished without running the code

image text in transcribedimage text in transcribed

1. The flashing LEDs in Part 1 go too fast. The reason is that this micro runs not at 1 but at 24 MHz; hence the single-loop delay is not long enough. Modify the delay routine to use nested loops to allow a longer delay. Use accumulator B to control an outer loop (you can use the 500-ms delay sub in Lab 1 as a reference). Use the inner loop as given in Part 1 with the X value of 40000. Write the Delay loop to make a 1 second delay. What value has to be in B to make a 1 second delay? Assemble, download and run the program. Make sure the patterns change once a second. Demonstrate program operation to the teacher. 2. It is possible to use your nested delay loop to make even longer delays. What is the maximum value you can place in accumulator B? Calculate the maximum delay possible with the maximum value only loaded into the B register (X loaded with 40000). Calculate the maximum delay possible with the maximum values loaded into registers X and B. i i File name: Lab5-a.asm This program outputs two alternating patterns to the LEDs connected to Port H. i STACK: REGBLK: equ equ $3000 $0000 pth: ddrh: equ equ $260 $262 port H data register ;port H direction register: ; O means input, 1 means output Pattern: Pattern2: equ equ $55 SAA start: ; initialize stack ; initialize X to point to registers ; make port H pins output org lds 1dx ldaa staa ldaa staa bsr ldaa staa bsr bra swi $2000 #STACK #REGBLK #SFF ddrh,x #Patterni pth, x Delay #Pattern2 pth, x Delay start i ; Delay - a simple delay subroutine opt Delay: #SFFFF loop: PSHX LDX NOP NOP NOP DEX BNE PULX RTS loop end 1. The flashing LEDs in Part 1 go too fast. The reason is that this micro runs not at 1 but at 24 MHz; hence the single-loop delay is not long enough. Modify the delay routine to use nested loops to allow a longer delay. Use accumulator B to control an outer loop (you can use the 500-ms delay sub in Lab 1 as a reference). Use the inner loop as given in Part 1 with the X value of 40000. Write the Delay loop to make a 1 second delay. What value has to be in B to make a 1 second delay? Assemble, download and run the program. Make sure the patterns change once a second. Demonstrate program operation to the teacher. 2. It is possible to use your nested delay loop to make even longer delays. What is the maximum value you can place in accumulator B? Calculate the maximum delay possible with the maximum value only loaded into the B register (X loaded with 40000). Calculate the maximum delay possible with the maximum values loaded into registers X and B. i i File name: Lab5-a.asm This program outputs two alternating patterns to the LEDs connected to Port H. i STACK: REGBLK: equ equ $3000 $0000 pth: ddrh: equ equ $260 $262 port H data register ;port H direction register: ; O means input, 1 means output Pattern: Pattern2: equ equ $55 SAA start: ; initialize stack ; initialize X to point to registers ; make port H pins output org lds 1dx ldaa staa ldaa staa bsr ldaa staa bsr bra swi $2000 #STACK #REGBLK #SFF ddrh,x #Patterni pth, x Delay #Pattern2 pth, x Delay start i ; Delay - a simple delay subroutine opt Delay: #SFFFF loop: PSHX LDX NOP NOP NOP DEX BNE PULX RTS loop end

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

Recommended Textbook for

Systems Analysis And Synthesis Bridging Computer Science And Information Technology

Authors: Barry Dwyer

1st Edition

0128054492, 9780128054499

More Books

Students also viewed these Databases questions