TASK:
* read a microcontroller data sheet.
* program your board to do something, with as many different programming languages and programming environments as possible.
Read data sheet to discover interesting facts
1) What is the difference between ATtiny 44 and ATtiny 44A?
ATtiny 44 was introduced in Dec 2005 to optimize manufacturing process and reduce current consumption. ATtiny 44A was introduced in Dec 2008 and is identical in functionality but differ in electrical characteristics. They were produced with seperate datasheets. Details can be found here: http://www.atmel.com/Images/doc8187.pdf.
2) What are the characteristics of an ATtiny44A?
a) There are 14 pins on this chip
b) VCC supplies voltage
c) GND is ground
c) Port B (PB3:PB0) is a 4-bit bi-directional I/O port with internal pull-up resistors
d) RESET (PB3) A low level on this pin for longer than the minimum pulse length will generate a reset
e) Port A (PA7:PA0) is a 8-bit bi-directional I/O port with internal pull-up resistors
f) Port A has alternate functions as analog inputs for the ADC, analog comparator, timer/counter, SPI and pin change interrupt
g) CPU(central processing unit) ensures correct program execution by accessing memories, performing calculations, controlling peripherals, and handling interrupts
h) There are three types of memory
Flash stores the compiled program even when the power is off
i) SRAM saves temporarily variables while calculating
j) EEPROM is for data storage
k) ATtiny44A features successive approximation Analog-to-Digital Converter (ADC). It generates a 10-bit result which is presented in the ADC Data Registers, ADCH and ADCL. ADCL presents only the low byte of the ADC conversion result and ADCH presents only the high byte. ADCL is read first, then ADCH. When ADCH is read, ADC access to the ADCH and ADCL Registers is re-enabled and a new result is provided.
3) What is a Watchdog Oscillator (found under item 6: Clock System in data sheet)?
It is a safety feature and an electronic timer designed to detect and recover malfunctions. Check out this blog for more details.
4) How do we specify Clock Sources?
Under 6.2 (Clock Sources) of the datasheet, Flash Fuse bits are selectable according to clock source represented in the table (table 6-1) shown. These clocking sources determine the stability of oscillation operations (timing or delays) before instruction execution begins, be it when the CPU wakes up or when starting from a reset.
Use Arduino as AVR ISP to install Bootloader onto Echo Hello ATtiny 44 board
Software Downloads: Arduino IDE Arduino ISP Older Arduino ISP Releases
Reference: http://highlowtech.org
Download ArduinoISP file: ArduinoISP.ino
Map of working process:
Install Arduino IDE> Install Arduino ISP> Connect Computer to Arduino> Upload Arduino ISP Sketch onto Arduino> Connect Arduino to Hello Board> Burn Bootloader onto Hello Board.
Here are some of the critical steps:
a) Installation of IDE and Arduino ISP can be found at http://highlowtech.org. The key is to download the driver through the "Additional Boards Manager URLs" field under File> Preferences. Then, install Arduino ISP via the in-built boards manager. Go to menu> tools> Board> Boards Manager. Ensure that the "Compilation" and "upload" checkboxes are selected.
avrdude: Device signature = 0x1e9207 avrdude: Send: Q [51] [20] avrdude: Recv: . [14] avrdude: Recv: . [10] avrdude done. Thank you.Download generated C Program codes: 03_Bootloader data for Attiny 44
digitalWrite(7, HIGH); // turn the LED on (HIGH is the voltage level) delay(1000); // wait for a second digitalWrite(7, LOW); // turn the LED off by making the voltage LOW delay(1000); // wait for a secondAmend the sketch again to create a fast blinking LED.
digitalWrite(7, HIGH); // turn the LED on (HIGH is the voltage level) delay(100); // wait for a second digitalWrite(7, LOW); // turn the LED off by making the voltage LOW delay(100); // wait for a secondAmend the "Button" sketch to light up LED when button is pressed.
// set pin numbers: const int buttonPin = 3; // the number of the pushbutton pin const int ledPin = 7; // the number of the LED pinAmend button states (swop the LOW and HIGH to change button state):
// check if the pushbutton is pressed. // if it is, the buttonState is HIGH: if (buttonState == HIGH) { // turn LED on: digitalWrite(ledPin, LOW); } else { // turn LED off: digitalWrite(ledPin, HIGH); } }
#include// constants won't change. They're used here to // set pin numbers: const int rx=1; const int tx=0; const int buttonPin = 3; // the number of the pushbutton pin const int ledPin = 7; // the number of the LED pin SoftwareSerial mySerial(rx,tx); // variables will change: int buttonState = 0; // variable for reading the pushbutton status int state; void setup() { mySerial.begin(9600); mySerial.flush(); // initialize the LED pin as an output: pinMode(ledPin, OUTPUT); // initialize the pushbutton pin as an input: pinMode(buttonPin, INPUT); } void loop() { while (mySerial.available() > 0){ state = mySerial.read(); } if (state == 'p') { digitalWrite(ledPin, HIGH); mySerial.print("Hello board says HELLO!!!"); delay(1000);} else { digitalWrite(ledPin, LOW); // read the state of the pushbutton value: buttonState = digitalRead(buttonPin); // check if the pushbutton is pressed. // if it is, the buttonState is HIGH: if (buttonState == HIGH) { // turn LED on: digitalWrite(ledPin, LOW); } if (buttonState == LOW) { // turn LED off: digitalWrite(ledPin, HIGH); mySerial.print("LED says YOU LIGHT UP MY WORLD!!!"); } } }
>avrdude -c usbasp -p t44 -U lfuse:w:0x62:m0xff:m -U hfuse:w:0xdf:m0xff:m [PRESS ENTER TO EXECUTE COMMANAD]