Docsity

Embedded and Real Time Systems, Assignments of Embedded Systems

Partial preview of the text

Download Embedded and Real Time Systems and more Assignments Embedded Systems in PDF only on Docsity!

10/9/2019 E&RTS

Assignment # 01

Submitted By: -

Submitted to: -

Syed Saqib Iqbal (16-SE- 37 )

Mam Huma Ayub

University of Engineering and Technology Taxila

Question no.

Write a simple assembly code to load the hex values into GPRs (R16-R20) with an increment of 3 number before loading to next register, using step over function view register data. ( Hint : 0x01R 16 and 0x0 4 R 17 )

Answer: -

Code: -

.INCLUDE "M32DEF.INC"

.ORG 0

LDI R16,0x LDI R17,0x AGAIN: ADD R16,R OUT PORTD,R BRNE AGAIN

Question no.

Write an assembly code to toggle all the pins of PORTA and PORTC infinite times, when both PORTS pins toggling with complement value with respect to other PORT pins values. Make Proteus design file to check output of this program.(Hint: 0x5 5 PORTA and 0 xAAPORTC at a time then 0xAAPORTA and 0x5 5 PORTC)

Answer: -

Code: -

.INCLUDE "M 32 DEF.INC"

.ORG 0

LDI R 20 , 0 x 55 OUT PORTA,R 20 LDI R 21 , 0 XAA OUT PORTC,R 21 AGAIN: COM R 20 COM R OUT PORTA,R 21 OUT PORTC,R 20 JMP AGAIN

Question no.

Write and assemble a program to clear R19 and add 5 to R19 100 times using BRNE instruction. Output the sum to PORTD.

Answer: -

Code: -

; ; Q no.04.asm ; ; Created: 05/10/2019 15:26: ; Author : taqdess ; ; Replace with your application code .INCLUDE "M 32 DEF.INC" .ORG 0 LDI R 16 , 100 LDI R 19 , 0 LDI R 20 , 5 AGAIN: ADD R 19 , R 20 DEC R BRNE AGAIN OUT PORTD, R 19