Week 9. Embedded Programming

The main objectives were to read a microcontroller data sheet, program your board to do something with as many different programming languages and programming environments as possible. As the group assignment we had to Compare the performance and development workflows for other architectures

Reading a microcontroller datasheet

To begin with, I selected the data sheet for ATtiny44A microcontroller as it is used for my programmer. After going through the datasheet I got a general idea of how the ATTiny44A works.

It is a high Performance, low Power AVR 8-bit Microcontroller having advanced RISC architecture, in which most of the 120 instructions are executed in 'Single Clock Cycle Execution' and it has 32 x 8 general purpose working registers as well. In addition to that, it includes12 programmable I/O Lines (8 + 4) and the operating voltage is between 1.8 to 5.5V.

The ATtiny 44A pin configuration can be shown as below.

Fig. ATtiny 44A pin configuration

Pin mapping for the also shown here which is useful when programming the microcontroller. Refference

Fig. Pin mapping

Embedded programming

To begin with the programming, I created a new ISP cable. It required a ribbon cable and 2 pieces of 2x3 female connectors. After pressing the connectors into the cable to make the connections I was able to make the cable.

Fig. ISP cable

Programming the board

The operators for programming work on on the individual bits inside the byte. These are the basic operators used while programming.

The ATtiny44A version 14-pin SOIC has following Pin Configurations:

To start the programming the following items are required.

Programming with Arduino IDE

First I downloaded and installed Arduino IDE and the to setup it, I used the instructions given by SpenceKonde.

Go to File -> Preferences, and enter the URL http://drazzy.com/package_drazzy.com_index.json in "Additional Boards Manager URLs".
Then Tools -> Boards -> Boards Manager Select "ATTinyCore by Spence Konde" and click "Install".

Fig. edit preferences

Fig. edit board manager

Next step is to select the following settings in the tools.

Fig. tool settings

Before executing any code select Burn Bootloader option which will make the fuses and connect the board. For burning the bootloader, USBtinyISP needs to be connected.

First I check the working of the board with the given examples from Arduino. The Button example was opened and executed initially. After putting the correct pins after checking I modified the code to work to turn the LED ON when the button is pressed and turning the LED OFF when the button is released.

Fig. Arduino code for Turn on LED when press the button

Vid.LED turn ON

Next, I modified it to do the opposite in which it turns the LED OFF when the button is pressed and turning the LED ON when the button is released.

Fig. Arduino code for Turn off LED when press the button

Vid.LED turn Off

After that, I introduced a delay to the code and programmed the LED to blink when I pressed the button and to turn off when releasing the button.

Fig. Arduino code for blinking LED when press the button

Vid.LED blink

Setting up Atmel Studio

First I opened the Atmel studio software and added AVRDude tool using external tools, which will automatically program the board straight through from the location of built .hex -file.

First, navigate to the Tools > External Tools : click Add for adding a new tool and following settings should be included.