- Get link
- X
- Other Apps
- Get link
- X
- Other Apps
Programming ATmega328 in Assembly using Arduino IDE and Arduino Uno Development Board
L1........
What is an Embedded System?
It is an integration of Sensors, Actuators and Intelligence with a system to produce more capable, versatile and robust performance.
When to use a microcontroller?
Microcontroller is used when:
- Intelligence is required in the system.
- the complexity reduction of a system is needed.
- Once has to reduce the system design cost.
- A variety of sensors and actuators must be integrated in the system.
- Communication with other devices is necessary.
We will using C/C++/Arduino/Assembly language for higher speed functins/FPGA for highest speed(VHDL).
Microcontroller Manufacturer
- AMCC
- Atmel
- Comfile Technology Inc.
- Coridium
- Cypress Microsystems
- Dallas Semiconductor
- Elba Corp.
- Freescale Semiconductors
- Fujitsu
- Holtek
- Infineon
- Intel
- Microchip Technology
- Natinal Semiconductor
- NEC
- Parallax Inc.
- Philips Semiconductors
- PICAXE
- Renesas Technology
- Silabs
- Silicon Motion
- STMicroelectronics
- Texas Instruments
- Toshiba
- Western Design Center
- Ubicorn
- Xemics
- Xilinx
- ZiLOG
Assembly language is main topic of discussion here, because it performs really fast and very good for time critical operations.
L2........................
Other than Microcontroller there are some other SOC that implies intelligence, so here, some comparison is done between
- uC vs ASIC
- uC vs CPLD
- uC vs DSP
- uC vs FPGA
- uC vs PLC
- uC vs uP
and the comparison is based on the following features...
- Computational Power
- Ease of programming
- Speed of Operation
- Interrupts
- Ease of Interface(analog and digital)
- Overall system cost
- Reconfiguration(How easy to configure for other tas)
- Versatility(How many other tasks it can be configured for)
- Communication with other devices
- Timer/Counter Functions
- Handing Media
- Overall time required(the time required to start working with it for the first time).
Follow the website for different available Arduino Uno shields
Arduino Yun has the same basic arduino along with linux core that can run linux OS.
Arduino Uno Overview
GPIO
- can be used as input or output
- Each pin can be uniquely assignable
- Analog(PWM) output on digital pins 3,5,6,9,10,11
- Analog pins 0-5 can also be used as GPIO
- Pull Up resistor with every GPIO pin is present
Digital Inputs:
Pull up resistors are used to avoid the floating pin problem. when the button is pressed GND will be detected at the input pins and when unpressed it is 5V. If we dont use the pullup resistor and connect the point directly to the 5V it will burn the uC because of high current sinking into the uC.
In this case we can use internal pull resistor but it need more info about the input port but we will see it later.
Analog Inputs:
- Takes a continuous valued input signal from 0-5V, it can be from any sensor.
- Assign the input a value from 0-1027.
Let say the input signal is coming from cruise control or techometer, you need to be careful that the input signal must not go too beyond the 5V level else it will damage the Arduino. Arduino quantize these voltages in a value from 0-1027. Whenever we are reading the analog value it is always instantaneous. Think about aliasing here, that it is going to effect the reading while sampling.
Analog(PWM) Output:
Analog output is produced by means of generating the PWM signal, varying the duty cycle varies the output voltage between 0-5V.
Software comparison that are used to develop code for Arduino
This table gives an idea what tool you should be using for your project. If your application is speed critical then use ASM language. Although, for applications that doesnt need too much speed but needed less development time then you should go for Arduino IDE.
In order to utilize the each and each function of microcontroller assembly is used here. There are some features that cannot be used with the use of Arduino IDE like: internal temperature of Atmega328, 10bit PWM.
L3....................
Here will be focusing on Arduino IDE, one can use processing either.
Arduino IDE is based on C/C++. In Arduino we are gonna be using two function
- void setup(), where you are do all the necessary setup that are needed to be executed once
- void loop(), you need to write the part of code that is required to be executed forever
In case you want to brushup you programming skills in C, please click on the link...
Now, you will be writing the very first code using Arduino IDE that does nothing and compiles perfectly.
Implementation of shifting and scaling circuit:
- left opamp is working as a shifter and the right opamp is doing the scaling
- S2 is the supply voltage, that is equal to positive opamp biasing voltage
- choose the resistor value using the equation below
if we move the wiper all the way up then there will no resistance, while full 5k resistance is present in case the wiper is all the way down. Loading effect cannot be seen here because of the high input resistance of the pin configured as input.
Analog Outputs:
- PWM
- There are two types of PWM signal Unipolar and bipolar
- Arduino has only unipolar PWM signalling
- Bipolar is used mostly in motor that can run in either direction
- R-2R Ladder network
- DAC chips/shield
- Hack-method follow the link..
Low pass filter: will eliminate all the frequency below the f, it doesn't effect the signal amplitude level but it filters the noise present the signal. The filter below is called as active filters because the passive ones doesn't works as well as active.
If the digital signal is at the TTL level then it can be directly connected to the micro-controller. However, mostly, the real life signals are analog, and these signals are susceptible to noise like ESD, spikes, lightening strikes etc and hence to avoid these noises entering the processor we use optoisolators. Optocouplers are commonly used in automotive industry.
Pull up resistors:
Switch debounce hardware: when we press a mechanical switch, its level doesnt get stable in single go, but it oscillates between a range of voltage values first, then gets stable, hence this problem is called as switch debounce problem. However, this doesnt happen in optical switches.
In order to avoid this debounce problem the two methods are used: one is by means of using a low pass filter and shmidt trigger, other is using the logic gates. The low pass filter removes the debounces and then the signal passes to the shmidt trigger that is a bit slow circuit and hence what ever the input debounce comes, gets estabilished by the shmidt trigger, then the cleaned signal goes to the uC.
CMOS vs TTL: CMOS is one form of digital technology and TTL is also a form of digital technology but different from CMOS, lets look how these two technologies are different from each other so that their interfacing problem with each other can be resolved. Their logic levels are defined below.
- In TTL, 0-0.8 is considered as logic low during input to TTL circuit. However, 2-5V is considered as logic-high during input to TTL circuit.
- When TTL circuit writes high to a pin it can be anything from 2.7v to 5v, although, for low it is 0-0.5v
- similarly one can see for CMOS
- CMOS is very good for switching
- CMOS is necesserily be between 0-5v, but it can any voltage higher than 5V like: 10V and so
Arduino digital I/O pins are TTL Compatible.
TTL to CMOS conversion circuits:
CMOS to TTL conversion circuits:
TTL to RS232:
- RS232 is an old serial communication standard but still being used quite a lot.
- typical voltage values for RS232 are +-15V, but it could be +-25V.
Power Interfacing: power interfacing can be done using relay switching through the use of a transistor being switched from uC.
Human reaction time is around 10Hz.
L6.......................
- Get link
- X
- Other Apps
Comments
Post a Comment