Posted on Leave a comment

Analog Modulation based Transmitter using ATmega16a

Analog Modulation is the very basic form of modulation that can be produced using very basic components.

The ATmega16a is used to generate a square wave. The frequency can be generated by carefully adjusting the 8-bit PWM Timer.

Using the above method a Carrier Signal is generated.

You can hear the carrier pulses on AM Radio. The reception is full of noise and interference.

The range of such signals is not good. Since the EM wave has very low power.

The circuit is given below.

AM transmitter using ATmega16a

AM Transmitter circuit

/*
 * AM Transmitter.c
 *
 * Created: 11/10/2021 9:59:04 PM
 * Author : abhay
 */ 
#define F_CPU 16000000
#include <avr/io.h>
#include <util/delay.h>


void delay1(){
	_delay_ms(20);
}

int main ()
{
	
	TCCR0 = (1 << WGM01) | (1 << COM00) | (1 << CS00);
		DDRB|=(1<<PB3);  /*set OC0 pin as output*/
	
	while (1)
	{
		OCR0 = 4;	// 1600 KHz
		
		delay1();    //This delay will create pulse of carrier frequency

		OCR0 = 12;	//  615 kHz

		delay1();    //This delay will create pulse of carrier frequency



	}
}

PWM signal is being produced by an 8bit timer of the microcontroller.

The formula used for the value of OCR0

Where

f clk_I/O = 16000000

N = 1

OCRn = (1,2,3 … 255)

Frequency calculated using the formula

The Antenna Used for AM Transmission in this setup is of very small length. Its range and quality get improved if you touch the antenna with your bare hands.

Posted on Leave a comment

Memory Space in ATmega16A

To effectively program AVR based microcontroller you must have knowledge about its memory space. Since there is not just one memory space. There are three different address spaces. They are:

  1. Data memory (SRAM)
    Here all your the intermediate results are stored and all the run time calculation get carried in this memory space.
  2. Program memory
    It is the memory where your application code is stored. And also it stores the constants. It could be divided into two sections by setting appropriate fuse bits. The two section will be:
    1. Application Section
    2. Boot Section
  3. EEPROM
    This is the memory where you can save the run time data such as configuration options, intermediate result for future processing. But it is very limited in size. So proper managment had to be taken care. Since it limits the size of certain applications.

Out of the three memories present in the ATmega16a, only the SRAM is volatile.

Size and address of memory space

  1. Data Memory
    1024 Bytes (Starting Address: 0x0060 – Last Address: 0x045F)
    96 Address which contain two section General purpose Register and I/O Registers.
    General Purpose Register ( Starting Address: 0x0000 – Last address: 0x001F)
    I/O register (Starting Address: 0x0020 – Last address: 0x005F)
  2. Program Memory
    Flash Type memory organised into 8000 memory location each pointing to a 16 bit wide data.
    Starting Address: 0x0000
    Last Address: 0x1FFF

NOTE: Care must be taken while Read/Write operations of EEPROM. It is very sensitive to operating conditions. Variations outside the tolerance limits could result in corruption of data in the worst case total loss of stored data. It is highly recommended that a stable power source must be used if performing frequent EEPROM operations.