Task

  1. Individual Assignment: read a microcontroller data sheet
  2. program your board to do something,with as many different programming languages and programming environments as possible
  3. Group Assignment:compare the performance and development workflows for other architectures

Indivisual Assignment

This is a also exciting week for me ,this week is about Embedded programming,so as usual our instructor Suhas sir took review of what we have to do in this week and explained us the basic concept of programming how to read datasheet ,etc.

As I am already familiar with how to read datasheet and little bit about programming so for this week I decided I will document my assignment in very much descriptive manner if unknown person will read my assignment he will be able to understand the basic concept of programming


Architecture

so I started with the architecture, basically every embedded system is divided into two achitectures Harvard and von Neumann

What I have understand about this architechtures I am found comparative table format

Harvard vs von Neumann architecture

It's memory allocation models looks like

Harvard vs von Neumann model


Risc ,CISC

The RISC stands for(Reduced instruction set computing) and CISC (Complex instruction set computing). CISC has the ability to execute multi-step operations within one instruction set. It is the design of the CPU where one instruction performs many low-level operations.

RISC vs CISC


Microprocessor, Microcontroller

AMicroprocessor is a computer processor that functions like our CPU (central processing unit) on a IC(integrated circuit), In academic I used 8085 microprocessor,The microprocessor is a multipurpose programmable , register based IC that accepts data in binary (0,1) format as input, and output .and it processes according to instructions we provide in its program or memory. Microprocessors contain both combinational(In this output depends only upon present input.) logic and sequential( depends on present as well as past inputs to generate any output) digital logic.

A Microcontroller is a small computer on a single integrated circuit. A microcontroller contains one or more CPUs along with memory and programmable input/output . Program memory in the form of RAM, ROM . Microcontrollers are designed for specific embedded applications, while the microprocessors used in personal computers or other general purpose applications that consisting of various chips.

Microprocessor, Microcontroller


AVR microcontrollers

As per wikipeddia AVR is a family of microcontrollers developed by Atmel. These uses Harvard architecture with 8-bit RISC microcontrollers. AVR uses on-chip flash memory for program storage,
AVR microcontrollers has many applications as embedded systems like hobby kits and educational applications, Arduino It has open hardware development boards.

Basic families
    AVRs are generally classified into following:
  • tinyAVR – the ATtiny series
  • megaAVR – the ATmega series
  • XMEGA – the ATxmega series.

AVRFamily

For this week's assignment I used Attiny 44 which belongs to AVR family,so I am describing more about it

Indivisual Assignment-read datasheet

After understanding of the basic concept I started with reading of datasheet of,in
Assignment 7:electronic Design I made one PCB and programmed it by Neil's given program (how I programmed the board is described in assignment 7 in detail) in this week I have to make my own program so I decided I will programme that board to blink leds for that I should know the basic terminology and functionality of microcontoller used. I used Attiny44 on my pcb so I read and understand it's Datasheet

What is a data sheet?

It is a document that summarizes the performance, technical and software characteristics in enough detail that anyone can integrate the component into a system.
It usually made by the component manufacturer.An electronic datasheet specifies characteristics in a formal structure that allows the information to be processed by a machine. Such machine readable descriptions can facilitate information retrieval, display, design, testing, interfacing, verification, and system discovery.

Features

The ATTiny44 is high Performance, low Power 8-bit Microcontroller with advanced RISC architecture. These are its general features:

- 4K Bytes of Flash Program Memory

- 256 Bytes of Programmable EEPROM

- 256 bytes SRAM

- 12 general purpose I/O lines

- 32 general purpose working registers and 8-channel 10-bit ADC.

- Internal calibrated oscillator

- Operating voltage supply between 1.8 ~ 5.5V.


There are two kinds of ports:

- Port A pins are 8-bit bi-directional I/O port with internal pull-up resistors (pin names are from PA0 to PA7)

- Port B pins are 4-bit bi-directional I/O port with internal pull-up resistors (pin names are from PB0 to PB3).

This is the pin layout found in the datasheet:

Pinout

However, this layout is more visual and easy to understand

Pin layout

Block diagram

ATtiny44 is a low-power CMOS 8-bit microcontroller based on the AVR enhanced RISC architecture. By executing powerful instructions in a single clock cycle, the ATtiny44 achieves throughputs approaching 1 MIPS per MHz allowing the system designer to optimize power consumption versus processing speed.The AVR core combines a rich instruction set with 32 general purpose working registers. All 32 registers are directly connected to the Arithmetic Logic Unit (ALU), allowing two independent registers to be accessed in one single instruction executed in one clock cycle. The resulting architecture is more code efficient while achieving throughputs up to ten times faster than conventional CISC microcontrollers.


Programming

For programming ,on Saturday we had guest lecture of Ex-Fab Academy student Rohan Rege on basic of programming at Vigyan Ashram ,after that I decided I will start programming in arduino because it seems easier than programming in embedded c.

So,I started with installation of Attiny libarary first because in existing board manager there is no any board of attiny

Now we have to install it,so I go to File/preference and paste the url given by high low tutorial

then,go to tool/board/board manager here you can see the libarary for attiny by David A. Mellis

click install,and you will see the meaasge as libarary installed

  • then in tool/board you can see board for attiny
  • for starting I tried simple led blinking program given by Arduino and for adding twist I used DC motor instead of led with arduino. Then I used my "Fab ISP"programmer,while doing it works then I made my own program for blinking of two leds alternatively

    Program

    in above program you can find comment at each line for understanding the meaning of each command

    After writing this program the most important part is to check the select the option of board,port,processor,clock and programmer from tool dropdown menu

    Tool

    For above option I choose Board-Attiny44,Processor-Attiny44,clock-20mhz(because we used 20 Mhz resonator on my board),programmer-Usbtiny


    After this selection I compiled my program and upload it to my board via USBtinyisp

    Complie

    Program Explanation:
  • 1.Initialise/declare Port A pin 2 & 3 as a output.
  • 2.Make a pin PA3 high(glow).
  • 3.Delay of 1000 milisecond for the high condition of led.
  • 4.Make a pin PA3 low.
  • 5.Delay of 1000 milisecond for the low condition of led.
  • 6.Make a pin PA2 low
  • 7.Delay of 1000 milisecond for the low condition of led.
  • In short,when pin PA3 pin goes high(glow) pin PA2 should low(doesn't glow).Both should glow after delay of 1000millisecond alternatively.

    Uploading

    Then I tried same thing with embedded c language

    Embedded c

    Program Explanation:
  • 1.setup pin no.3 of portDfor output by setting bit3 of register DDRD high
  • 2.Turn on led on pin no.4
  • 3.leave output low.
  • So,after doing this programming we had why to use embedded c or high level programming languages instead of simple Arduino languages then our freind Rohan Rege explained the difference between the output of arduino and embedded c programming by using wave behaviour

    Embedded c program

    Arduino program

    Here we understand if there we need more accuracy in output arduino program takes little more time to execution of each instruction hence little variation in output occurs while in embedded c or other high programming languages it is minimised.


    Group Assignment

    In indivisual assignment we all used arduino controller so our instructor Suhas Sir suggest us to try "Rasbery Pi",he also explained us basic concept and programming of it,

    Group discusion

    so I understand that "Rasberry Pi" is a processor having ARM Processor IC and it works like our pc's CPU it has some advance features like,

    • it can process multi task at a time
    • it has simple editor
    • we can use python for program
    • It has inbuild usb,ethernet,camera port for interfacing

    First we tried simple led blinking ,then we add push button to it

    Push button program

    for programming we refered this pinout

    Raspberry Pi pinout

    After running program we made circuit connection

    Circuit

    then we got output as

    Experience of using different enviorment

    As I explained above I used Arduino and Raspberry pi ,so after working on this both I Found some advantages and disadvantages as well

    • Raspberry Pi is a fully functional computer, while Arduino is a microcontroller
    • Memory- Arduino has 0.002MB & Raspberry Pi has 512 MB so memory size of Raspberry is maximum so we can use it for higher applicastions
    • Clock Speed-Arduino has 16 Mhz and for Raspberry Pi it is 700Mhz so Raspberry Pi has max.rate of execution of any operation
    • On Board network-for Arduino it has no any network for Raspberry Pi it has wired ethernet network
    • USB-Arduino has One input only,Rasperry Pi has 2
    • Cost-Costwise there is no so far difference in both

    Over looking of advantaged and Disadvantaged of both I found Raspberry Pi is more releevant but in my case I used Arduino no.of times so I think it is easier to understand

    Difficulties & solution

    • In my indivisual assignment while I was trying to burn my bootloader ,it showed error as usbtiny and avrdude not recognized,my friend ManojSahukar helped me solve it out the problem was in my system it was drivers problem i checked out it in Zadig,I uninstalled and again installed it with lib32 usb then it works.
    • I got difficulties while soldering sometimes it was dry solder so I have to fixed it programming ,sometimes I was unable to understand the port their shiffting in embedded c.
    • Learnings

      • Loose connection affect lots,so soldering should be proper.
      • before programming we must read datasheet.
      • calcualtion of component value like resistor and capacitor matters.

      Summary

      • I have learnt to use read datasheet.
      • I have learnt to read others programmed and to make my own.
      • Embedded c is difficult but more reliable,accurate.
      • My USBisp is working properly

      Files