Arithematic and Logical Instruction 1.write A Program To Add 25 To The Day of Your Birthday and Save The Result in R20
Arithematic and Logical Instruction 1.write A Program To Add 25 To The Day of Your Birthday and Save The Result in R20
1.Write a program to add 25 to the day of your birthday and save the result in R20
Output:
3.
1.write a program to toggle PB3 and PB5 continously without disturbing the rest of
the pins
Output:
2.write a program to toggle PD3,PD7 and PC5 continously without disturbing the
rest of the pins
Output:
.
3.Write a program to monitor bit PC3. When it is HIGH send 0X55 to port D
CBI DDRC,3 ; set pc 3 as input
LDI R17,0XFF ; R17 =FFH
OUT DDRD ,R17 ; set PORT D as output
CHECk:
SBIS PINC ,3 ;Skip next instruction if PC3 is 1
RJMP CHECK ; Relative jump to CHECK
LDI R18,$55;R18=55H
MAIN:
OUT PORT D,R18 ; set PORTD to 55H
RJMP MAIN ; jump to main
Output:
;A set of eight data bytes is stored in the memory locations
starting at 2100H. Check
;each data byte for bits D7 and D0. If D7 or D0 is 1, reject
the data byte; otherwise, store
;the data bytes at memory locations starting at 2150H
CHECK:
SBRS YL,7 ;skip in bit if YL=7
SBRC YL,0 ;skip in bit if YL=0
RJMP NEXT ; relative jump to NEXT
RJMP STORE ; relative jump to STORE
NEXT:
INC YL ;increment Yl
RJMP CHECK ; relative jump to CHECK
STORE:
st XL,YL
INC XL ;increment Xl
RJMP NEXT ; relative jump to NEXT
;A string of readings is stored in memory location, starting at
2100H. The end of
;string is indicated by byte ODH. Write a program to check each
byte in the string,
;and save the bytes between the range of 30H to 35H (both
inclusive) in memory
;locations starting form 2150H.
st y+,R24
st y,R25
ldi Xh,21
ldi Xl,$50
CHECK:
SBRC YL,5 ;skip in bit if YL=5
SBRS YL,4 ;skip in bit if YL=4
RJMP NEXT ; relative jump to NEXT
RJMP STORE ; relative jump to STORE
NEXT:
INC YL
RJMP CHECK ; relative jump to CHECK
STORE:
st XL,YL
INC XL
RJMP NEXT ; relative jump to NEXT
;Write a program to add the following data bytes stored in memory
locations starting
;from 2100H, and store the sum at 2150H. If carry is generated store
00H at 2150H.
ldi R16,$80
ldi
R17,$32
ldi R18,$47
ldi R19,$39
ldi R20,$22
ldi R21,$F3
ldi R22,$D7
ldi R23,$00
ldi yh,21
ldi yl,$00
st y+,R16
st y+,R17
st y+,R18
st y+,R19
st y+,R20
st y+,R21
st y,R22
ldi Xh,21
ldi Xl,$50
st y+,R23
CHECK:
ADC XL,YL
INC YL
SBRS SREG,C
RJMP CHECK
RJMP SR
SR: LDI
XL,00H INC XL
RJMP NEXT
;A set of eight readings is stored in the memory location
starting at 2150H. Write a
;program to check whether a byte 40H exists in the set. If it does,
stop checking and
;store it at 2160H, otherwise store 00H
ldi Xh,21
ldi Xl,$50
ldi Yh,21
ldi Yl,$60
CHECK:
SBRS XL,8
SBRS XL,7
RJMP CHECK2
RJMP STORE
CHECK2:
SBRS XL,6
SBRS XL,5
SBRS XL,4
SBRS XL,3
SBRS XL,2
SBRS XL,1
SBRS XL,0
RJMP STORE
RJMP NEXT
NEXT:
INC XL
RJMP CHECK
STORE:
MOV YL,XL