Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

AVR Dragon: My first chip

Status
Not open for further replies.

HarveyH42

Banned
Well, took a couple weeks off from dealing with getting this thing started. We got busy at work (holidays), and I had a week vacation coming up.

Cables: Ended up making some, sort of... Had some motors with header sockets and cables. Was able to remove the cables and pin sockets from the holder. Soldered two together, some heatshrink... Not real pretty, and a tight fit on the header pins (the heatshink is a little too thick). Figured it would at least get me started. Somebody could cash in on making cables and jumpers, not much out there ready-made.

I went with a beginner's example for flashing an LED. It was for a different chip, but all AVRs are suppose to have the same core, also figured the assembler would take care of the tech stuff with the include file. Took me some searching manually through the directories to find where the include files were, and figure out which one for the Tiny13 I planned to use.
The simple program just wrote 255/FF to a register, then went to an endless loop that decremented the register and sent out to PortB. I took a few shortcuts on the breadboarding, but figured it wouldn't do any harm. The beginner's guide didn't show any hardware setup, so I had a programmed chip, but needed to hook it up solo. My mind was still flooded with all the stuff I'd been ready since beginning this adventure. Resets, pull-up resistors, tri-states, which pin out of the 6 will actually be flashing the LED??? So, obviously thinking too much... I just went with a 7805 regulator and a 9v battery for the power supply (no capacitors, battery shouldn't cause any issues, and didn't have any .33 uf or ,1uf values handy and didn't want to go on a treasure hunt). Put a 220 ohm resistor in series with a red LED, didn't calculate the actual value need, just a basic 'safe' value that was sitting on the bench,

Applied power, the LED came on, but didn't seem to flash. Couldn't really tell if it dimmed or anything. Switch to some of the other pins, but got the same results. Did kind of think it fluctuated, but not obvious enough to call it success.

Pull the chip off the breadboard and went back to the programmer. I changed the program to use a seperate register for the counter, and another to hold the value for output. 255 was loaded to both registers, and then it goes to the first count down loop. This should turn on the LED, and keep it on. When the ZERO flag is set, I branched to a second loop, but with 0 being set out to portb. When the counter reaches zero, it branches back to the first loop. Wrote the chip, plugged it back into the breadboard, and it flashes. I haven't checked all the I/O pins, but got the same off 2 of the 6.

The first one wasn't too bad. Didn't have much trouble with the assembler or programmer. Wasn't a great example to start with, but maybe it was meant for that other chip.

Anyway, I'm in business, and got a week to play with my new toy...
 

Attachments

  • Tiny13Leds.txt
    170 bytes · Views: 242
  • Tiny13ledsF.txt
    336 bytes · Views: 200
Decided to see how the 6 I/O pins work on the chip, so added some more LEDs and resistors, wrote a new program to sequence them. Had a problem when I first powered it up. The LED on pin 1 came on, maybe half bright, but nothing elsle. Pin 1 is also used as a reset, figured that was screwing up the works. Pulled the wire, and the rest started flashing, not exactly in sequence though, but only one LED on at a time. Re-arranged a couple of wires, works fine, except for the pause where the pin 1 LED should have been.
Need to either see if there is a fuse for disabling the reset, or just change the program. Really need to sit down and do a PCB that I can leave hooked up to the programmer. Pulling the chip off the breadboard every time kind of bites.
Need to get some more cables put together. Order some parts, but don't expect them for a week.

Think I made a good choice in microcontrollers. The instruction set is similar to the 6502 I worked with many years ago (Commodore 64). These first two experiments went well, a few problems, but simple to fix.
 
Disabling the reset pin for I/O makes the device unprogrammable in ISP mode, you'd need to use high voltage programming in order to reprogram, your AVR at that point. If you find yourself needing more I/O there are ways of using a simple shift register to get as many I/O lines as you want, or just buy a bigger AVR. It's good to try out a few different kinds.
 
I bought 3 different ones, the Tiny13 is just the first one I started plaing with. Just experimenting and exploring at this point. This was my first time putting it all together. I want to learn more about the features and limitations of this one, before I move up. I've got some Tiny2313 and Mega48 to work with too. Kind of wanted to do a RGB led fading project with Tiny13 and the PWM, but it only has two channels. Have to save that for the other chips.

The reset can get disabled, kind of stuck with the HV programming for now, barely enough jumpers to configure the Dragon, nothing to go off board as yet (week or so).
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top