Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

Embedded Systems (Theory)

Assignment-1
For all questions write an assembly language program for ATMEGA 32

1. Write an assembly program to add the values stored in registers R1 and R2 and store the result
in R3
2. Write a program to load decimal value 50 to register R1 and add it with binary value 0111,
store the result in R20
3. Write a program to add 0xF4 and 0xA4, store the result in R25
4. Write program to subtract the contents of memory location 0x250 and 0x230 and store the
result in memory location 0x245
5. Write a code to read the data from PORTA, add 0x20 to it and send it to PORTC continuously
6. Write a program to toggle the PORTC forever
7. Find the C, Z and H of flag register after following instructions
LDI R20, 0x23
LDI R21, 0x20
ADD R20, R21

8. Write a code to count from 0-100 on PORTA, after the count reaches 100 restart from zero
(generate a saw tooth wave)
9. Write a code to toggle PORTB values 0x55 and 0xAA with a delay. Use a delay routine for
this task. Now modify the code to alternate those values on PORTA and PORTB
10. Write a program to toggle PORTA every 500 ms. Assume a crystal frequency of 16MHz
(ATMEGA32)
11. Write a program to toggle PORTA pin 1 with a delay of 500 ms
12. An LED is connected to each pin in PORTD and PORTA. Write a program to turn on each
LED from D0 to D7, at the same time turn on the complement LEDs on PORTA (ie if D0 is on
then A1-A7 should be on). Call the delay subroutine before turning on the next LED.
13. Create a square wave with 66% duty cycle on PORTC pin3
14. A switch is connected to PB1. Write a program to get status of switch and set the
corresponding LED in PC1 on or off.
15. Assume a switch is connected to PB1, Write a code to monitor its state continuously and
activate the Buzzer on PC1 if the switch is on.

You might also like