Question: 8. (12 Points) Convert the following assembly language program to C/C++. Note that you do NOT need to specify in the C program the
8. (12 Points) Convert the following assembly language program to C/C++. Note that you do NOT need to specify in the C program the code memory locations for the MAIN (0x100) subroutine. .ORG 0 LDI R16, HIGH(RAMEND) OUT SPH, R16 LDI R16, LOW (RAMEND) OUT SPL, R16 SBI DDRB, 2 LDI R17, 0x00 LDI R16, 0x04 LDI R20, 0 OUT TCNTO, R20 LDI R20, 160 OUT OCRO, R20 MAIN: OUT PORTB, R17 RCALL DELAY EOR R17, R16 RJMP MAIN .ORG 0x100 DELAY: LDI R20, 0x09; OUT TCCRO, R20 AGAIN: IN R20, TIFR SBRS R20, OCF0; RJMP AGAIN; LDI R20, 0x00 OUT TCCRO, R20; LDI R20, 1
Step by Step Solution
There are 3 Steps involved in it
Part 1 Assembly to C Conversion Analyze the assembly code instructions and ... View full answer
Get step-by-step solutions from verified subject matter experts
