Group Assignment: Compare the performance and development workflows for other architectures
In lecture, Neil already discussed these basic architectures Harvard and Von-Neumann. Here i will start by comparing them and we will then move forward.
Von Neumann architecture is a very basic architecture as it uses the same memory for storing data and instructions, where as Harvard is relatively advanced architecture. Best thing about harvard architecture is that it uses two different memories, one for data and one for instructions. Hence processing speed is improved. Thanks to google below we can see detailed comparison of both these architectures.
Von-Neumann Architecture
Harvard Architecture
Single memory to be shared by both code and data.
Separate memories for code and data.
Processor takes code/instructions in a separate clock cycle and data in another clock cycle. So it requires two clock cycles.
Single clock cycle does the job, as separate buses are used to access code and data.
Higher speed, hence less time consuming.
Slower in speed, hence more time-consuming.
Simple in design.
Complex in design.
Next i would like to discuss other architectures as CISC and RISC. Below shown table will help us understand these two architectures.
CISC
RISC
Easy to program larger set of instructions.
Difficult to program even smaller set of Instructions.
Simpler design of compiler, considering larger set of instructions.
Complex design of compiler.
Many addressing modes causing complex instruction formats.
Few addressing modes, fix instruction format.
Instruction length is variable.
Instruction length varies.
Higher clock cycles per second.
Low clock cycle per second.
Emphasis is on hardware.
Emphasis is on software.
Control unit implements large instruction set using micro-program unit.
Each instruction is to be executed by hardware.
Slower execution, as instructions are to be read from memory and decoded by the decoder unit.
Faster execution, as each instruction is to be executed by hardware.
Pipelining is not possible.
Pipelining of instructions is possible, considering single clock cycle.
There are many more architectures to discuss but let's just leave it here and start programming our board.
Individual Assignment: Read a microcontroller data sheet, program your board from electronic design week to do something, with as many different programming languages and programming environments as possible
For this week i thought of making a general purpose board that can be used now and also for future assigments. Hence i chose and made atmega32u4 board. It is always good to know what are you dealing with or what are you working on.. Hence reading a datasheet is as important as results of a project. Because if you don't choose correct equipment for your task/project you definitely won't get the desired results. So let's start with reading a ATMEGA32U4 datasheet.. I won't go in depth yet will just tell you about the key features.
Atmega32U4 is a low power CMOS 8-bit mocrocontroller based on the AVR enhanced
RISC architecture.
By executing powerful instructions in a single clock cycle, the ATmega32U4 achieves throughputs approaching 1 MIPS per MHz allowing the
system designer to optimize power consumption versus processing speed.
Port B (PB7...PB0): Port B is an 8-bit bi-directional I/O port with internal pull-up resistors.
Port B has better driving capabilities than the other ports.
Port C (PC7,PC6):Port C is an 8-bit bi-directional I/O port with internal pull-up resistors.
In port C only bits 6 and 7 are present on the product pinout.
Port D (PD7...PD0):Port D is an 8-bit bi-directional I/O port with internal pull-up resistors.
Port E (PC6,PC2):Port E is an 8-bit bi-directional I/O port with internal pull-up resistors.
In port E only bits 6 and 2 are present on the product pinout.
Port F (PF7...PF4, PF1,PF0):Port F serves as analog inputs to the A/D Converter.
Port F also serves as an 8-bit bi-directional I/O port, if the A/D Converter channels are not used.
In port F bits 2 and 3 are not present on the product pinout.
Port F also serves the functions of the JTAG interface.
D- : Pin no. 3. USB Full speed / Low Speed Negative Data Upstream Port. Should be connected to the USB D-connector pin with a serial 22 Ohms resistor.
D+ : Pin no. 4. USB Full speed / Low Speed Positive Data Upstream Port. Should be connected to the USB D+connector pin with a serial 22 Ohms resistor.
UCAP: Pin no. 6. USB Pads Internal Regulator Output supply voltage. Should be connected to an external capacitor (1µF).
VBUS: Pin no. 7. USB VBUS monitor input.
RESET: Pin no. 13. Reset input. A low level on this pin for longer than the minimum pulse length will generate a reset, even if the clock is not running.
XTAL1: Pin no. 17. Input to the inverting Oscillator amplifier and input to the internal clock operating circuit.
XTAL2: Pin no. 16. Output from the inverting Oscillator amplifier.
AVCC: Pin no. 24 and 44. AVCC is the supply voltage pin (input) for all the A/D Converter channels. If the ADC is not used, it should be externally connected to VCC.
If the ADC is used, it should be connected to VCC through a low-pass filter.
AREF: Pin no. 42. This is the analog reference pin (input) for the A/D Converter.
VCC: Pin no. 14 and 34
GND: Pin no. 15, 23, 35 and 43
Hence below shown is the pinout of ATMEGA32U4
I actually downloaded schematic and board files from my local instructor's page and reworked board file, as it had some traces shorted no voltage regulator.
Whereas in my board i added a voltage regulator to get 12V and 5V from the board and shuffeled a few traces that were overlapping after milling. Below is shown the schematic..
And this was the final board after the changes i made.
Next i did mill the board with SRM20 by first generating rml files and then operating the machine. You can find the detailed process in electronics design week. This is how it looked in the end..
Soldered it..
As by now our board is ready
Hence let's go and program it. To do so.. Open/Download and install arduino.
Arduino is one the most widely used programming enviroment.
Open arduino and connect your board physically on the serial port.
Now go to tools > select your board as arduino leonardo and check if it has been recognized by your device manager. If yes click burn the bootloader and wait.
Next is nothing but programming your board as your board is ready.. if the bootloader has burnt succssfully!
Click on file(top left corner) go to examples > basic > fade.
Open fade program and click on upload button.
Hence by now your program has been uploaded so below is the output.. LED fading in and out as programmed. Tan Tara!
Now i used another programming enviroment to program my board and that was python. Oh yes!
I actually programmed my board using this famous package/library called pyfirmita from python. Firmata is a generic protocol for communicating with microcontrollers from software on a host computer. It is intended to work with any host computer software package. It is sort of an interface for microontrollers, and PYFIRMITA is interface for python to program hardware.
First open arduino click on files > go to examples > go to Firmita > click on/open StandardFirmita
Now following window pops-up with different liberaries and stuff needed for the purpose.
Upload the program to your board as earlier we did and that is it our leonardo is ready communicate with python.
Now download and install python. I already have worked with python so i have it installed on my PC with editor of my choice(pycharm). You can find alot of help on youtube in this regard so go and install python and come back. Note: To run anything with python different packages are needed like in our case we will need pyfirmita one of the python packages. It is very difficult sometimes to import packages using command line, but i must tell you this- with pycharm installed on your desktop its no big deal. Let's see how..
In pycharm open it as i hope you have installed it by now..
go to files > settings
go to project interpreter which shows you, your installed packages. click on this plus(+) sign which pops-up a window of packages you can install. writepyFirmita here in search bar and you will get the package just by clicking install at the bottom of this window.
If all goes well you will have it installed, and that is it..
Now we have our program following video that demostrates the working, In this program computer/board asks user to define how many time he/she wants led to blink? And as user enters the value, led blinks specified number of times and that is it.
Click here to get design files.. Happy programming!