Is this an OK place to start?

Go To Last Post
17 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

My only experience with microcontrollers is with a BX-24 I have had for a while.

I have a new project that needs more I/O's than that can supply, plus I want to learn a lot more about microcontrollers than what I do now. To be honest, I don't know much at all.

I have been reading and searching a lot over the last few days and I have decided an Atmega128 is the chip I want to work with. I was thinking of buying a AVR-H128C header board from Olimex, and a AVR-PG1B serial port dongle programmer and use the PonyProg software from www.lancos.com. Does that sound like a good place to start? Are there any good tutorials that might help me get started with the programming? I need an idiots guide.

Any advice will be appreciated.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I would go to smileymicros.com and get the AVR butterfly, parts kit and book. It is an excellent place for a beginner. Besides, the ATmega169, which is on the butterfly, is pretty powerful.

-Chyld

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I would like to second what cmedford said.. I have puchased the book, butterfly and parts kit and can recommend it for a newbie. I don't think there is anything available, online or otherwise that is aimed more for a newbie with very little experience. If you want to checkout Smileys writing style etc before you buy, you can download the quickstart guide from his website which is the first chapter of the book.

Good Luck :)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

That's a great place to start, but remember that you only have a couple (less than 10 depending on what subsystems you don't need) of spare IOs. You could of course remove the LCD and then you'd have several mountains of free IOs that are easily accessable...

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

And, if you go to the AVRFreaks home page, there is an offer for a Butterfly and you get a t-shirt for only $20.00. I have Smileymicros book and have been brousing it a little bit. It's a good book. There are other books on the AVR but, the less expensive ones are't that good and, the good books are expensive. Smileymicros book brings the most bang for the buck!

You can avoid reality, for a while.  But you can't avoid the consequences of reality! - C.W. Livingston

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

abcminiuser wrote:
That's a great place to start, but remember that you only have a couple (less than 10 depending on what subsystems you don't need) of spare IOs. You could of course remove the LCD and then you'd have several mountains of free IOs that are easily accessable...

- Dean :twisted:

Or you could leave the LCD on and just use the ports as you like. The LCD elements will twiddle, but it won't hurt your use of the ports. It might hurt the LCD in the long run, but I haven't experienced that. Anyhow, I can't imagine it causing more damage than desoldering the LCD which wouldn't be easy and might not only damage the LCD but the Butterfly.

Oh, and thanks guys for the nice words,
Smiley

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks for the advice, I think I will take it and buy the Butterfly kit with parts and book. I read the downloadable quick start guide which is written in a very easy to understand way. Even if I progress to using a different chip I will have some idea of what I am doing by then. I already have a graphic LCD with a serial controller so once I have gone through the book and it's examples I'll have a look at using it and freeing up those extra pins. Thanks again.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

A steady DC current to the LCD elements will definetly mess them up in the long run, hence why the driver feeds then with a fast AC current. Having said that you can't damage what you don't want.

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You could also buy a STK500 board from atmel, wich would allow you to program a whole range of their uC's, it will set you back for about $75-$80. But for evaluation purposes you might want to get the butterfly first.

http://atmel.com/dyn/products/to...

evaluation .. hell, what am i saying, you're gonna love the AVR family !
I use the STK500 board.
Ordered the butterfly this week, with the avrfreaks t-shirt :) Looks like a very cool toy ! And might always come in handy to do some quick testing.

"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it"

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Cheap, easy, or quick; pick two. I went with cheap and easy when learning AVR in 1998. I had learned and used Intel 8051 and Commodore/Apple II 6502 previously.

I suggest starting with the Tiny13 and/or Tiny 2313. Or, buy several 90S2313s that are often selling in the range of $2.50 on eBay (microcontroller section). I suggest printing out the full data sheet on a laser printer for the chip that you are going to start experimenting with. Usually new users will read the data sheet many many times before the details of the operation of the device become clear. Data sheets are not written all that clearly, so don't get discouraged.

For a programmer, try downloading the SP12 from the web site found from a search for 'Programming a Spyder's Brain'. I don't remember its URL exactly, but it's in The Netherlands and all in English language. The SP12 programmer and its 'Ken's Dongle' is excellent and I have used it for several years after the original DOS programmer that I used in 1998 couldn't work on newer Windows systems.

For any PC parallel programmer, a buffer 74HCxx type of IC is a good idea. I recommend DigiKey in the USA for parts. In addition to having the best price for AVRs, get a few useful TTL (74HCxx) type chips and a few op-amps and a couple of Digital-to-Analog converters. Also get power jacks and plugs. They are very inexpensive and useful. Don't mix 2.5mm and 2.1mm pin sizes; standardize on one size for everything (2.1mm recommended). LEDs and 7-segments are also useful, as are the ICs that boost and invert DC voltage. The ICL7660 for example can turn +5v into negative 5 or +9V. An assortment of diodes, resistors, and capacitors is good to have also. They can be removed from discarded electronic equipment.

A 'bread board' that allows making temporary circuits without soldering is helpful.

All of the above will cost about $20-$30 dollars and is, I believe, the most inexpensive way to get started in AVR microcontroller development.

If you can find an ICE200 in-circuit-emulator for $50 or so, try to buy it. It will significantly speed up development of complex programs. And in the microcomputer field, anything more than flashing an LED gets complex quickly. The ICE200 emulates AVRs that are outdated, but the code developed can be transfered to the newer devices. I develop for the Tiny26 and Mega48 by using the ICE200 emulation section of the 8535. Tiny45 and Tiny13 development can be done with the ICE200 emulation of the 8535 as well, just restrict your usage to 6 pins total.

If you have the funds available, the SDK500 is a good buy. But I would get an ICE200 first.

Good Luck. Check the projects in the academy section here and other AVR web sites. Study other people's code.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
If you can find an ICE200 in-circuit-emulator for $50 or so, try to buy it. It will significantly speed up development of complex programs. And in the microcomputer field, anything more than flashing an LED gets complex quickly. The ICE200 emulates AVRs that are outdated, but the code developed can be transfered to the newer devices. I develop for the Tiny26 and Mega48 by using the ICE200 emulation section of the 8535. Tiny45 and Tiny13 development can be done with the ICE200 emulation of the 8535 as well, just restrict your usage to 6 pins total.

If you have the funds available, the SDK500 is a good buy. But I would get an ICE200 first.

Good Luck. Check the projects in the academy section here and other AVR web sites. Study other people's code.


Infact, I saw an ICE200 & STK200 kit on ebay. I also saw a ICE200 by itself.
http://cgi.ebay.com/ICE200-In-ci...


My AVR Site

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have a lot of learning to do. I am going to keep my eyes out for an ICE200 and a STK500 at a good price, but I think I'll still get the butterfly kit to get me started. Thanks for all the input.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I've got the Butterfly, Parts kit and Book from Smiley Micros about a week ago now and have been going through it slowly. I am rereading each section and looking up the Atmega169 document and reading it as well. I don't move onto the next section till I have a reasonable understanding. I am getting there ... slowly. I am up to Chapter 7 Microcontroller Interrupts and Timers and I am hoping someone can explain something for me. In the project called Precision Blinking an interrupt occurs every millisecond by setting CTC mode and a prescaler of 8. Here is the code:

	// set clear on timer compare (ctc) mode, CLK/8 prescaler
	TCCR0A = (1<<WGM01)|(0<<WGM00)|(1<<CS01);

and the interrupt is handled here

// interrupt occurs once per millisecond
SIGNAL(SIG_OUTPUT_COMPARE0)
{
	PORTD = milliseconds++;
}

Now I understand how changing the Timer Compare Register changes the frequency of the interrupt, but in the next section on PWM there are minor changes but am not sure what the differences mean to the output. ( I can see the difference, but I just can't get my brain around it) The code

// set PWM phase correct mode, CLK/8 prescaler
TCCR0A = (0<<WGM01)|(1<<WGM00)|(1<<CS01);

// interrupt occurs once per millisecond
SIGNAL(SIG_OUTPUT_COMPARE0)
{
	if (PORTD &= 1) cbi(PORTD, 0);
        else sbi (PORTD, 0);
}

I am not sure what changing the Timer Compare Register does in this mode. Does the interrupt frequency remain the same? If someone can explain this in idiots terms I would greatly appreciate it. I have read all about PWM phase correct mode in the manual, but most of it goes over my head.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
I am not sure what changing the Timer Compare Register does in this mode. Does the interrupt frequency remain the same? If someone can explain this in idiots terms I would greatly appreciate it. I have read all about PWM phase correct mode in the manual, but most of it goes over my head.

The PWM sections in the datasheets are a bit tricky ... Atmel should have included more pictures :-)
I've struggled to understand some details regarding the PWM modes myself lately, so I've got it sort of "fresh in memory" :

Ok, in "idiot terms" : (as in : written by an idiot :shock: )
--------------------------
PWM Phase Correct Mode :
The frequency is set by the prescaler bits. See page 87 in datasheet
The compare register adjusts the dutycycle of the PWM pulse(s)... again, page 87

"Oversimplified" explanation :

The Timer counts from 0 to 255 and back to 0 again ...
On its way up, the Timer sets/clears the PWM output pin when an OCR match occurs, and the opposite on its way down ...
Thus the name "phase correct PWM"

Have to admit that I don't know when one would like/need to use phase corrected PWM, but that's another story :-)

/J

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thanks, that explains it well :D. I am going to play with some servos in the future and was thinking I would need to know this for then, or maybe I'd need Fast PWM mode? Anyway, I hope to learn a lot more before then.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Taipain, you'll fit in here well. Desire to learn, intelligence, manners. Kind of like a anti-Sparks :D.

I admit, there are quite a few different types of PWM! I had a *lot* of trouble at first, but I soon worked it out. So far i've limited myself to the use of CTC PWM only, which has sufficed for all my current needs. When ButtLoad's all done and dusted I plan on cranking out a simple circuit, trade my arm and leg in for one of those RGB leds and experiment.

- Dean :twisted:

Make Atmel Studio better with my free extensions. Open source and feedback welcome!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Servos (nominal 1.5 milliseconds) are just fine on the normal PWM channels. Fast PWM is for applications that need sub-microsecond resolution.

I've used "phase correct" PWM when I wanted to gradually change an audio frequency.