Fab Academy 2017
Learn how to make ALMOST anything!

Embedded Programming


For this week, it was required to Read a microcontroller data sheet. Program our Echo Hello board to do something, with as many different programming languages and programming environments as possible.

 

Datasheet is the biography and manual of any electronic component. They explain exactly what a component does and how to use it. Before you start doing anything or even designing any circuit, looking at the datasheet is crucial. It holds important information like Powr supply requirements, Pins Configurations and descriptions, Electrical ratings and Schematic of the IC circuit.

 

To start with this task, I first looked at this amazing article on Sparkfun website under the title of How to Read a Datasheet, and then downloaded the ATTiny 44 datasheet and started looking at it.

 

First of all, In the begining, you can see generally the features, and from the most important features: The memory, Number of pins and Operating voltage and others.

Memory. Number of pins.
Voltage. Power consumption.
 

Secondly, This is what your work most depends on: Pins Configuration.

 

You'll notice different labels on the pins and most of all, that they are separated into 2 categories "PA" and "PB". These designations are important especially if you are programming with C language, as you'll be required to define the Ports and the data in it. And that what you'll find exactly in "Pins description" section.

 

VCC, GND, PB description

VCC, GND, PB description

After that, the document continues to explain in details the architecture overview; which is greatly helpful to start AVR Programming.

Architecture Overview

There is a lot to study and read about the data sheet, but that would satisfy as a basic info.

 

Programming the Board:

For Programming Echo Hello Board I mainly used Arduino IDE and Arduino C for the code.

And then, moving along the final project, I used C language for programming the slave board. And that's where knowing the ports was really important.

 

Arduino Code:

                        int Button = 6; // Pad connected to digital pin 2
                        int LED = 7;   // LED connected to digital pin 7
                         float voltage;

                        void setup(){
                          pinMode(LED, OUTPUT);      // sets the digital pin 13 as output
                          pinMode(Button, INPUT);      // sets the digital pin 7 as input
                        }

                        void loop(){
                        digitalWrite (LED, LOW);

                        if (digitalRead(Button)==1) {
                          digitalWrite(LED, HIGH);   // turn the LED on (HIGH is the voltage level)   
                          } 
                        else {
                         digitalWrite (LED, LOW);
                         }
                        }

 
                    
 

Downloads:

1. Arduino Code.

2. Final Project Slave circuit code.