Got my Chip, Programmer & Software

Thread Starter

Chris15

Joined Apr 15, 2009
252
Ok thank you SOOOOOOOOOOOOOOOOOOOOOOOOOOO Much hgmjr you are a very helpful member of this site, i look forward to becoming addicted to the programming world and will always remeber you as you talked me through my first programming project

Many Thanks!!:)
 

hgmjr

Joined Jan 28, 2005
9,027
The beauty of this thread is that you can always come back to it when you need a refresher in the steps needed to program an AVR.

Keep in mind that you have only scratched the surface. The wonderful world of microprocessors is no longer as much of a mystery to you.

I think you will be very pleased with your choice of ATMEL's AVR family to be your first micro experience. The programmer you have purchased will work with pretty much every AVR in the 8-bit family. I would recommend that you look into using WINAVR to program the AVR micros in C language as it makes programming very easy compared to Assembly Language.

Enjoy,
hgmjr
 

Thread Starter

Chris15

Joined Apr 15, 2009
252
Hello hgmjr

What do you mean here:

'The programmer you have purchased will work with pretty much every AVR in the 8-bit family'

What is the 8 bit family, on ebay it had a table of all the chips and there was ALOT of them, so this means that my 6 pin header thing from the AVRISP MKII can program all the chips, ATmega328p etc

Chris
 

Thread Starter

Chris15

Joined Apr 15, 2009
252
Also What is assembly language and C language, can you give a brief example of each?

I have watched tutorials on youtube of people making LED's Dance like Knight Rider etc, and they write a code like,

#include <avr io.h>
{ while(1)
_delay_ms(250)

ETC, that sort of code, i understood a litle bit when the guy said that 1 means the LED will be on and 0, 0 means the two others will be off

Where can i learn that type of code, and wat is that called

FEEDBACK: Yes the circuit all works very well, i am suprised at the sensitivity and range of the IR Phototransistor, it worked all the way down a hall without pointin at the circuit, it is VERY annoying but i get happy everytime i hear the Nokia Tune because i know that the sound was programmed by me :D with you help hgmjr


Chris
 
Last edited:

hgmjr

Joined Jan 28, 2005
9,027
Hello hgmjr

What do you mean here:

'The programmer you have purchased will work with pretty much every AVR in the 8-bit family'

What is the 8 bit family, on ebay it had a table of all the chips and there was ALOT of them, so this means that my 6 pin header thing from the AVRISP MKII can program all the chips, ATmega328p etc

Chris
The list of AVRs that can be programmed by the AVRISP MKII includes almost all of the ATTINY and ATMEGA AVRs.

You don't have anything to worry about. It will program any of the AVRs you might possibly need.

hgmjr
 

hgmjr

Joined Jan 28, 2005
9,027
Also What is assembly language and C language, can you give a brief example of each?
Check out the tutorial at www.avrbeginners.net for an introduction to assembly language for the AVR processors.
I have watched tutorials on youtube of people making LED's Dance like Knight Rider etc, and they write a code like,

#include <avr io.h>
{ while(1)
_delay_ms(250)
The example you have indicated is a few lines of code written in C-language.
ETC, that sort of code, i understood a litle bit when the guy said that 1 means the LED will be on and 0, 0 means the two others will be off

Where can i learn that type of code, and wat is that called
You can find a number of good C-language tutorials on the Internet. You can also find some sample C language programs written for the AVR all around the Internet as well. You may want to register at www.avrfreaks.net. They have a lot of knowledgeable people there that can assist you with any AVR questions you may have.

hgmjr
 

Thread Starter

Chris15

Joined Apr 15, 2009
252
Ok thanks, i now know the differences

Should i start learning ASM Code, ro C language? which is the easiest to understand, write for a complete beginner. i beleive i am far from writing my own language code theing, making a hex and prgramming so in the mean time, should i be mastering ASM or C?
 

hgmjr

Joined Jan 28, 2005
9,027
You can go ahead and start learning C-language now using the Free add-in program development software for AVRSTUDIO4 called WINAVR. You can download WINAVR from www.sourceforge.net

It would make you a more well-rounded programmer if you would take some time to learn Assembly language.

hgmjr
 

Thread Starter

Chris15

Joined Apr 15, 2009
252
Oh yes i have Win AVR, i was playin with it last night, i was watching a tutorial on writing, and i made a code it all worked, but im not sure if the code i was writing was going to do, but more importantly once i made the code, and compiled it into Hex, can i add that to any chip, for example if i made any random hex code and programmed it to my ATtiny13A would it work?

Quick Question, What Chip could i use to program a sound that ran for about 3-5 seconds, chip that has enough memory?

Chris
 

hgmjr

Joined Jan 28, 2005
9,027
Oh yes i have Win AVR, i was playin with it last night, i was watching a tutorial on writing, and i made a code it all worked, but im not sure if the code i was writing was going to do, but more importantly once i made the code, and compiled it into Hex, can i add that to any chip, for example if i made any random hex code and programmed it to my ATtiny13A would it work?

Quick Question, What Chip could i use to program a sound that ran for about 3-5 seconds, chip that has enough memory?

Chris
If you have a program that you are developing you can always post it here between code tags for cleaner presentations.

The hex code is nothing more than the binary machine code packaged in a standard format for ease of download. The binary code must have been compiled for the microcontroller on which it was intended to run. A random hex file will only work when downloaded to the microcontroller for which it was written.

As for writing code to output a simple tune to a speaker, you may be able to simply write 8 tone loops to generate a simple musical scale and then play the tones in a sequence that results in a tune. This approach would take the least amount of memory.

hgmjr
 

Thread Starter

Chris15

Joined Apr 15, 2009
252
So, if i use the 8 tone loop thing, will that work for an ATtiny13A? Could i make a 5 second sound for ATtiny13A, like a fast short Christmas Song instead of a nokia tune?

Chris
 

hgmjr

Joined Jan 28, 2005
9,027
That is probably feasible. It is lot to bite off for your first program since it requires familiarizing yourself with a number of features that require many hours to acquire.

The best approach is to crawl, walk, then run. Starting out at a run is a recipe for frustration.

hgmjr
 

Thread Starter

Chris15

Joined Apr 15, 2009
252
Ohk, right now i have been looking at tutorials on C programming and it becomes alot more easy to understand but it is still really hard to make my own program. At this stage, i am happy to make projects like the one i already made, where i just download a hex file and buy the chip then program it. Thats why i wanted to know how the person made the nokia tune, did they have to write the C code for the tune, or did they get an mp3 and put it into a mp3 to hex converter?

Chris
 

hgmjr

Joined Jan 28, 2005
9,027
Ohk, right now i have been looking at tutorials on C programming and it becomes alot more easy to understand but it is still really hard to make my own program. At this stage, i am happy to make projects like the one i already made, where i just download a hex file and buy the chip then program it. Thats why i wanted to know how the person made the nokia tune, did they have to write the C code for the tune, or did they get an mp3 and put it into a mp3 to hex converter?

Chris
I would be willing to bet that the programmer created a set of tone loops and then called them in the order and duration needed to produce the simple tune. I doubt an MP3 file was involved.

hgmjr
 

thatoneguy

Joined Feb 19, 2009
6,359
Glad you got it going!

I'd suggest starting out in small steps to learn I/O.

The typical "Hello World" for uC's is blinking an LED.

The "Interactive Hello World" is pushing a button to change how fast the LED blinks.

Once you have those down, you can work your way up to other projects, usually building on code you've written for something else. In 10 years, a lot of your code is based on many "odd" splices from different projects.

Comment your code well, even stuff you don't think is important, you WILL look at it someday and wonder what it does.
 

hgmjr

Joined Jan 28, 2005
9,027
I endorse thatoneguy's suggestion to start small and work your way up to complexity.

There are many concepts that must be mastered to be a successful programmer. You will need to learn IO, interrupts, C-language syntax, AVR timers, just to name a few.

hgmjr
 

Thread Starter

Chris15

Joined Apr 15, 2009
252
Dammm!
I could try to learn that C language, and be a programmer, but id prefer to do the easy stuff like get a source code and compile it into a hex then program it, maybe after doing that for a bit, id get us to c code and understand the basic meaning of C
 
Top