I'm looking to get into uC's and I've got some questions...

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

Hi Everyone,

I'm very comfortable in C and read the "How to get started with microcontrollers - Part 1" which was great.

Here are my questions:

1. I've read about STK500 and also a BUTTERFLY. What would be a good thing to order to get started with AVR uC's? Where is a good (cheap!) place to order it?

2. How does debugging work on uC's. Do you compile, flash it to the uC, then run it? Can you step through the code on your PC while it runs on the chip? Is that called ICE or IDE? Is there anything special required to do it (that I would need to order or decide on for question #1)?

3. The examples in the part 1 get started were just a while loop making something happen. Is this normally how AVR's are coded? Do they use interrupts? If so, I've debugged dos C before, but never anything with an ISR - how do you debug them?

4. Is there a big AVR C code database someplace with examples on how to do common things? I would really like to write some code for a uC that can communicate with a PC via USB2 for example. How would you go about this?

5. I've seen some LCD's like on the butterfly. How do these work - do you have to control each pixel, or can you render a built in font to them somehow? Does the AVR C code have to know how to do this? I probably will be starting out with LED's and nothing to do with LCD's, but I am curious...

Thanks for any help and advice you can give, I really want to get a kit or the parts I need ordered so I can begin messing around with uC's!

Thanks,

Alan

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

1). You can order from Digikey or Mouser (and probably others). The price should be the same in all. Which board or programmer you buy is up to you. It really depends on your budget and needs.

2). Using AVR Studio you can debug in the simulator, or you can debug on chip if you have a JTAG device (JTAGICE or Dragon).

3). Yes, the AVRs have ISRs. You debug them pretty much like any other code, put a break point in them. The only real difference is that they can happen anytime.

4). The Tuttorials forum.

5). The one on the Butterfly, the elements are controlled directly from chip. But the chip used is specifically designed for that. Most people use text displays. On those, all the hard work is done by a controller on the display board. Hooking it up to an AVR is relatively easy. There are also graphic displays that can also be used. They are only a little harder to interface to an AVR.

Regards,
Steve A.

The Board helps those that help themselves.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
alank2 wrote:
Thanks for any help and advice you can give, I really want to get a kit or the parts I need ordered so I can begin messing around with uC's!

Thanks,

Alan

Arduino boards are cheap and available. The Butterflies are back in stock. Lots of choices.

Smiley
[edit]I was writing this when Steve posted so there is a lot of overlap[/edit]

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

Hi,

Does Arduino support any sort of debugging?

What exactly is a bootloader and its benefits?

Is there a comparison between the arduino platform vs using stk500 (and other tools) and avr?

Thanks,

Alan

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

If you are looking to take a step past “basic stamp” and the “arduino”, then the key is to find good tutorials and instructional projects you can work through and learn from. I know this is going to sound like idol worship (and maybe it is), but I highly recommend taking a look at Smiley Micros tutorials. I first read an article by this gentleman (I believe is named Joe) year ago in a “Nuts and Volts Magazine” issue. The article really opened my eyes that simplistic design and common sense can yield some amazing and inspirational results. The article helped me to learn there are options besides the other three character acronym competitor to AVR. Better yet, the founder is a forum member here (an no, I have not met him nor do I know him in person). Check out his web site and projects. There are some great tutorials there.

Another great resource is adafruit.com. It is run by a scary smart MIT graduate that really believes in the cause. AdaFruit also has some great projects to help the budding enthusiast get started. Smart fun has some modules and open source code available too.

To address your questions:

1.I've read about STK500 and also a BUTTERFLY....

I personally started with the MKII ISP programmer and a breadboard. Beyond that, the Arduino is an excellent cheap STK500 alternative too in that you can write C with AVR Studio and use the ISP programmer to flash it. Also, you can use the Arduino as a programmer and pop out the chips to use in projects. A number of chips, including the Atmega328 fit this little board.

2. How does debugging work on uC's. Do you compile, flash it to the uC, then run it? Can you step through the code on your PC while it runs on the chip? Is that called ICE or IDE? Is there anything special required to do it (that I would need to order or decide on for question #1)?

I would start with AVR Studio or Linux and Eclipse with the simulator.

3. The examples in the part 1 get started were just a while loop making something happen. Is this normally how AVR's are coded? Do they use interrupts? If so, I've debugged dos C before, but never anything with an ISR - how do you debug them?

Yes, AVR's make use of interrupts. The code convention to AVRs is the closest to traditional C that I have seen.

4. Is there a big AVR C code database someplace with examples on how to do common things? I would really like to write some code for a uC that can communicate with a PC via USB2 for example. How would you go about this?

Yes, tons. See SmilyMicros, this forum of course has tons, and google beyond that.

5. I've seen some LCD's like on the butterfly. How do these work - do you have to control each pixel, or can you render a built in font to them somehow? Does the AVR C code have to know how to do this? I probably will be starting out with LED's and nothing to do with LCD's, but I am curious...

These use a controller that you can write to fairly easily. I would highly recommend a LCD project as a good starter.

Edited to add:

I saw your question after my post, yes, you can debug (or at least simulate) the Arduino using Eclipse/AVR Studio using the native avr_gcc and the simulator. You cannot debug (easily) using the stripped-down Arduino programming language.

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

This is very philosophical. My contention is 'there is no way to debug a realtime program without a way to output at least one variable without slowing down realtime operation'. To back this up, I offer outputting an integer variable value of 5 ascii chars and a return takes about a half millisecond at 115200 bps. This allows 100s of reports per sec, which is admittedly more than a human can read. Maybe you can see a trend by observing the 'analog effect' of the printout. Like 1234 might look like 1288... that gives you an idea of the value within about a percent. I dont know too much about single stepping thru realtime programs, because I cant hit the next button a million times per second so the program will run real time.

Imagecraft compiler user

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

alank2 wrote:
Hi,

Does Arduino support any sort of debugging?

What exactly is a bootloader and its benefits?

Is there a comparison between the arduino platform vs using stk500 (and other tools) and avr?

Thanks,

Alan


If you just buy one of the many Arduino boards then, no, you won't have a debug facility. The whole point of Arduino is to get you started quickly and easily so you don't even get a programmer, let alone a debugger. Instead the (usually mega168) chip on the Arduino board has a small piece of software (bootloader) preloaded which sits out of the way of the usual program location and will allow code to be sent (over UART/RS232) to the chip and programmed into the main code space. This reduces the amount of hardware (and therefore cost) you need to get started.

If you do want to debug the code (or even program it using ISP or JTAG) then nothing stops you from getting an Atmel programmer or programmer/debugger but you don't HAVE to do this and, because the Arduino will include a UART link between the PC and the AVR board you can also use this as a "debug channel" to send operational info about the AVR back to display on the PC which will usually be enough to get you going.

As for a comparison of Arduino versus STK500. I don't think anyone's ever sat down and presented that here (I can't remember seeing it anyway) but the bottom line is - if you want a cheap/quick start to AVRs get Arduino, if you don't mind spending a bit more but ultimately want more flexibility get an STK500

Cliff

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

A good first-start for beginners...
http://www.zbasic.net/forum/ and
http://www.zbasic.net/

Excellent A++ structure Basic programming. Like Visual Basic 6.