Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Instant Reference

Authors: Gruber, Martin Gruber

2nd Edition

0782125395, 9780782125399

More Books

Students also viewed these Databases questions

Question

=+C&B (especially taxation) laws, regulations, and practices?

Answered: 1 week ago