0% found this document useful (0 votes)
24 views2 pages

Assignment - 4 and 5 - MCPI

Uploaded by

soyeb patel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views2 pages

Assignment - 4 and 5 - MCPI

Uploaded by

soyeb patel
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Assignment – 4

Microcontroller Programming & Interfacing


Submission Date :- 16/10/2024
1. Write an AVR C program to send values 00-FF to Port C.
2. Write an AVR C program to send hex values for ASCII character of
0,1,2,3,4,5, A, B, C, D to Port C.
3. Write an AVR c program to toggle all the bits of PORT C 150 times.
4. Write an AVR c program to send values of -4 to 4 to Port C.
5. Write an AVR C program to toggle all bits of Port B 40,000 times.
6. Write an AVR C program to toggle all bits of Port C 1,00,000 times.
7. Write an AVR C program to toggle all the bits of Port C continuously with
a 100ms delay. Assume that system is ATmega32 with XTAL = 8 MHz.
8. Write an AVR C program to toggle all the bits of Port B continuously with
a 10ms delay. Assume that system is ATmega32 with XTAL = 8 MHz.
9. Write an AVR C program to get a byte of data from Port C , and then send
it to Port B.
10.Write an AVR C program to get a byte of data from Port C. If it is less than
150, send it to Port C; otherwise, send it to Port D.
11. Write an AVR C program to toggle only bit 4 of Port C continuously
without disturbing the rest of pins of port C.(Using Logical Operation)
12.Write an AVR c program to monitor bit 4 of port C. If it is high, send 55H
to Port C; otherwise, send AAH to Port C. (Using Logical Operation)
13. A door sensor is connected to bit 2 of port B, and LED is connected to bot
6 of Port C. Write an AVR C program to monitor the door sensor and,
when it opens, turn on the LED.
14. Write an AVR C Program to monitor bit 6 of Port B. If it is 1,make bit 3 of
Port B input, otherwise, change pin 4 of port B to output.
15.Write an AVR C Program to get the status of bit 4 of Port C and send it to
bit 6 of Port B Continuously.
16. Write an AVR C Program to toggle all the pins of Port C continuously
using Ex-or Operation.
Data Conversion
Write an AVR C Program
1. To convert packed BCD 0x29 to ASCII and display the bytes on Port C and
Port B.
2. To convert ASCII digit of “4” and “7” to packed BCD and display them on
Port C.
3. To convert 11111101(FDH) to decimal value and display the digits on Port
B, C and D.
Assignment – 4
Timer Programming
Submission Date :- 18/10/2024
1. Explain TCCR0 register in detail.
2. Explain TIFR register in detail.
3. Explain TCCR1A and TCCR1B in detail.
4. Write down steps to program Timer0 in Normal mode.
5. Write a C program to toggle only the PORTB.4 bit continuously every 70
μs. Use Timer0, Normal mode,and 1:8 prescaler to create the delay.
Assume XTAL = 8 MHz (Attach proteus simulation)
6. Write a program to generate a square wave of 125Hz frequency on pin
PORTB.3 use timer0, Normal Mode with prescaler = 256 (Attach Proteus
simulation) Assume XTAL = 8 MHz
7. Assuming XTAL = 8 MHz, write a program to generate a delay of 1ms on
PortB.4. (Prescaler = 64) Normal Mode (Attach Proteus simulation).
8. Assuming XTAL = 8 MHz, write a program to generate a delay of 25.6 ms.
Use Timer0, CTC mode, with prescaler = 1024.(Hint: Due to prescaler =
1024 each timer clock lasts 1024 × 0.125 μs = 128 μs. Thus, in order to
generate a delay of 25.6 ms, we should wait 25.6 ms / 128 μs = 200
clocks. Therefore, the OCR0 register should be loaded with 200-1 = 199.)
Attach Proteus simulation).
9. Write a program to generate a square wave of 1KHz frequency on pin
PORTB.3 use Timer2, Normal Mode with prescaler = 64 (Attach Proteus
simulation) Assume XTAL = 8 MHz
10.Write a program to generate a delay of 10ms using Timer2. Assume XTAL
= 8MHz (using CTC mode, Prescaler 1:256)
11.Write a program to generate a square wave of 1 KHz using Timer 1 (XTAL
– 8 MHz, Using CTC Mode, Assume prescaler based on calculation)
12.Write a C Program to toggle only the PORTD.2 bit continuously every
4ms. Use Timer1, Normal Mode, and No prescaler to create the delay
(XTAL – 8 MHz)
13.Write a C Program to toggle only the PORTB.4 bit continuously every 1s.
Use Timer1, Normal Mode,and 1:256 to create the delay (XTAL – 8 MHz)

You might also like