Microcontrollers (AVR)

توجه: پاورپوینت اولیه مربوط به مبدل آنالوگ به دیجیتال و پورت سریال اضافه شده است. نسخه کامل به همراه مثالها به زودی گذاشته خواهد شد.

مثالها و تمرینهای کلاسی درس میکرو ترم بهار 1396

سری اول مثالهای کلاسی پورتها و سون سگمنت (یک تا چهار)       دانلود

روش ماکرونویسی در کدویژن برای تعریف تابع و مقدار    دانلود

سری دوم تمرینهای کلاسی -اینتراپت خارجی و آنالوگ به دیجیتال (پنج و شش)      دانلود

دیتاشیت سنسور ال ام 35 – سنسور دما        دانلود

سری سوم تمرینهای کلاسی -تمرینهای مربوط به آنالوگ به دیجیتال (شش تا یازده)     دانلود

AVR Microcontrollers:

AVR Microcontrollers are generally divided into XMEGA ,ATMEGA , ATtiny, AT90 divisions. In this course as an example we focus on ATmega8 and ATmega32 as general use AVR microcontrollers. Students can work with other types of AVR microcontrollers based on this course.

Course Objectives:

  1. understanding the main components and working principals of the AVR microcontrollers
  2. understanding the basic architecture of computer and AVR Microcontrollers
  3. programing and debugging in assembly and C-Codevision languages
  4. understanding the memory organization and memory interfacing
  5. understanding hardware and software interrupts and their applications.
  6. understanding how to use equipments in a Microcontroller like ADC, Analog compactor, Watchdog, Timer/counter and ….
  7. understanding how to use extended equipment like keyboard, LCD, I/O expansion.
  8. understanding properties and interfacing of the parallel and serial ports


1- AVR Microcontrollers and their usage, A. Rahafrouz.

2- AVR Microcontrollers with 100% projects, J. Alvandi.

3- Learning AVR Microcontrollers in C, H. Badami Nejad.

4- Complete Reference of AVR Microcontrollers, M. M. Partovi Nejad.

5- AVR Microcontrollers in C and Assembly, M.H. Mazidi.

6- Programming and use of AVR Microcontrolles, S.E. Hosseini.

Course Outline:

This course is divided into five main parts:

1) Understanding internal structure of AVR Microcontroller, Assembly commands, Hardware design, Fuse bits, Reset sources and clock sources.

2) Programming AVR Microcontrollers in C-codevision software. Students should know C language and CodeVision software very well in here.

3) Programming simple programs for AVR Microcontrollers using I/O ports, LCD, 7-seg, Keyboard, I/O expansion and … and simulating in Proteous.

4) Introduction to Programmer for AVR Microcontrollers and learning how to programs a Microcontroller.

5) Using other equipment as order: Interrupts, ADC, Timer/counter, RTC(real time clock), Sleep modes, Reset sources and Watchdog, , Analog Comparator, Serial Communications: USART, TWI, SPI, External EEPROM/Ram.


1- Quiz and assignments 5/20

2- Finished Projects : 3 to 5 /20 based on quality of work.

Non-finished projects will receive a grade of 0 – 3 based on their simulations and project defense.

3- Final 12/20

Total : 22/20 (+2 is on finished projects)

Simulation projects are individual and built projects are in groups and in three some. Each person or group must select his project subject different to other students in first two weeks of the term and must register his project proposal in Mechatronics Scientific Community website. It is clear that proposal time is limited in the mentioned time and registration will be closed later.

All project will be evaluated in one day in last week of the term. Non-finished projects will not be considered after this time, so students must plan in a way that projects and its reports are finished by then.


Some suitable websites for students to increase their knowledge and get help online:

www.avrprojects.info       به زبان بیسیک    



www.ECA.ir  فارسی

www.kavirelectronic.ir  فارسی

www.iranmicro.ir  فارسی


www.atmel.com (AVR Manufacturer website)


Lecture Notes: (پاورپوینت جزوه درس را از این قسمت دانلود کنید.)

Version 2 : از اینجا دانلود نمایید  – تا پایان اینتراپت سخت افزاری – 30/1/1396

Version 3 : از اینجا دانلود نمایید – تا پایان تایمرها – به همراه تایمر یک و مبدل آنالوگ به دیجیتال – 16/2/1396

پاور اولیه مربوط به پورت سریال


Other necessary Files for Student (softwares, Toturials and …):

1- Instruction of AVR microcontrollers by ATMEL             Download1(bayanbox.ir)

2- Tutorial for codevision-AVR                     Download1(bayanbox.ir)

3- ATMEGA32 microcontroller datasheet            Download1(bayanbox.ir)


Codevision software version 3.12        File1     File2     File3     File4     File5

Codevision software version 2.05        Download1(bayanbox.ir)

Codevision version 2.04 (portable)         Download1(bayanbox.ir)

5- PROTEUS Software:

Proteus Version 8.3 (Installer)            File1     File2     File3     File4     File5     File6     File7     File8     File9

Proteus version7.7sp2 (installer)        File1     File2     File3     File4     File5     File6(crack)

Proteus version7.7sp2 (portable – no need to install)     File1     File2     File3     File4     File5

6- Do you want to make a programmer yourself?

Files are here, download it and simply build it.


Projects & exercises:

There is some reference projects for students, which are other students results  in previous academic semesters. Also class solved examples of previous semesters.

1- Old projects has been done in class

file1(old)           file2(1393-1)           file3(1393-2)


——-1- Class solved examples 1 to 5          download

——-2- Examples for Keypad and …        download

——-3- Examples for Timer0 all modes+ PWM+RTC AND ADC        download

2- Line follower robot. (A project completed and reported by Mohammad Javad Akbari 1393)


3- I2C instruction and example (A project by Mr. Khajoueinejad)

File1(only report)        file2(report+example)

4- Projects from student of Spring 1394 (Both file must be downloaded for extraction)

file1             file2