Embedded programming


As per wikipedia, this is the defination of data sheet "A datasheet, data sheet, or spec sheet is a document that summarizes the performance and other technical characteristics of a product, machine, component (e.g., an electronic component), material, a subsystem (e.g., a power supply) or software in sufficient detail that allows design engineer to understand the role of the component in the overall system. Typically, a datasheet is created by the manufacturer and begins with an introductory page describing the rest of the document, followed by listings of specific characteristics, with further information on the connectivity of the devices. In cases where there is relevant source code to include, it is usually attached near the end of the document or separated into another file." Datasheets are the most reliable source to fully and percisely understand about any components or softwares.

The AVR family is classified into following

tinyAVR (ATtiny)
megaAVR (ATmega)
Xmega (ATxmega)

The data sheets for tiny44 processor can be found here. This is the processor that I am using for the Board that I am programming today.

The summary document contains the main features of the MCU, the pinout diagram, architecture overview, register summary, assembly instruction set and packaging information. To fully understand the micro-controller, it is required to read the full datasheet.

Below is the pin configurations of the ATtiny24A/44A/84A, all three of them has the same architecture

There are three hardware register memory locations: DDRxn, PORTxn and PINxn Lower case x is the number letter for the port and n represents the number. DDRx pins set the direction of the pin. If logic one is written on DDRxn, Pxn is configured as an output pin. Conversely, if DDRxn is written logic 0, Pxn is configured as input. One particularity, is that if the data direction register is configured for input and PORTxn is written logic one, an internal pull-up resistor in PORTxn is activated. When DDRx bits are set to logic one (as output), the PORTx register will control if that pin is set to low or high.

Alternate Function of PIN A and PIN B

Clock Speed Distribution

Clock Speed Distribution :The Clock System section of the datasheet tells us that the ATtiny44A can derive its system clock from different sources: internal RC oscillator, low-frequency crystal oscillator, crystal oscillator or external clock source. The clock signal passes through a clock multiplexer circuit and from there, to a pre-scaler unit. There is also a watchdog oscillator, which is used to reset the MCU if the watchdog timer is not reset with the WDR instruction within a prescribed time interval. The watchdog timer is initially disabled, but can be enabled by writing a logic 1 to the WDE bit in the WDTCSR (Watchdog Timer Control and Status Register).


The hello world board that we made last time will be brought to life this week through programming. Firstly we need to program the tiny44 processor to accept codes that we will code. To do this we have to download sample code from HERE

For this process I connected the header of the Fab ISP to the header of my hello world board. Now remember to get the right pin into right place, if its the other way it doesn't work. After connecting the USB , start loading the source code into the board using git bash or terminal in Ubuntu. I have used Git-bash and i have used these commands
make -f hello.ftdi.44.echo.c.make
make -f hello.ftdi.44.echo.c.make program-usbtiny-fuses
make -f hello.ftdi.44.echo.c.make program-usbtiny

I didn't try coding other language into my board yet, but I am planning to do eventually.

Other Architecture

For other architecture we explored Raspberry Pi b + and we coded a small Python code to make use of the GPIO ( general purpose input / output ) Pins and we made an LED blink. The cool thing about raspberry pi is that its not just a microcontroller but its a whole computer at the size of Credit card so we can even upload full OS into it. There are multiple of OS available to be used as raspberry pi OS which is cool