Q3 (20 points) A. What does this program do? Please be specific MYREG equ $1000
ID: 2291968 • Letter: Q
Question
Q3 (20 points) A. What does this program do? Please be specific MYREG equ $1000 #$00, DDRA PTA MYREQ movb ldaa VCC 4.7 HCS12 The code below shows a switch is connected to pin PB0 and an LED to pin PB7. The code gets the status of the switch and send it to the LED. When PB0 goes HIGH, i.e. the switch is open, the LED lights PB0 Switch PB7 270 LED Fill up the missing information. bclr bset brsetp bclr DDRB Make PB) an input DDRB : make PB7 an output BACK PTB OVER ; keep monitoring PB0 for HIGHH ???. ; Make PB7 LOW BACK OVER bset ??? ; Make PB7 HIGH bra BACKExplanation / Answer
Q 3 A.
Here PORT A is configured for input using movb #$00, DDRA instruction
Data is read into accumulator from port A using ldaa PTA instruction.
Accumulator Data is stored at location specified by "MYREQ" label using staa MYREQ instruction
Here MYREQ seems to be typo error instead of MYREG specified for memory location $1000.
Q 3B.
bclr DDRB, $) ; please check ). its should be a value between 0 to 7 instead of ). (typo error)
bset DDRB, $80
BACK brset PTB, $01, OVER
bclr PTB, $80
bra BACK
OVER bset PTB, $80
bra BACK
If " )" = 0, then bclr DDRB, $01
If " )" = 1, then bclr DDRB, $02
If " )" = 2, then bclr DDRB, $04
If " )" = 3, then bclr DDRB, $08
If " )" = 4, then bclr DDRB, $10
If " )" = 5, then bclr DDRB, $20
If " )" = 6, then bclr DDRB, $40
If " )" = 7, then bclr DDRB, $80
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.