Week 8

In this week I will be programming the board that I fabricated in week 6 using Arduino language which is based on hardware programming language called processing, which is similar to the C language,This week assignment:

1. Group assignment: compare the performance and development workflows for other architectures

2.Individual assignment: read a microcontroller data sheet program your board to do something, with as many different programming languages and programming environments as possible

Learning outcomes

Chips comparson :

so, for the group assignment we decided to compare the speed of two different chips to see how fast each can solve a differential equation using a benchmark test. The chips that we are going to compare are the atmega328p and the ATmega32U4 which is basically an arduino uno and an arduino leonardo.here are some camparison between the two chips:

Atmega328p ATmega32U4
Cost $2.30 $4.41
# of Pins 28 28
Flash Memory 32Kb 32 KB (ATmega32u4) of which 4 KB used by bootloader
PWM Outputs 6 7
ADC inputs 6 on PTH; 8 on SMD 8


Attiny45 Data sheet :

Basic programming information:

  • The setup function: initializes the sets the values for the pins.
  • The loop function: is the one does exactly what its name implies, it repeats sequentially, enabling your application to change or behave.
  • Useful Arduino Codes:

    Code Descirption
    Int Defining a variable
    digitalWrite() Write a HIGH or a LOW value to a digital pin.
    digitalRead() Reads the value from a specified digital pin, either HIGH or LOW .
    #Define gives a name to a constant value before the program is compiled.
    pinMode() Configures the specified pin to behave either as an input or an output.
    analogWrite() Writes an analog value (PWM wave) to a pin
    Serial.println() Prints out values to the serial monitor
    for loop used to repeat a block of statements and it is helpful for any repeating action, and it is frequently used with arrays to manipulate data/pin collections.
    if statement it checks for a condition and then excute a the statement if the condition is met or true.

    Programming my board:

    I will be using my FABISP programmer that I made in week4 to program my PCB and here is how to do it :

    1. First download Arduino software on your computer from here
    2. Because I am are programming attiny45 micro-controller I need to download the attiny45 library in the Arduino boards manager that is created by Dave Mellis and to do that:
      • go to File>preferences>additional boards manger URLs and paste this link
      • Then go to Tools>boards manager>install the attiny45 package
    3. Now wire your circuit with your programmer and do the following settings:
    4. Now your circuit is ready to receive sketches from the Arduino software, I programmed my LED to light up when the button is pressed and here is the sketch I used :
    5. checking if it works :
    6. Blinking an led with C Language:

      • blinking an led is simple enough to do and I did it by simply toggling all the ports pins as explained in the code:
      • testing the function:

      Download the code:

      download »