[07] Embedded Programming


Read a microcontroller data sheet. Program your board to do something, with as many different programming languages and programming environments as possible. For this I am using my USBtiny programmer.

Attiny 44 Datasheet

One of the important things of reading the datasheet is to identify the name or number of the PINS that we are going to use. For example, Arduino uses diferent numbers to identify their PINS. Fo me was very useful to have these 3 images while I was programming.

Programming in Ubuntu with AVRDUDE

I used as a template the "hello.ftdi.44.echo.c file and hello.ftdi.44.echo.c.make files, that you can get from the class site.

  1. Modify the .C code file.
  2. It is important to identify the name of the pins you are using. In this case I am programming for a blinking light that stop blinking when you press the button.

    C Code: Button and blink

    Pin Mapping
    LED 1= PA7 = Pin 7
    Button = PA3 = Pin 3 
    int main(void)
    	DDRA |= _BV(PA7);	// Enable output on LED pin 7
    	PORTB = _BV(PA3);	// Activate button
    	// Loop
    	while (1)
    		if (PINA & _BV(PA3))
    				PORTA |= _BV(PA7);	// turn LED on
    				PORTA = 0;			// turn LED off
    				PORTA = 0;			// turn LED off
  3. In the console move to the directory where the your files are.
  4. cd (your path here)/
  5. Compile the program.
  6. $ sudo make -f hello.ftdi.44.echo.c.make
  7. Tell the microchip to use the external clock so the programmer can talk to it.
  8. $ sudo make -f hello.ftdi.44.echo.c.make program-usbtiny-fuses
  9. Upload the program use through the terminal.
  10. $ sudo make -f hello.ftdi.44.echo.c.make program-usbtiny

Programming in Arduino

Arduino was easier, the only things is that you need to install the package that lets the Arduino Ide talk to the ATTiny44A.

  1. Add Board Managers
  2. Menu > Preferences - and type:



  3. Install the board manager.
  4. Tools > Board > Boards Manager
  5. Configure the Tools.
  6. Board: ATtiny24/44/84

    Processor: ATtiny44

    Clock: External 20MHz

    Port: (Choose the correct one)

  7. Code.
  8. I used the example code for a Button.
  9. Upload the program use through the programmer.