Week - 9
Embedded Programming
Assignment
Group Assignment
•compare the performance and development workflows for other architectures
Individual Assignment
•read a microcontroller data sheet •program your board to do something, with as many different programming languages and programming environments as possible
Individual Assignment
What is Datasheet
Datasheet is the document that summarizes the performance and other technical characteristics of the component. It's a basically a "manual for micro-controller" which describes the function of particular IC and its components.
Reading the datasheet it's a tough thing to do, as it's plenty of information and it has more than 300 pages. Although I wanted to read of all it, it seems like impossible. Instead you should be looking at it generally and then go through it specifically, on the points that really matter to your project or what you want to do.
ATtiny 44A Datasheet
I started reading the "Micro-controller Datasheet" to get a general idea about the Micro-controller and its structure. I used attiny44 for my hello-world board. The attiny 44A is an IC with 14 pins. 1. The datasheet gives us pin configuration which help us while soldering as well as programming. We can find out our mistakes while programming the board by using this pin configuration.
2. The IC has few fixed or dedicated pins like MISO, SCK, MOSI and RESET.
VCC - This pin where voltage supplied.
GND - Ground pin
Port B(PB3...PB0)is a 4-bit bi-directional I/O port with internal pull-up resistors.
RESET - The reset pin can also be used as a (weak) I/O pin.
Port A (PA7..PA0) is a 8-bit bi-directional I/O port with internal pull-up resistors. Port A has alternate functions as analog inputs for the ADC, analog comparator, timer/counter, SPI.
The next part is block diagram as below:
ATtiny24A/44A are low-power CMOS 8-bit micro-controllers based on the AVR enhanced RISC architecture.
Attiny44A has 12 general purpose I/O lines, 32 general purpose working registers. The main function of the CPU core is to ensure correct program execution. The CPU must therefore be able to access memories, perform calculations, control peripherals, and handle interrupts.
Then the Architectural view is as shown below:
The AVR uses a Harvard architecture with separate memories and buses for program and data.
Programming Hello-World Board
We have to program the hello-world board with different programming languages, as mention below:
Using Arduino IDE
As I didn't know programming I had a help of a friend to do so and also I kept referring this tutorial that was very useful for me. To program the board I used Arduino. Arduino software can be downloaded from here
On opening the software this is what you are welcomed with
Arduino supports a number of boards but unfortunately, it doesn't come with Attiny family pre-installed. So I had to do that manually. The following link will help with that.
https://raw.githubusercontent.com/damellis/attiny/ide-1.6.x-boards-manager/package_damellis_attiny_index.json
The URL has to be pasted in the preference menu in the location shown
Then when you open up the board manager in tools attiny will show up. I then installed it.
After installing the attiny family,first we burn the code,then we upload the blink code in hello-world board.
Done burning bootloader
Code Uploading done
Blink code is running in a circuit. LED blinks after every 1 sec
Code uploading for button has done
LED on/off after pressing the button
Embedded C
I just lookout programming using C in proteus and try to write code for my hello board.
Generating Hex File
program my hello board using my FabISP, For that first we need to download Proteus from Here, and install it.
then creat a new project as shown following steps.
After creating project go to firmware, write code and compile it.I have written code for this assignment is shown below.
And Here is the schematic to simulate my code.
After compilation we can find our hex file inside debug folder which will be in the project folder, and name the name of file will be "Debug.hex".
Buring hex file using Avrdude
The First step is to download the Avrdude. you can download it from Here, and install it.
Now to use Avrdude we need to add its path.As shown below steps.
Now open the command prompt, by writting "cmd" in search.
To check the avrdude installed properly we need to type avrdude in command prompt. when you see following lines means avrdude is working properly.
The next step is to go to the location of your hex file in CMD and use "cd" command to change directory In my case the location of hex file is "C:\Users\Preferred Customer\Documents\ATTINY44\Debug"
If you are also using FabISP programmer or USBtiny programmer and your board contains ATtiny44 like me, then you can use this (avrdude -v -pattiny44 -cusbtiny -Uflash:w:Debug.hex:i) command to push you hex file to your microcontroller.
Commands that I have used for buring hex file in avrdude is given Here
Following video shows the output of above program that I have written in Proteus using WinAVR.
Group Assignment
- compare the performance and development workflows for other architectures
What is the Difference between 8051, PIC, AVR and ARM?
Nowadays, Microcontrollers are so cheap and simply obtainable that it is general to use them instead of easy logic circuits like counters for the sole reason of gaining some design flexibility and discount some space. Some machines and robots will even rely on a huge number of microcontrollers, each one enthusiastic to a confident task. Mainly fresh microcontrollers are ‘In System Programmable’ it means that you can be adjusting the program being executed, without removing the Microcontroller from its position. In this article we are discussing about the difference between AVR, ARM, 8051 and PIC Microcontrollers.
What is a Microcontroller?
A micro-controller can be comparable to a little stand alone computer; it is an extremely powerful device, which is able of executing a series of pre-programmed tasks and interacting with extra hardware devices. Being packed in a tiny integrated circuit (IC) whose size and weight is regularly negligible, it is becoming the perfect controller for as robots or any machines required some type of intelligent automation. A single microcontroller can be enough to manage a small mobile robot, an automatic washer machine or a security system. Several microcontrollers contains a memory to store the program to be executed, and a lot of input/output lines that can be a used to act jointly with other devices, like reading the state of a sensor or controlling a motor.
8051 Microcontroller
8051 microcontroller is an 8-bit family of microcontroller is developed by the Intel in the year 1981. This is one of the popular families of microcontroller are being used all across the world. This microcontroller was moreover referred as “system on a chip” since it has 128 bytes of RAM, 4Kbytes of a ROM, 2 Timers, 1 Serial port, and 4 ports on a single chip. The CPU can also work for 8bits of data at a time since 8051 is an 8-bit processor. In case the data is bigger than 8 bits, then it has to be broken into parts so that the CPU can process easily. Most manufacturers contain put 4Kbytes of ROM even though the number of ROM can be exceeded up to 64 K bytes.
PIC Microcontroller
Peripheral Interface Controller (PIC) is microcontroller developed by a Microchip, PIC microcontroller is fast and simple to implement program when we contrast other microcontrollers like 8051. The ease of programming and simple to interfacing with other peripherals PIC become successful microcontroller.
We know that microcontroller is an integrated chip which is consists of RAM, ROM, CPU, TIMER and COUNTERS. The PIC is a microcontroller which as well consists of RAM, ROM, CPU, timer, counter, ADC (analog to digital converters), DAC (digital to analog converter). PIC Microcontroller also support the protocols like CAN, SPI, UART for an interfacing with additional peripherals. PIC mostly used to modify Harvard architecture and also supports RISC (Reduced Instruction Set Computer) by the above requirement RISC and Harvard we can simply that PIC is faster than the 8051 based controllers which is prepared up of Von-Newman architecture.
AVR Microcontroller
AVR microcontroller was developed in the year of 1996 by Atmel Corporation. The structural design of AVR was developed by the Alf-Egil Bogen and Vegard Wollan. AVR derives its name from its developers and stands for Alf-Egil Bogen Vegard Wollan RISC microcontroller, also known as Advanced Virtual RISC. The AT90S8515 was the initial microcontroller which was based on the AVR architecture, though the first microcontroller to hit the commercial market was AT90S1200 in the year 1997.
ARM Processor
An ARM processor is also one of a family of CPUs based on the RISC (reduced instruction set computer) architecture developed by Advanced RISC Machines (ARM).
An ARM makes at 32-bit and 64-bit RISC multi-core processors. RISC processors are designed to perform a smaller number of types of computer instructions so that they can operate at a higher speed, performing extra millions of instructions per second (MIPS). By stripping out unnecessary instructions and optimizing pathways, RISC processors give outstanding performance at a part of the power demand of CISC (complex instruction set computing) procedure.
ARM processors are widely used in customer electronic devices such as smart phones, tablets, multimedia players and other mobile devices, such as wearables. Because of their reduced to instruction set, they need fewer transistors, which enable a smaller die size of the integrated circuitry (IC). The ARM processors, smaller size reduced difficulty and lower power expenditure makes them suitable for increasingly miniaturized devices.
link
"Click here"to download all files of this week
Automatic Hot Water Dispenser by Tariq Ahmed Shaikh is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
Based on a work at http://fabacademy.org/2019/labs/khairpur/students/tariq-ahmed/