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

Use the following I/O port arrangement for problems 4 through 7: Assign the valu

ID: 3673354 • Letter: U

Question

Use the following I/O port arrangement for problems 4 through 7: Assign the value for the appropriate Data Direction Register in hex: Write one line of code using bit packing to turn on LED0 & 3, turn off LED1 & 2 without affecting the switches: Write some code that tests whether the switch on bit0 and bit6 is OPEN regardless of the state of the other two switches. If this is so, then LED3 must turn on. When writing assembly code, why is it always better practice to do "A" below vs. "B", even though they will both work flawlessly and have the same result?

Explanation / Answer

IO port arrangement

Input voltage: + 5 volts

switches: 4 switches

ports 0 to 7

Light Emitting Diodes: LED 0 to 3

Resistors: 4

11. Data Direction Register values in hex:

DDR:                        Value: PODDRH, PODDRL

12.

Binary bit combination for turning on LED 0 and 3:

1001

Binary bit combination for turning off LED 1 and 2:

1001

13.

LDAA #%10110001011

STAA DDRA

LDAB PORTA

14. The code in A is better than B due to the following reasons:

in code, A, we first load accumulator register with the contents 01011100

then store it to the register

then load the port A

but the sequences are not optimal in B hence A is better

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