Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

al yod are reauired to write a program for a Co mmumication tvans mi tter mle t

ID: 2292909 • Letter: A

Question

al yod are reauired to write a program for a Co mmumication tvans mi tter mle t generate EVEM Pari ty, for loo byte dat Values stored in SRAM location star ting at address oxloo Parity). Parity bit is MSB after Parity bit is g enerate data Values ave stores ih location star ing at address DX2oo. Using AVR a's embly lan,.., e, wr(+e ^ sub ront ine Calles PARITY. GEN by lm the steps for each data byte value) in the algor thm 9iven be low. you must use a loop An access dat u sing in divect addrissm mode with post increment operator. Algor thm - loa d data byte value from Source location, 2- clear the Parity bit (MSB). a Count the hum ber f 1's in the da ta value um ber of 1's is oDD, then set the parity bit high other wise, leave the parity bit low, s store the data valee with parity in tarjet location Hnt se Xan ressters t int the seurc e lo ca tien n e c on , respect ively tto the sourc e tien and aret Lection, respectively.

Explanation / Answer

LD R28, Y ; Load R28 with the memory contents pointed by Y

ANDI R28, 0x7F ; Clear MSB bit

CLR R15 ; Initialize R15 for counting number of 1's in a given number

LDI R14, 0x7 ; Total number of bits to be counted

REPEAT: LSR R28 ; Left Shift data byte

BRCC No_Carry

INC R15 ; increment 1's counter

No_Carry: DEC R14 ; decrement count for checking bits

BRNE REPEAT ; Branch back to REPEAT if not finished checking

ANDI R15, 1 ; Checking LSB bit. If LSB = 1 then Odd else Even number of 1's in data byte

BRNE ODD ; if not zero then jump to odd else even

LD R28, Y ; Read original data byte from Memory

ANDI R28, 0x7F ; CLEAR MSB BIT

JMP END ; GOTO END

ODD: LD R28, Y ; Read Original Data Byte

ORI R28, 0x80 ; SET MSB BIT

END: ST Y, R28 ; STore back data byte in memory

STOP: RJMP STOP ; HALT

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at drjack9650@gmail.com
Chat Now And Get Quote