News:

SMF for DIYStompboxes.com!

Main Menu

Arduino and PICs

Started by spargo, August 26, 2011, 03:12:14 AM

Previous topic - Next topic

Beo

#20
Quote from: harmless on March 18, 2012, 08:50:57 AM
For my next one, I'm going to try to use the Uno as a programmer for an ATTiny of some sort (only a few bucks each and smaller/easier to include in a layout).

Can the Uno be use as a programmer for the ATTiny chips? I notice some of the Atmel development boards don't seem to support the 14pin ATTiny chip configurations.

Update: here is a handy diy RS232 programmer cable, that uses PonyProg to program ATTiny chips:
http://electronics-diy.com/avr_programmer.php
But I think safer might be getting the Atmel ISP programmer:


Another update: The Kanda USB STK200 starter kit looks like a great deal, at 75$. The USB ISP interface is included, and ports are broken out with headers for a variety of chip types. Fully compatible with most commonly used software and IDEs, AVRStudio and WinAVR C in particular. Unfortunately, the 14 pin chips are ISP only, so would have to breadboards separately for development. Still, the Atmel ISP by itself is 35$, and for 75$ you can get this and all of the development and expansion capability for other chips.


harmless

http://hlt.media.mit.edu/?p=1229

This is apparently verified.  You can use the arduino as a programmer (loading a programmer program on the arduino uno itself) and there are also definitions that let you use the Arduino IDE to write attiny code.

Beo

Quote from: harmless on March 18, 2012, 02:29:45 PM
http://hlt.media.mit.edu/?p=1229

This is apparently verified.  You can use the arduino as a programmer (loading a programmer program on the arduino uno itself) and there are also definitions that let you use the Arduino IDE to write attiny code.

That's pretty cool, and only 20$ investment on the arduino uno. Is programming using arduino a lot different than C or Basic?

g_u_e_s_t

you can program arduino with c
its often easier than using the arduino language

harmless

I haven't done C in a while, but the Arduino language was sufficiently C-ish that i jumped right in.  I haven't tried doing structs or anything, but I did have an array of function pointers that basically represented input pot change handlers and that worked just fine.

Mark Hammer

I finally picked up an Uno Rev3 this weekend.  It has been exactly 30 years since I last delved into machine language, and thinking in terms of registers, ports, which bits are high and low, and handshaking.  A wee bit rusty.

RG had sent me a couple of 16F628 PICs and a PIC programmer, in the hopes of converting me, and I am ashamed to say I failed him.   :icon_redface:  I still hope to get back to it one day, but for now it is in someone else's hands.

I thought the Arduino platform might provide an easier introduction.  Certainly, the widespread availability of various inexpensive "shields" that are optimized for relevant sorts of projects e.g.,:  http://www.makershed.com/Arduinos_Accessories_s/43.htm ) makes it more enticing.

I did come across some posts on a forum regarding use of freestanding Atmega328UP processors, so I am given to believe, rightly or wrongly, that one could conceivably develop something using the Arduino board, burn it into a 328 with the board, and then use that chip elsewhere, replacin gthe one on the board with another fresh one.

or do I misunderstand?

I still find it funny that my very first personal computer - a 2mhz Acorn Atom - came with two 8-bit parallel ports, NO A/D, 8k of EPROM, and 12k of RAM, and set me back about $500 1982 dollars.

Beo

#26
Quote from: Mark Hammer on March 19, 2012, 02:49:40 PM
I finally picked up an Uno Rev3 this weekend.  It has been exactly 30 years since I last delved into machine language, and thinking in terms of registers, ports, which bits are high and low, and handshaking.  A wee bit rusty.

Andrew's bit operation primer was a quick refresher for me. With this, and all the available projects and code that's out there, I'm hoping the learning curve is quick. I'm looking forward to playing with LCD displays, and learning more about PWM and it's applications.
http://tech.thetonegod.com/micro/io_digital.html

I'm struggling to decide where to put my initial investment dollars... a Dragon board, an STK500 board, an Uno Rev3 or just an ISP programmer. I figure I'll start off as a breadboard warrior and only need ISP, but who knows where this might take me...
Update: or Dragon plus Dragon Rider 500... so many choices:
http://www.ecrostech.com/AtmelAvr/DragonRider/index.htm

harmless

Quote from: Mark Hammer on March 19, 2012, 02:49:40 PM

I did come across some posts on a forum regarding use of freestanding Atmega328UP processors, so I am given to believe, rightly or wrongly, that one could conceivably develop something using the Arduino board, burn it into a 328 with the board, and then use that chip elsewhere, replacin gthe one on the board with another fresh one.

or do I misunderstand?

Though I haven't tried it, I think you're correct.  The arduino itself is basically the 328 plus some supporting stuff (ftdi / usb? voltage regulator, serial chip).  The route I'm trying to go is using an ATTiny, which comes in 8 and 14 pin flavors but has almost all of the core functionality of the atmegas.  It should be a bit easier to layout than those giant 328 things.

Mark Hammer

#28
Wha-hoo!

Fired it up last night and managed to get a blue LED blinking to my commands.

I dug up a 16X2 (or maybe its a 20 x 2) HD77480-based LCD display module last night that I must have bought a decade ago.  Gonna try and learn how to write stuff on it with the Arduino.

Future, here I come!!!   :icon_eek: :icon_rolleyes:

G. Hoffman

I've been programing PICs in Assembly for a year or two now -with long stretches of not even looking at them, mind you - and I'm very glad I did so, because ASM gives you a good understanding of the physical hardware in the chip, which I find valuable.  But I've been working on a project that is just too big for ASM, and for that matter for a PIC16, so I'm feeling a need to learn C (PIC18's really aren't meant for ASM programing!), and I have found it a difficult jump.  So, I bought myself an Uno a couple weeks ago, and as soon as I have time I'm going to start using that as a stepping stone to learning C. 

As for which is better, I don't think either is better overall, just better for a particular person doing a particular task.  Choose the one that will work best for you, and then go from there.



Gabriel

Hal

Quote from: Mark Hammer on March 19, 2012, 02:49:40 PM
I did come across some posts on a forum regarding use of freestanding Atmega328UP processors, so I am given to believe, rightly or wrongly, that one could conceivably develop something using the Arduino board, burn it into a 328 with the board, and then use that chip elsewhere, replacin gthe one on the board with another fresh one.

or do I misunderstand?

Glad to finally be able to help you, Mark, after all these years ;)

The one tiny gotcha with this is that the AVR chip must first be loaded with a bootloader before you can program it via USB. The bootloader is a tiny program that runs whenever the AVR is reset, and tells it to check the serial port (which the USB connects to, via the FTDI chip) to see if it's being programmed. You can buy 328s with the bootloader programmed in already, or you can buy an ISP programmer and load it in yourself. The ISP programmer can then plug straight into your arduino to burn the bootloader onto a fresh chip. In fact, you can use the ISP programmer to write your program directly; I would recommend using this on any sort of final product that you would pull out of the arduino, so you don't have to wait for the bootloader on reset.

I use this one: http://www.adafruit.com/products/46. It works just fine for me.

Atmel sells a very similar one that is ~$30 or so. You can also make one yourself, but for $20, it's probably not worth the trouble.

Also, don't worry about failing RG. As long as you're programming in C, it's easy enough to switch back and forth between AVR and PIC. Not quite as easy as between AVR and some other processors (PICs have some quirks), but easy enough.

cpm

i used the parallel cable to burn the bootloader to some of the arduinto's atmega 128, using the arduino board pins.
Reused an old LPT printer cable and wired the socket as described in some web pages, and send the bootloader directly from the arduino IDE.
The problem is modern computers they dont come with a parallel port anymore...