0% found this document useful (0 votes)
1 views

Lecture3

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)
1 views

Lecture3

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/ 11

EMBEDDED SYSTEMS

Programming AVR Microcontroller-II

Dr. Muhammad Awais


Department of Electrical & Computer Engineering, COMSATS University Islamabad Wah Campus
The AVR Microcontroller and Embedded Systems Using Assembly And C,2nd ed. By Muhammad Ali Mazidi, Sepehr Naimi, Sarmad Naimi.

• The mostly used one is unsigned char: 0-255


• 00-FF (Hex)
• Unsigned char is also for String of ASCII characters
Write an AVR C program to send values 00-FF to port B.

apropriate IO definitions
• Unsigned char is also for String of ASCII characters

Write an AVR C program to send hex values for ASCII characters: 0, 1, 2, 3, 4, 5,


A, B, C, D
Write an AVR C program to toogle all bits of Port B 200 times

Bitwise not
Write an AVR C program to send values -4 to 4 to port B
Write an AVR C program to toogle all bits of Port B 50000 times
Write an AVR C program to toogle all bits of Port B 100000 times

important
A function of crystal frequency

1. Using a simple foor loop

2. Using predefined C functions

3. Using AVR timers


• _delay_ms() or _delay_us() in WinAVR

• delay_ms() or delay_us() in CodeVision


Write an AVR C program to toogle all bits of Port B continuously with a
100ms delay (with for loop)

important
Write an AVR C program to toogle all bits of Port B continuously with a
10ms delay (with predefined C functions)

You might also like