Skip to content

Week09

# 9. Embedded programming

Group assignment

We will compared two AVR families in this section: ATtiny44 from the tinyAVR family and ATmega328P from the megaAVR family.

Feature Comparison in the table below there is a comparison between two of the most commonly used MCUs and the comparison is about (program memory type, program memory size, CPU speed, GPIOs count, etc…) and you can choose between these two MCUs based on the application that you want to use on

Programming using avr-dude avrdude is a program that is used to update or read the flash and EEPROM memories of Atmel AVR microcontrollers on FreeBSD Unix. It supports the Atmel serial programming protocol using the PC’s parallel port and can upload either a raw binary file or an Intel Hex format file. It can also be used in an interactive mode to individually update EEPROM cells, fuse bits, and/or lock bits (if their access is supported by the Atmel serial programming protocol.) The main flash instruction memory of the AVR can also be programmed in interactive mode, however this is not very useful because one can only turn bits off. The only way to turn flash bits on is to erase the entire memory (using avrdude’s -e option).

Reference

Programming Using Arduino IDE Arduino IDE is a special software running on your system that allows you to write sketches (synonym for program in Arduino language) for different Arduino boards. The Arduino programming language is based on a very simple hardware programming language called processing, which is similar to the C language.

Reference

C Vs. Arduino C the main difference between the C language and Arduino C language is that the Arduino C language Is a contest of some prebuilt functions and library and that will make the programming process easier compared to the C language but in terms of execution speed the C language is faster than Arduino C language .

Individual assignment

this week I program my board that I already make it in electronics design week . first of all, I read the datasheet then programed the board using the programer that I had made in electronics production week , in the programming process, I used Arduino IDE and the avrdude.

let’s take a look at the attiny44 data sheet

attiny44 Pin Configurations It is important to know that Attiny44 has 2 ports, port A has 8 pins and port B has 4 which means that we have 12GPIO (General Purpose Input Output) pins.

when we look at the block diagram down below we will see that port B and port A were connected to data registers before the data bus which will specify ports purpose based on the program that you upload it.

here are the Pin Description quoted from the datasheet .

Embedded Code for Board

#define pushButton 2

#define LED 3

bool state=false;

void setup() {

  pinMode(pushButton,INPUT);// my input of the my push button is in pin number 2
  pinMode(LED,OUTPUT);

}

void loop() {
  // put your main code here, to run repeatedly:
 state= digitalRead(pushButton);
if(state==false){
   state= digitalRead(pushButton);
  digitalWrite(LED,HIGH);
   delay(3000);
}

else{

  digitalWrite(LED,LOW);
}
}

Video

LED functioning hero shot


Last update: July 20, 2022