Embedded Electronics Blog

Mega16 Development Board : Sample Programs – Source Codes

Mega16 Development board comes with sample programs. On this post I will be posting updated versions of sample codes and related documentation. You can download this sample programs, modify and use them free of cost. All programs are written for CodeVisionAVR Compiler, unless otherwise specified.

Following table summarizes the provided sample programs :
(Link for the .RAR file is provided at the end of the post)

Example Number/ Name of the folder

Brief Description

ex01 Program demonstrates use of  input/output registers in AVR.
– It will monitor SW1 and SW2 on the kit
– When SW1 is pressed, LEDs will be flashed in one pattern.
When SW2 is pressed, LEDs will be flashed in another pattern
ex02 – Blinks the LED on PB3 at 31Hz using Timer0.
– Timer0 is configured in CTC mode. Timer resets when compare match  occurs between OCR0 and TCNT0.
– Also output toggle is enabled  in  this mode.  This makes pin OC0 (i.e. PB3 in mega16)  toggle on every compare match.
ex03 – Blinks the LED on PB0 at 1Hz using Timer1 CTC Interrupt.
– Timer1 is configured to run in CTC mode. Timer resets when compare match occurs between OCR1A and TCNT1. And interrupt is generated.
– State of the PB0 is toggled on every interrupt.
ex04 – Demonstrates the PWM using Timer0.
– LED connected on PB3 will faded in and faded out continuously using PWM.
ex05 – Generates sound using the CTC mode of timer 1.
– By changing the OCR1A value, we can generate square waves of different frequencies.
– Output is available on PD5(OC1A) pin.
– Connect this pin to on speaker using external wire to listen the sound.
– Press SW1 or SW2 to start melody.
– Program also prints the frequency being generated on serial interface.
ex06 – Demonstration of simple edge detector robo-car code
ex07 – Demonstration of simple line follower
ex08 – Demo program for the development board. Shows how to use printf, ADC, LCD, I2C, Infrared remote.
ex09 – Demonstares the use of L293D connected on PD.
– Press SW0 to stop the motors
– Press SW1 to start the motors in one direction
– Press SW2 to start the motors in reverse direction
ex10 – LED Blinking using RTOS threads. FreeRTOS based. WinAVR compiler.
– Use eclipse IDE and select File> Switch Workspace> Other …, and select this folder.
ex_test01_IO_TEST-mega16 – Toggles all I/O lines of uC at the rate of 1Hz. Helpful for debugging the board.

Browse or Download the programs on GITHUB:
https://github.com/elecrom/el_mega16_sample_codes

Exit mobile version