Question: B 2 . 2 ) Write a macro called ADD 2 PORT that reads first value from an input port and the second value from

B2.2) Write a macro called ADD2PORT that reads first value from an input port and the second value from the
CSEG table and add the two values before displaying the output on the output port.
Usage example: ADD2PORT PINA, Z+, PORTC
.include "m32def.inc"
.cseg
.org 0x0000
rjmp init
.org 0x0060
table: .db 0x04,0x08,0x20,0x40,0x80,0x02
end_table:
.org 0x0080
init:
ldi ZL, low(table<<1)
ldi ZH, high(table<<1)
ldi R16,0xFF
out DDRC, R16
ldi R16,0x00
out DDRA, R16
read: ; call the macro ADDPORT
ADDPORT PINA, Z+, PORTC
rjmp read

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!