16th March - 22nd March 2022
Task to be carried out this week
Group Assignment
  1. compare the performance and development workflows for other architectures
  2. Click for Group Assignment
Individual Assignment
  1. Read the data sheet for your microcontroller
  2. Use your programmer to program your board to do something
  3. extra credit: try other programming languages and development environments
The softwares used during the week's assignment
  • Arduino IDE: Programming the board
  • Visual Studio: For Documentation
Action Plan
Date Work Allocation
16th March Prof. Neil's Lecture on Embedded Programming
17th March Reading and Understanding the datasheet of ATTiny 44
18th March Reading and Understanding the datasheet of ATTiny 44
19th March Documentation
20th March Programming my echo-hello board using Arduino IDE
21st March Documentation
22nd March Documentation
Introduction to Embedded Systems and Microcontrollers

Embedded System

System: A system is an arrangement in which all its unit assemble work together according to a set of rules to perform ore or more tasks.

Embedded system: As the name suggests, embedded means one thing being attached/fixed to another thing. An embeded system can be described as a computer hardware system having software embedded in it. An embedded system can either be an independent system or it can be a part of a large system. Embeded Systems can also be defined as Microcontroller or microprocessor based system which is designed to perform a specific task

Microcontrollers

A microcontroller is a small and low-cost microcomputer, which is designed to perform the specific tasks of embedded systems The general microcontroller consists of the processor, the memory (RAM, ROM, EPROM), Serial ports, input/output (I/O) peripherals on a single chip. It is also known as an embedded controller or microcontroller unit (MCU).

Microcontroller Microprocessor
Microcontrollers are used to execute a single task within an application. Microprocessors are used for big applications.
Its designing and hardware cost is low. Its designing and hardware cost is high.
Easy to replace. Not so easy to replace.
It is built with CMOS technology, which requires less power to operate. Its power consumption is high because it has to control the entire system.
It consists of CPU, RAM, ROM, I/O ports. It doesn't consist of RAM, ROM, I/O ports. It uses its pins to interface to peripheral devices

Source:tutorialspoint


Types of Microcontrollers Microntrollers can be divided into various categories based on memory configuration, bit configuration and instruction sets configuration.

Types of Microcontroller based on Bit configuration

  • 8-bit microcontroller:This type of microcontroller is used to execute arithmetic and logical operations like addition, subtraction, multiplication division, etc. For example, Intel 8031 and 8051 are 8 bits microcontroller
  • 16-bit microcontroller:This type of microcontroller is used to perform arithmetic and logical operations where higher accuracy and performance is required. For example, Intel 8096 is a 16-bit microcontroller.
  • 32-bit microcontroller:This type of microcontroller is generally used in automatically controlled appliances like automatic operational machines, medical appliances, etc.
Types of Microcontroller based on Memory configuration

  • External memory microcontroller:This type of microcontroller is designed in such a way that they do not have a program memory on the chip. Hence, it is named as external memory microcontroller. For example: Intel 8031 microcontroller.
  • Embedded memory microcontroller:This type of microcontroller is designed in such a way that the microcontroller has all programs and data memory, counters and timers, interrupts, I/O ports are embedded on the chip. For example: Intel 8051 microcontroller.
Types of Microcontroller based on Instruction Set configuration

  • CISC:CISC stands for complex instruction set computer. It allows the user to insert a single instruction as an alternative to many simple instructions.
  • RISC:RISC stands for Reduced Instruction Set Computers. It reduces the operational time by shortening the clock cycle per instruction.

AVR Microcontrollers

AVR was developed in the year 1996 by Atmel Corporation. The architecture of AVR was developed by Alf-Egil Bogen and Vegard Wollan and the name was derived from its developers and are also known as Advanced Virtual RISC. AVR Microcontrollers are available in 3 categories;

  • TinyAVR:Less memory, small size, suitable only for simpler applications
  • MegaAVR:These are the most popular ones having good amount of memory (upto 256 KB), higher number of inbuilt peripherals and suitable for moderate to complex applications.
  • XmegaAVR:Used commercially for complex applications, which require large program memory and high speed.

Comparison between the 3 types of AVR microcontrollers:

Series Name Pins Flash Memory Special Feature
TinyAVR 6-32 0.5-8 KB Small in size
MegaAVR 28-100 4-256KB Extended peripherals
XmegaAVR 44-100 16-384KB DMA , Event System included

Atmel ATtiny 44

The first part of this week's assignment was to read the data sheet of the microcontroller used in the board that I am going to program. Since, I am going to program my echo hello board and I used the ATtiny 44 microcontroller in my echo-hello board, I had to read the data sheet for ATtiny 44. The datasheet was quite huge and with my near to zero knowledge in electronics, I found the document quite overwhelming. However, we had a session on reading the datasheet by the local instructor and that greatly helped me in understanding about the microcontroller. I read the datasheet found on http://fab.cba.mit.edu and following are the information I learned.
ATtiny44 is a high performance, low-power CMOS 8-bit microcontrollers which is produced by Atmel Corporation. They are a part of AVR mocrocontroller family and are based AVR RISC(reduced instruction set computer) architecture. ATtiny 44 microcontroller has 14 pins, out of which 12 can be used for general purpose I/O lines. They have a 4KB flash memory with 256B EEPROM and 256B SRAM.

Some Features of ATtiny 44 are as follows;

  1. 8-bit, 14 pin microcontroller
  2. Architecture: Advanced RIC architecture; 32*8 General Purpose Working Registers
  3. Memory: 4KB flash Memory; 256 Bytes EEPROM; 256 Bytes SRAM
  4. Peripheral Feature:
    • one 8-bit and One 16-Bit Timer/Counter with Two PWM Channels;
    • 10-bit ADC(analog-to-digital converter)
    • Programmable Watchdog Timer with Separate On-chip Oscillator
    • Universal Serial Interface
  5. I/O and Packages: 12 Programmable I/O Lines
  6. Operating Voltage: 2.7 - 5.5V
  7. Speed Grade:
    • 0 - 10 MHz @ 2.7 - 5.5V
    • 0 - 20 MHz @ 4.5 - 5.5V

Pin Configuration: Pinout of ATtiny44 microcontroller

Pin Description

Pin Number Name Description
Pin 1 VCC Power Supply
Pin 14 GND Ground
Pin 2 PB0
  • XTAL1: Crystal Oscillator Input
  • PCINT8: Pin Change Interrupt 1, Source 8
  • CLKI: External Clock Input
  • Pin 3 PB1
  • XTAL2: Crystal Oscillator Output
  • PCINT9: Pin Change Interrupt 1, Source 9
  • Pin 4 PB3
  • RESET:Reset Pin is used to connect the microcontroller to the reset circuitry and generally reset pin takes active low inputs . Main purpose of reset pin is to monitor the power fluctuations supplied to microcontroller. When ever power goes above / below threshold voltage reset circuitry triggers an active low signal on Reset pin. (reference: quora) The reset pin can also be used as a (weak) I/O pin. To use pin PB3 as an I/O pin, instead of RESET pin, program ('0') RSTDISBL fuse.
  • dW: debugWire I/O
  • PCINT11:Pin Change Interrupt 1, Source 11.
  • Pin 5 PB2
  • INT0: External Interrupt 0 Input
  • OC0A: Timer/Counter0 Compare Match A output
  • CKOUT: System Clock Output
  • PCINT10:Pin Change Interrupt 1, Source 10
  • Pin 6,7,8,9,10,
    11,12&13
    Port A (PA7...PA0) Port A has alternate functions as analog inputs for the ADC, analog comparator, timer/counter,SPI and pin change interrupt

    Programming my echo hello board

    The next assignment for the week was to program our microcontroller board using the FabTiny ISP. I had already programmed my echo-hello board using Arduino UNO during the electronic design week. However, I had not tried programming with FabTiny ISP. So for this week's assignment, I tried programming my board using the FabTiny ISP I made in week 4. Before I began with the programmming, I made a SPI connector to using ribbon cables and 6-pin IDC for connecting the FabTiny ISP to my echo hello board. I checked the pin numbers on my board, FabTiny ISP and IDC connector and made the connections accordingly. Since I blew up the fuse on my FabTiny ISP, I had to use Arduino board to supply power and ground line to my ISP and board. I connected them using jump wires.

    Next I had to install the driver for the FabISP. I downloaded the driver file from adafruit and installed it on my PC. I then used Arduino IDE to program my board. I followed the same steps as those I followed when I programmed by board using arduino UNO board. You can find the detail steps here: assignment week 6. The only thing I changed was the programmer. I selected FabISP as the programmer instead of Arduino.



    Next I selected the blink program from the example. The LED is connected to pin 5 of my ATtiny 44 microcontroller and the corresponding pin in arduino is 8. Thus, I entered 8 in the program.


    I compiled and uploaded the program and the result was as follows;


    I also tried the button program from the examples. I changed the LED pin to 8, and button pin to 7. (pin 5 and 6 on ATtiny 44 microcontroller)