Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

From this information, your starship’s warp drive is controlledbyanHCS12microcon

ID: 3848598 • Letter: F

Question

From this information, your starship’s warp drive is controlledbyanHCS12microcontroller.Themicrocontroller sensesyour velocity through space bymeasuring the apparent Lorenz contraction of nearby objects.The speed sensor is attached to Port A and produces a byte whose value is related to the speed according to the following table:

Write a code fragment starting at address $4000 that does the following:

a)Setaside$1000bytesstartingataddress$1000tologthespeedunderthelabel “speed”

b)Storethetableabovestartingataddress$5000 (use DC.B directives)

c)ReadtheinputbyteatPortA,storethecorrespondingspeed(i.e.,the correspondingelementintherightcolumninthetable)sequentiallystartingat address$1000,anddisplaythecurrentspeedontheLEDsattachedtoPortBin binary

d)Repeatthefirstthreestepscontinuously(Don’tworryaboutwritingsomuchdata tothememorythatitoverwritesyourcode—yourtripwon’tbethatlong.)

Ports A and B are at addresses $00 and $01, respectively. DDRA and DDRB are at $02 and

$03, respectively. It’s OK to use either the addresses or names in your code. (I use names.)

Note that you just need to write the code; you don’t need to demonstrate it on the Dragon12 board. If you wish you can add a page after this one for your code.

Input (port A) Speed (%c) 9 10 100 99 98 95 92 87 80 71 60 44

Explanation / Answer

LDI R16, 00001000 OUT DDRB, R16 ; Configure PortA as an Input port LDI R16, 11000000 ; store a value $5000 OUT DDRC, R16 ; Configure Portb as an Output port rep: IN R16, PINB ; Read the values on the pins of PortA ; and store in R16 OUT PORTB, R16 ; Write the value in R16 to the pins ; of Portb RJMP rep

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at drjack9650@gmail.com
Chat Now And Get Quote