Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

working with atmega16

Status
Not open for further replies.

southpaw4471092

Junior Member level 1
Junior Member level 1
Joined
Apr 6, 2012
Messages
15
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,392
hi!
i theoretically no something about microcontrollers but wen it comes to practical implementation im unable to do ... so can anyone guide me in how i can begin working with atmega16 practically...??
like how to program making use of its features,how burn program into microcontroller.... do help me as soon as possible
 

first of all you need to study atmega16 datasheet and then you need programming software to program avr controller you can download it here
http://www.atmel.com/tools/AVRSTUDIO4.aspx

then you need programmer hardware may be ISP programmer or you can use JATAG programmer its your choice
http://electronics-diy.com/avr_programmer.php

then you write simple basic sample code given in avr studio and burn with your programmer.
now you are using controller practicaly
 
hi.my dear friend.i think the best way to learn ,is that you understand every function and programming by doing that with ATmea16.I have started learning since 8 month ago.at first I just read as theoretically but after 1 month I find out that this way is not good for me because I couldn't do any thing in pracatical.so I started to program different example which I read in theory.so I prefer to you that start with the example and see the usage of the function in fact in this way you never forget the usage of that f.younction.you can use the Proteus for simulations and after that you can make or buy a simple STK 200/300 or STK 500 for program your chip and I think the best software for programming is "cod-vision" because it hase a wizard which help you to writ and program chip simply.
regard
pesarirouni
 
hey ud23! thanks alot for your suggestions. i've another doubt (do answer even if its silly). actually i've heard many saying read the datasheet. http://www.atmel.com/Images/doc2466.pdf is this the datasheet? what do you mean by reading a datasheet?? is it knowing about the features like counters,timers etc??

---------- Post added at 13:02 ---------- Previous post was at 13:00 ----------

hey pesrirouni!thanks alot for your suggestions.i would star doing it practically. but since this s gonna be ma first attempt , s there any do's and dont's while programming a chip???
 

for programming any device you should know its architectural details and its basic as you mention timers ,interrupts,flash,adc type,working with its i/o everything is mention in device datasheet. so first you need to read that

ya the link you posted is atmega 16 datasheet you read that first
 
hi
i dont get what you mean.:-|.explain what you mean.
 

hi ud23!
ya i have read the datasheet. now how am i to start programming?for example during programming an adc there s a syntax for it and in the same way all the other features also have some syntax. are these syntax a standard one? if yes were can i get it??

---------- Post added at 23:27 ---------- Previous post was at 23:25 ----------

hi pesarirouni!
i came across something called fusebits . if it s not done correctly then the chip is ruined. s this true? if yes how to do it correctly?
 

hi.as i know fusebits is a facility which help us to protect our programming from reading. for example a company have production and they don't want publish their programming source.so they use fuse bits to protect their programming.in thise case the chip dosent ruined but you cant read the program of that chip and you cant have have hex file of that chip.and you can erase your chip and program it in several time.I put a picture for you .I hope that help you.the software which i use is "cod vision". codvision.jpg
regard
pesarirouni
 
@southpaw : which programming software you are using?need to have programming software and compiler like code vision or AVR studio .

for programming atmega adc you need work with adc registers which mention in its datasheet.for some sample basic code you can refer below link

**broken link removed**

and for all atmega family register type almost same i don't know about high bit controller but for 8 bit region have set of register and if you really read datasheet its mention there what you can start conversion by setting ADSC high in ADCSRA(adc status register)


Code:
//Program for ADC to read from channel 0 and show the 8 bit o/p on PORTB
 
#include<avr/io.h>
#include<util/delay.h>
 
void ADC_init(void);
unsigned int ADC_read(unsigned char);
 
// ------------------------------------------------
int main(void)
{
unsigned int value;
DDRB=0xFF;
DDRD=0x03;
ADC_init(); // Initialization of ADC
// ch=0;
while(1)
{
value=ADC_read(0);
PORTB=value;
_delay_ms(500);
} 
}
//------------------------------------------------
 
void ADC_init(void) // Initialization of ADC
{
ADMUX=(1<<REFS0); // AVcc with external capacitor at AREF
ADCSRA=(1<<ADEN)|(1<<ADPS2)|(1<<ADPS1)|(1<<ADPS0);
// Enable ADC and set Prescaler division factor as 128
}
 
unsigned int ADC_read(unsigned char ch)
{
ch= ch & 0b00000111; // channel must be b/w 0 to 7
ADMUX |= ch; // selecting channel
 
ADCSRA|=(1<<ADSC); // start conversion
while(!(ADCSRA & (1<<ADIF))); // waiting for ADIF, conversion complete
ADCSRA|=(1<<ADIF); // clearing of ADIF, it is done by writing 1 to it
 
return (ADC);
}
 

hi cyrus ! thanks for saying and putting this picture.... so yo mean to say that we can proceed without those fusebits???
 



---------- Post added at 18:17 ---------- Previous post was at 18:17 ----------

yes we can set fuse bits settings at last if needed
 

hi .yes.fuse bit hase many usage and one of them is what i pointed.
regard
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top