I'd like to try programming an individual microcontroller, and I have a project in mind. I'd need at least 3 data pins w/ pulse-width modulation, a timer (I'm somewhat uneducated on oscillators, but I'm sure anything would do), and >3902 bytes of memory. I'd also like something low-power and compact, able to run on a button-cell battery(?).
My question is:
what microcontroller satisfies these conditions?
how/with what do you program it (on a Mac without a serial port)?
are these conditions even reasonable?
is there a better resource? (considering this goes beyond the realm of Arduino)
I've never done any such programming, and the Duemilanove has made it easy, but I'd like to try going beyond Arduino. Any help is appreciated.
Whether or not you need an external oscillator depends on what the timing is used for
if you've got an arduino board look at this for programming: http://arduino.cc/en/Tutorial/ArduinoISP
www.avrfreaks.net might be worth checking out if you're planning on using an AVR based microcontroller
I guess I mean to say that I need some guided introduction to programming directly to a microcontroller. Unlike the Arduino, they don't have a USB port, so it isn't as straightforward. If anything, I'd like to stipulate that the microcontroller have about 4kB, but whatever gets me started is okay. I was wanting to get an Arduino-based prototype implemented onto a more suited chip (a simple mood light based on values returned by the logistic map ( Logistic map - Wikipedia ) and used to light an RGB LED), but again, whatever gets me started programming will work.
Oh, so you need a bit more information than I gave.
Programming a microcontroller in 3 easy steps: 1) Write Code 2) Compile 3) program it in
I haven't tripped on any guides for using avr-gcc to compile code, so I'm not much use with compiling.
The microcontroller thats mounted on an arduino board has a boot block programmed to allow itself to be programmed over serial port, and the USB is provided by a USB -> Serial chip
Do you need 4KB of ram or program memory?
at the bottom of that ArduinoISP page that I linked, they show 6 wires going from the arduino to the breadboard. 2 for power and 4 for the actual programming. I've seen programmers that connect via serial, LPT, or USB. Personally I have a USBtinyISP
http://www.ladyada.net/learn/avr/
AVR Tutorial - AVRDUDE This page describes using avrdude to write to a microcontroller
Since your planned end result is powered by a battery, check the datasheet for what the max speed you can run it at. IIRC the atmega168 requires more than ~4.5 to run at 16mhz
? Operating Voltage:
– 1.8 - 5.5V for ATmega48V/88V/168V
– 2.7 - 5.5V for ATmega48/88/168
? Temperature Range:
– -40°C to 85°C
? Speed Grade:
– ATmega48V/88V/168V: 0 - 4 MHz @ 1.8 - 5.5V, 0 - 10 MHz @ 2.7 - 5.5V
– ATmega48/88/168: 0 - 10 MHz @ 2.7 - 5.5V, 0 - 20 MHz @ 4.5 - 5.5V
I'd go with an atmega168 or atmega328 as I know they'll be easy to get ahold of.
Of course, a ladyada tutorial. Thank you.
really, step 1 and 2 aren't a problem. I think the ATtiny45 seems about right, since it has 4kB of program memory (and is low-key; I don't think I need either a fast or precise clock). I can also try the USBtinyISP, assuming I can put it together.
These are the minimum connections required for the ATTINY45 to function. In our application, the MOSI (Master Out Slave In) and MISO (Master In Slave Out) and SCK (Serial Clock) pins will be used for the ISP programming header. That leaves two general purpose I/O pins (PB3 and PB4) for our use. The chip will be using its built-in internal oscillator as its clock, so no external crystal needs to be attached.
I'm reasonably sure that you could put a jumper or a switch between the MOSI,MISO, SCK pins and your LED circuit, and have programming work when the LED is not connected to the chip.
A suggestion on which pin to use: Pin 7 is PB2, so you'd be using PB2 -> PB4
The reset pin needs to stay a reset pin for programming
https://web.archive.org/web/20210401041952/http://www.uchobby.com/index.php/2007/11/04/arduino-avr-in-system-programmer-isp/
I think this might be my programmer. I'm sure I'll get some sort of in-system setup going, but I'm not worried about accommodating ISP with this project. If that's the case, don't I have six pins (8 - vcc and ground) to work with? Also, I'm not sure how common PWM is, but does the ATtiny45 have it?