Question: MICROCHIP STUDIO CODE Write a program that performs a calculation on word and byte arrays. Based on the first letter of your last name, you

MICROCHIP STUDIO CODE
Write a program that performs a calculation on word and byte arrays. Based on the first letter of your last name, you must implement one of the following formulas:
R = W + B + 32
where W is an element of the word array, B is an element of byte, and R is an element of the result array.
 MICROCHIP STUDIO CODE Write a program that performs a calculation on
word and byte arrays. Based on the first letter of your last

This lab covers the various addition and subtraction operation in AVR assembly Example 1: Add/Subtract Bytes and Constants Example 2: Add/Subtract Bytes CSEGLDIZh,HIGH(val1*2)LDIZ1,LON(val1*2)LPMR16,ZSUBIR16,-K;SUBIR16,KLDIXh,HIGH(result)LDIX1,LON(result)STX,R16CSEGLDIZh,HIGH(val1*2)LDIZ1,LOW(val1*2)LPMR1,ZLDIZh,HIGH(va122)LDIZ1,LOW(val2*2)LPMR2,ZADOR1,R2;SUBR1,R2 Loop: RJMP Loop val1:. DB 123 LDI Xh, HIGH(result) , EQU K=45 LDI X1, LOW(result) ST X,R1 Example 3: Add/Subtract Words and Constants Example 4: Add/Subtract Words LDI Ch,HIGH(va112) .CSEG LDI Zh, HIGH(val1*2) LDI Zl, LON(val1*2) LDI Z1, LOW(val1*2) LPM R24, Z+ LPM R1,Z+ LPM R2S, z LPM R2, Z ADIW R25:R24, K ;SBIW R25:R24, k LDI 2h, HIGH(va12*2) LDI Z1, LOW(val2*2) LPM R3, Z+ LPM R4, Z LDI Xh, HIGH(result) LDI XI, LOW(result) ST x+,R24 ADO R1, R3 ; SUB R1, R3 ST x,R25 ADCR2,R4;SBCR2,R4 Loop: RJMP Loop LDI Xh, HIGH(result) LDI xI, LOW(result) va11: .DW 12345 ST X+,R1 . EQU K=45 ST X,R2 Example 5: Add an Array of Bytes Example 6: Add an Array of Words .CSEGLDIXh,HIGH(result)LDIX1,LOW(result)LDIR16,0LDIR17,lenCSEGLDIh,HIGH(result)LDIx1,LOW(result)LDIR16,LDIR17,len L1: LDI Zh, HIGH(val2*2) LDI Zl, LOW(val2*2) LDI Zh, HIGH(val2*2) ADD R36, R16 LDI Z1, LOW(va12*2) LPM R2, z ADD R30, R16 ADOR1,R2 LPM R2,Z+ LPM R4, z ST X+,R1 ADD R1, R3 ADC R2, R4 INC R16 DEC R17 TST R17 ST X+,R1 BRNE L1 ST X+,R2 Loop: RJMP Loop SUBI R16, 2 DEC R17 val1: .DB 123,23,45,67 TST R17 val2: .08 23, 32, 54,76 BRNE L1 EQU Een =4 Lab Assignment Write a program that performs a calculation on word and byte arrays. Based on the first letter of your last name, you must implement one of the following formulas: A-D:R=W+B+32 where W is an element of the word array, B is an element of byte, and R is an element of the result array

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!