Read a microcontroller data sheet.
Program your board to do something, with as many different programming languages and programming environments as possible.
Optionally, experiment with other architectures
*Identify relevant information in a microcontroller data sheet.
*Implement programming protocols.
*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.
During this time I have learned a lot in practice, but it is always essential to link it with theory, to know the essence of what we are doing, so in this space I will share what I understood the Data sheet, I am not an expert , But it is important that we understand the following together:
For these activities the microcontrollers Attiny 44, Attiny 45 and Atmega328P
A microcontroller is a programmable integrated circuit, capable of executing commands recorded in its memory. It is composed of several functional blocks, which fulfill a specific task. A microcontroller includes in its interior the three main functional units of a computer: central processing unit, memory and I / O (input/output) peripherals.
Okay, I'll explain you:
I'm showing you this picture just for find the differents between them.
Now let's go into the most relevant detail.
High performance, low power AVR® 8-bit microcontroller
4K byte of in-system programmable program memory flash (Atmel® ATtiny44.
Two Timer/Counters, 8- and 16-bit counters with two PWM channels on both.
10-bit ADC
14-pin SOIC, twelve programmable I/O lines
Operating voltage: 2.7 - 5.5 VDC
Speed grade: 0 - 8MHz at 2.7 - 5.5VDC, 0 - 16MHz at 4.5 - 5.5VDC
A low level on reset input for longer than the minimum pulse length will generate a reset, even if the clock is not running.
So, we can say that this microcontroller has 8-pin for the port A and 4-pin to the port B. Alimentation of 5vDC, ground and pin to reset.
The pins of the ports A and B are of digital input and output, in the port A we have converters analog/digital and also they can be used as analog pins.
High performance, low power AVR® 8-bit microcontroller
2/4/8K Bytes of In-System Programmable Program Memory Flash
8-bit Timer/Counter with prescaler and two PWM channels
8-bit HIGH SPEED Timer/Counter with separate prescaler
-2 High Frequency PWM Outputs with Separate Output Compare Registers
- Programmable Dead Time Generator
10-bit ADC
-4 single ended channels / 2 differential ADC channel pairs with Programmable Gain (1x, 20x)
8-pin SOIC
Operating voltage: 2.7 - 5.5 VDC for ATtiny45
Speed grade: 0 – 10 MHz @ 2.7 - 5.5VDC, 0 - 20 MHz @ 4.5 - 5.5VDC
A low level on reset input for longer than the minimum pulse length will generate a reset, even if the clock is not running.
So, we can say that this microcontroller has 6 programmable I/O lines. Alimentation of 5vDC, ground and pin to reset.
The pins of the port B are bi-directional I/O with internal pull-up resistors (selected for each bit).
High performance, low power AVR® 8-bit microcontroller Family
131 Powerful instructions
32KBytes of In-System Self-Programmable flash program memory
1KBytes EEPROM
2KBytes Internal SRAM
Two 8-bit Timer/Counters with separate prescaler and compare mode
One 16-bit Timer/Counter with separate prescaler, compare mode and capture mode
Real time counter with separate oscillator
Six PWM channels
8-channel 10-bit ADC in TQFP and QFN/MLF package
6-channel 10-bit ADC in PDIP package
Two master/slave SPI serial interface
One Programmable Serial USART
One Byte-oriented 2-wire Serial interface (Philips I2C compatible)
23 programmable I/O lines
28-pin PDIP, 32-lead TQFP, 28-pad QFN/MLF and 32-pad QFN/MLF
Operating voltage: 1.8 - 5.5VDC
Speed grade: 0-4MHz at 1.8 - 5.5VDC, 0-10MHz at 2.7 - 5.5VDC, 0-20MHz at 4.5 - 5.5VDC
So, we can say that this microcontroller have 3 Ports, Digital supply voltage, supply voltage pin for the A/D Converter, analog reference pin for the A/D Converter, ground and pin to reset.
I was practicing since Assignment 4, using some Fab Academy 2016 webpages as references, to be able to program because this is the first time I have contact with everything related to microcontroller programming.
I can do it! Here i'm writing to you how I have done.
I worked with Attiny 44 microcontroller ATMEL.
First, I read a microcontroller data sheet. Through this image I will explain you what I understood:
That allowed me to observe and understand the order and role of each pin. As you can see, some pins accept digital outputs, analog inputs or both of them.
You can control up to 4 servo or DC motors (4 PWM), or read the signal up to 8 analog sensors (PORTA), or 12 digital signals (PORTA and PORTB).
I use Arduino IDE to program my echo hello world board. For that is required: FabISP programmer and FTDI cable.
You must install the Windows drivers of both cables and also download Arduino IDE.
Then you open the software and you will see it as I show you in this image.
Go to "tools" and make sure to set:
Boars:"ATtiny24/44/84"
Processor:"ATtiny44"
Clock:"External 20MHz"
Port:"COM12(Arduino/Genuino Uno)
Programmer:"Arduino as ISP"
Then open an example/digital/Button.
Change "const int": buttonPin=10 and ledPin=6. Give it a Check and start compiler.
In my process, when it was compiled, I switched ports to use the USBtinyISP from COM 12 to COM 23 and then compiled again.
At this part I found a mistake because my LED did not work. Then I stopped for a while to understand what was happening, because according to me I had been doing everything right.
But actually, it was not like that, I had written the wrong pin number, because I was not using the Arduino equivalence. So, I wrote again "const int": buttonPin=3 and ledPin=7. And compiled again.
Yay! But the LED was still on, so I checked again and change the status: From "digitalWrite (ledPin, HIGH)" to "digitalWrite (ledPin, LOW)" and viceversa, to turn the LED on and off.
Also I used my FabISP.
//Author: Ingrid Midori Nuñez Yamaguchi
//Fabacademy 2017
//Assigment: Embedded Programming
const int button = 3; // Set button as pin3
const int led = 7; // Set let as pin3
int counter = 0; // create a variable to store a counter
int buttonstate = 0; // create a varible to store the state of the button
int laststate = 1; // create a variable to store the last state
void setup(){
pinMode(button, INPUT); // Set button as an input pin
pinMode(led, OUTPUT); // Set led as an input pin
}
void loop(){
buttonstate = digitalRead(button); //We read the state of button, it returns a '0' when is connected to GND (doesn't pressed) and '1' when is connected to Vcc (pressed)
if (buttonstate != laststate) //We compare the buttonstate and our laststate, button is not pressed, buttonstate = 0. So, buttonstate is not equal to laststate.
{
if (buttonstate == HIGH) //It pass, but buttonstate is not high.
{
counter++; //This means counter plus 1.
}
else //It pass to here, where there is nothing.
{
}
}
laststate = buttonstate; //Now, laststate is equal to '0'.
if (counter % 2 == 0){ //It means when counter is an even number, returns '0'. Continue with example, counter is '0'.
digitalWrite(led, LOW); //Here, led is low. Modulo of '0' is '0', so led is Low.
} else{
digitalWrite(led, HIGH); //Led changes to high.
}
}
//Now, when we pressed button.
//Buttonstate is '1'.
//Buttonstate is not equal to laststate.
//Now, buttonstate is equal to high, counter is '1'.
//Laststate is '1'.
//Modulo of 1 is not equal to '0'.
//So, led is high. We can see, led is turn on.
//In this way it continuous. Each time, button is pressed, led goind to turn on, then turn off, so on.
In the file you will find the description of each line of code
Each time the buttom is pressed the led changed its state
And achieve this challenge, as you can see in this video:
I achieved this challenge!!!!! I programmed my board of the assignment 6 (echo hello-World board) using the Arduino IDE and my FabISP.
I could write the code to burn my board.
I failed, but I could finally fix the mistakes and my board works as well.
For those who are first-timers in programming I recommend that you do the procedures in order: first identify the equivalencies of the micro-controller with the software you are going to program with.
I should try with more options to program boards.
I enjoyed this challenge.
I understood how important is to read the data sheet, it allows you to get better results from the design and facilitate the programming process.
Here: week10week14 you will find more about datasheets
I programmed my board, it works!.