Professional Documents
Culture Documents
COMPLIMENT (ALP)
AIM
Write an assembly language program for ATMega32 to compliment a number 100 times and store the
result in a memory location. Then out the result to PORT B.
PROGRAM
.include "m32def.inc"
LOOPA: ; Loop A
LDI CONT2, 0X0A ; Loading 0x0A to Counter 1
LOOPB: ; Loop B
COM DATA ; Compliment DATA
OUT PORTB, DATA ; OUT the answer to PORT B
DEC CONT2 ; Decrement Counter 2 by 1
BRNE LOOPB ; Branch to LOOPB
DEC CONT1 ; Decrement Counter 1 by 1
BRNE LOOPA ; Branch to LOOPA
PROCEDURE