Originally, I used PIC16F877 microcontroller to teach mechatronics class (see the page PIC & I/O Board). While most PIC compilers are expensive, AVR has WinAVR, which is a open source compiler, widely used and supported by a huge community. So I wrote example programs for AVR ATmega16 to use with ET EXP4 I/O board in the same way as I did for the PIC.
ET-CP-AVR v3 Board is developed by ETT company. It uses AVR ATmega16 with an 8 MHz oscillator. I chose this board because it is designed to conveniently connect with ET-EXP I/O Board through 34-pin IDC connectors. The board is shipped with AVR-ISP programmer via a parallel port with PonyProg program. For short, I will call this AVR board in the rest of this page.
ET-EXP4 I/O Board is also developed by ETT company. It contains many input/output modules that is often used in mechatronic systems such as LEDs, 7-segment, dot-matrix LED, LCD display, matrix switches, stepper and dc motor, relay, speaker, and DAC. The AVR board is designed to conveniently connect with ET-EXP I/O Board through 34-pin IDC connectors. Because both boards were made by the same company, so the pin configurations are matched. This device will be later referred to as I/O board.
|
Note: How to Compile Source Files on Command Line I find that using AVR-GCC with AVRlib library on command line is simpler and easier than with AVR Studio (Window GUI). However, we need to modify makefile (which can be obtained from AVRlib examples) manually. Here is what you need to modify in the makefile.
MCU = atmega16 TRG = ex2_1 AVRLIB = C:/Code/AVR/avrlib SRC = $(AVRLIB)/rprintf.c $(AVRLIB)/timer.c $(AVRLIB)/lcd.c $(TRG).c Then, to compile, simply change directory to the source file. Then type command: |
The following source codes are made in attempt the match the flow of the mechatronics lab with PIC. To use the source code, you need to download, modify the makefile (check the directory name where you install your AVRlib), and then compile with command make
*Note that there are no lab documents for this page. Please use the lab documents in the page Mechatronics Lab with PIC16F877 and I/O Board for board and wiring setup. You can also find this information in the source code.
| Labs* | ||
| AVR-GCC | ||
| Lab1: Seven-Segment & LED Display | ex01_1.zip ex01_2.zip |
|
| Lab2: Character LCD Display | ex02_1.zip | |
| Lab3: Dot-Matrix LED Display | ex03_1.zip | |
| Lab4: Matrix Keyboard & Switch | ex04_1.zip ex04_2.zip ex04_3.zip |
|
| Lab5: Stepping Motor, Speaker and Relay | ex05_1.zip ex05_2.zip ex05_3.zip ex05_4.zip ex05_5.zip ex05_6.zip |
|
| Lab6: Serial Communication | ex06_1.zip | |
| Lab7: Digital-to-Analog Converter (DAC) | ex07_1.zip | |
| Lab8: DC Motor Control | ||
| Lab9: PWM | ||
| Lab10: Analog-to-Digital Converter (ADC) | ||
| Lab11: Data Acquisition System (DAS) | ||
| Lab12: Window Application with C# | ||
| Lab13: Design and Fabrication of a PCB with Eagle | ||