Skip to content

9. Embedded programming

Assignments for the week

Group assignments

  • Compare the performance and development workflows for other architectures

Individual assignment

  • Read a microcontroller data sheet.
  • Program your board to do something, with as many different programming languages and programming environments as possible.

Requirements

  • Documented what you learned from reading a microcontroller datasheet.
  • What questions do you have? What would you like to learn more about?
  • Programmed your board
  • Described the programming process/es you used
  • Included your code

Group assignments

There is a page compare difference between AVR, ARM, 8051 and PIC. Link here

They differ from cost, communication, power consumption. For basic, simple application, cheap and available one will be a good choose.

And development workflows comparation depends on test and experience, sometimes is less important than performance and cost.

Individual assignment

Read a MCU data sheet : attiny 44A

I had check datasheet of attiny 44A for choose of capacitors that crytal need in week 7.

Port A and B both has internal pull-up resistors and mutiple mode.

About CPU, Memory, Clock.

About Pins

Hardware resources needed for serial communication.

About SPI interface used for ISP.

About power consumption.

About packaging.

History of datasheet.

Program your board to do something

Programming

This week I use Arduino IDE and Arduino Nano to programing the board.

After downgrade Arduino IDE to 1.6.9.0, I can programing attiny 45 borad. But when I programming attiny 44a, the IDE returns an error.


avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x15
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x15
avrdude: stk500_getparm(): (a) protocol error, expect=0x14, resp=0x14
avrdude: stk500_getparm(): (a) protocol error, expect=0x14, resp=0x01
avrdude: stk500_initialize(): (a) protocol error, expect=0x14, resp=0x10
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to overridethis check.

Try it again


avrdude: Expected signature for ATtiny44 is 1E 92 07
Double check chip, or use -F to override this check.

Remake a new board, it works.

code


/*
Modify from Blink of Arduino sketch exsample.
*/

// the setup function runs once when you press reset or power the board
void setup() {
// pin 3 for LED and 2 for button
pinMode(2, INPUT);
pinMode(3, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
int button = digitalRead(2);
if (button == HIGH){
digitalWrite(3, HIGH);   // turn the LED on (HIGH is the voltage level)
delay(50);              // wait for 50 mili second
digitalWrite(13, LOW);    // turn the LED off by making the voltage LOW
delay(1500);              // wait for a  1.5 second
}
else {
    digitalWrite(3, HIGH);   
    delay(50);
    digitalWrite(13, LOW);
    delay(50);
    }
}