Give the instructions to set up port T to allow a dip switch to be hooked up, and
then
branch to the label SW1ON if the most significant bit is a zero in ASSEMBLY LANGUAGE (CODE WARRIOR)
Answer :- The steps and assembly code is written below-
DDRT = 0x00; make all pins as input
Read PTT register and check if MSB is zero then goto label
SW1ON
Note here that when switch is hooked up the pin is connecting to
ground through theswitch and hence we will get 0 on that pin (MSB
of port T).
The assembly code is written below-
LDAA #$00 ;register A = 0000_0000
STAA DDRT ;make port T pins as input pins
LDAA PTT ;read port T register and keep value in register A
ANDA #$80 ;get MSB of read value in register A
BEQ SW1ON ;goto label named as SW1ON if A value is zero
Get Answers For Free
Most questions answered within 1 hours.