Write an HCS12 assembly language program for a system with an 8-bit switch and 1
ID: 3534403 • Letter: W
Question
Write an HCS12 assembly language program for a system with an 8-bit switch and 10 LEDs. The switches are connected to PORTB and eight of the LEDs are connected to PORTA and 2 to PORTC.
The first 3 switches are the first number. The 3 middle switches are the second number and the last two switches are the operation we are performing.
Assume 00 is add, 01 is subtract, 10 is multiply and 11 is ANDing the two numbers.
Your program must read the 8 bit value and decide what the first and second numbers is and perform the corresponding operation based on the values of the last two switches.
The result must be sent to PORTA. The operation must be sent to PORTC.
Explanation / Answer
In an assembly language project, data and the stack must be explicitly forced into RAM
and program code into flash memory via origin (ORG) assembler directives, as shown in
Example 1. Note that the four labels RAMStart, RAMend, ROM_4000Start, and
ROM_4000End are defined in the INCLUDE file
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.