Professional Documents
Culture Documents
Sand Theft
Sand Theft
INTRODUCTION
both features usually Belong to "general purpose computers", the line of nomenclature
blurs even more.
Physically, embedded systems ranges from portable devices such as digital watches
and MP3 players, to large stationary installations like traffic lights, factory controllers, or the
systems controlling nuclear power plants.
In terms of complexity embedded systems can range from very simple with a single
microcontroller chip, to very complex with multiple units, peripherals and networks mounted
inside a large chassis or enclosure.
HISTORY:
In the 1960s, computers possessed an ability to acquire, analyze, process data, and
make decisions at very high speeds. However there were some disadvantages with the computer
controls. They were: high cost, program complexity, and hesitancy of personnel to learn.
However the new concept of electronic devices was evolved. They were called programmable
controllers which later became a part of embedded systems. This concept developed from a mix
of computer technology, solid state devices, and traditional electro mechanical sequences. The
first mass-produced embedded system was the Autonetics D-17 guidance computer for the
Minuteman missile released in 1961. It was built from discrete transistor logic and had a hard
disk for main memory.
REQUIREMENTS OF TYPICAL EMBEDDED SYSTEMS: EX: CHEMICAL PLANT: Consider a chemical plant. No. of temperatures have to be measured
&based on values certain operations are performed, such as opening a value.
INPUT: - From sensors which measure temperatures.
OUTPUT: signal that controls a value.
Ex: MOBILE PHONES: The processor of a mobile phone needs to carry out a great deal of
communications protocol processing to make "TELEPHONECAL.
CHARACTERISTICS:
Embedded systems often use a (relatively) slow processor and small memory size with an
intentionally simplified architecture to minimize costs.
They often have no operating system or a speciali8zed embedded operating system (often
a real-time operating system ).
Programs on an embedded system often must run with resources: often there is no disk
drive, operating system, keyboard or screen. may replace rotating media, and a small
keypad and screen may be used instead of a PC's keyboard and screen.
Cellular telephones.
Computer network.
Disc drives.
Thermo stats.
Sprinklers.
House-hold appliances.
Medical equipment.
SIL3/SIL4 IEC for transportation and nuclear systems, 99% compliant with the Motor
Industry Software Reliability Association (MISRA-C:1998) C Coding Standards
APPLICATIONS
C/OS-II is used in a wide variety of industries:
Avionics
Medical Equipment/Devices
Industrial Controls
Consumer Electronics
Automotive
FEATURES
The features of C/OS-II include:
Runs on the largest number of processor architectures with ports easily downloaded.
MULTI-THREADED APPLICATIONS
Application developers who write code for use in multi-threaded environments will
find the support critical when protecting shared objects using system locks, filestream locks, and thread-local storage (TLS) in multi-threaded environments.
Micrium and IAR collaborated in providing the first thread-safe support in C/OS-II
for the IAR DLIB run-time library. Protection for such non-re-entrant functions as
strtok (), rand (), errno () and more are local to each thread. Global and static variables
typically used by these functions are protected by the Micrium kernel.
CHAPTER 2
MICROPROCESSOR AND MICROCONTROLLER
EVALUTION OF MICROPROCESSOR AND MICROCONTROLLER
Microprocessors and microcontrollers are used in embedded system products. An
embedded product uses a microprocessor (or microcontroller) to do one task and one task
only.
Microprocessor as the term come to be known is a general purpose digital computer
central processing unit. Although popularly known as a "computer on chip", the
microprocessor is in no sense a complete digital computer.Microprocessor CPU contains
Arithmetic Logical Unit, a program counter, a stack pointer, some working registers, a clock
timing circuits and interrupt circuit.
To make complete microcomputer memory must add, usually Read Only Memory,
Random Access Memory, memory decoders and an Input/Output devices. In addition special
purpose devices such as interrupts, counters may be added to relieve the CPU from time
consuming counting or timing chores.
The hardware design of microprocessor CPU is arranged so that a small or very large
system can be configured around the CPU as the application demands. The internal CPU
architecture as well as the resultant machine level code that operates that architecture is
comprehensive but as flexible as possible.
The prime use of microprocessor is to read data perform extensive calculations on that
data and store those calculations in mass storage devices or display the results for user use.
The program is used by microprocessor are stored in the mass storage devices and loaded into
RAM as the user directs.
A microcontrollers is a computer on a single chip .Micro suggest that the device is
small and controller tells that the device is used to control objects, process or events.
Microcontroller is a highly integrated chip that contains all the devices comprising a
computer. Typically this includes a CPU, RAM, Input/ Output ports, timers, interrupts. So
microcontroller is also called as "true computer on a chip". Unlike a general purpose
computer which also includes all of these devices. A microcontroller is designed for a very
specific task to control a particular system.
A microcontroller is a general purpose device but one that is meant to read data,
perform limited calculations on that data and control its environment based on those
calculations. The prime use of microcontroller is to control the operation of machine using a
fixed program that is stored in ROM that does not change over the life time of the system.
ADVANTAGES OF MICROPROCESSOR AND MICROCONTROLLER
cost is less
speed is more
compact device
Most microprocessor have operational codes for moving data from external
MICROCONTROLLER
Microcontroller can be termed as a single on chip computer which includes
number of peripherals like RAM, EEPROM, Timers etc., required to perform some
predefined task.
switching the AC off automatically when room temperature drops to a certain defined limit
and again turning it ON when temperature rises above the defined limit.
There are number of popular families of microcontrollers which are used in
different applications as per their capability and feasibility to perform the desired task, most
common of these are 8051, AVR and PIC microcontrollers. In this article we will introduce
you with AVR family of microcontrollers.
History of AVR
AVR was developed in the year 1996 by Atmel Corporation. The architecture
of AVR was developed by Alf-EgilBogen and VegardWollan. AVR derives its name from its
developers and stands for Alf-EgilBogenVegardWollan RISC microcontroller, also known as
Advanced Virtual RISC. The AT90S8515 was the first microcontroller which was based on
AVR architecture however the first microcontroller to hit the commercial market was
AT90S1200 in the year 1997.
AVR microcontrollers are available in three categories:
1.
TinyAVR Less memory, small size, suitable only for simpler applications
2.
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.
3.
Series name
Tiny AVR
Mega AVR
Xmega AVR
Pins
6-32
28-100
44-100
Flash Memory
0.5-8 KB
4-256KB
16-384KB
Special Feature
Small in size
Extended peripherals
DMA , Event System
included
ROM
8KB
8KB
16KB
16KB
32KB
32KB
RAM
EEP
I/0
Ti
Inter
Operation
Operating
Packa
1KB
1KB
1KB
1KB
2KB
2KB
ROM
512B
512B
512B
512B
1KB
1KB
Pins
23
23
32
32
32
32
mer
3
3
3
3
3
3
rupts
19
19
21
21
21
21
Voltage
4.5-5.5 V
2.7-5.5 V
4.5-5.5 V
2.7-5.5 V
4.5-5.5 V
2.7-5.5 V
frequency
0-16 MHz
0-8 MHz
0-16 MHz
0-8 MHz
0-16 MHz
0-8 MHz
ging
28
28
40
40
40
40
8051
Slow
Small
CISC
Not Present
Inbuilt
Not Present
PIC
Moderate
Large
RISC
Inbuilt
Inbuilt
Inbuilt
AVR
Fast
Large
RISC
Inbuilt
Inbuilt
Inbuilt
(Complex Instruction Set Computers). We will explore more on this when we will learn about
the architecture of AVR microcontrollers in following section.
Lets see what all this means. What is 8-bit? This means that the
microcontroller is capable of transmitting and receiving 8-bit data. The input/output registers
available are of 8-bits. The AVR family controllers have register based architecture which
means that both the operands for an operation are stored in a register and the result of the
operation is also stored in a register. Following figure shows a simple example performing
OR operation between two input registers and storing the value in Output Register.
The CPU takes values from two input registers INPUT-1 and INPUT-2,
performs the logical operation and stores the value into the OUTPUT register. All this
happens in 1 execution cycle.
WORKING PRINCIPLE:
OVERVIEW OF ATMEGA-8
The Atmega-8 is a low-power CMOS 8-bit microcontroller based on the AVR RISC
architecture. By executing powerful instructions in a single clock cycle, the Atmega-8
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 the 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.
The Atmega-8 provides the following features: 8K bytes of In-System Programmable
Flash with Read-While-Write capabilities, 512 bytes of EEPROM, 1K byte of SRAM, 23
general purpose I/O lines, 32 general purpose working registers, three flexible
Timer/Counters with compare modes, internal and external interrupts, a serial programmable
USART, a byte oriented Two-wire Serial Interface, a 6-channel ADC (eight channels in TQFP
and MLF packages) with 10-bit accuracy, a programmable Watchdog Timer with Internal
Oscillator, an SPI serial port, and five software selectable power saving modes. The Idle
mode stops the CPU while allowing the SRAM, Timer/Counters, SPI port, and interrupt
system to continue functioning. The Power-down mode saves the register contents but freezes
the Oscillator, disabling all other chip functions until the next Interrupt or Hardware Reset. In
Power-save mode, the asynchronous timer continues to run, allowing the user to maintain a
timer base while the rest of the device is sleeping. The ADC Noise Reduction mode stops the
CPU and all I/O modules except asynchronous timer and ADC, to minimize switching noise
during ADC conversions. In Standby mode, the crystal/resonator Oscillator is running while
the rest of the device is sleeping. This allows very fast start-up combined with low-power
consumption.
The device is manufactured using Atmels high density non-volatile memory
technology. The Flash Program memory can be reprogrammed In-System through an SPI
serial interface, by a conventional non-volatile memory programmer, or by an On-chip boot
program running on the AVR core. The boot program can use any interface to download the
application program in the Application Flash memory. Software in the Boot Flash Section
will continue to run while the Application Flash Section is updated, providing true ReadWhile-Write operation. By combining an 8-bit RISC CPU with In-System SelfProgrammable Flash on a monolithic chip, the Atmel Atmega-8 is a powerful microcontroller
that provides a highly-flexible and cost-effective solution to many embedded control
applications.
The Atmega-8 AVR is supported with a full suite of program and system development
tools, including C compilers, macro assemblers, program debugger/simulators, In-Circuit
Emulators, and evaluation kits.
Naming Convention.
The AT refers to Atmel the manufacturer, Mega means that the microcontroller
belong to MegaAVR category, 8 signifies the memory of the controller, which is 8KB.
FEATURES OF ATMEGA-8
8-bit microcontroller
Peripheral Features
Two 8-bit Timer/Counters with Separate Prescaler, one Compare Mode
One 16-bit Timer/Counter with Separate Prescaler, Compare Mode, and
Capture Mode
Real Time Counter with Separate Oscillator
Three PWM Channels
8-channel ADC in TQFP and MLF package
Operating Voltages
2.7 - 5.5V (Atmega-8)
4.5 - 5.5V (Atmega-8)
Speed Grades
0 - 8 MHz (Atmega-8)
0 - 16 MHz (Atmega-8)
PIN DIAGRAM(ATMEGA-8 )
PIN DESCRIPTION
VCC
Digital supply voltage.
GND
Ground.
Port B (PB7..PB0)
XTAL1/XTAL2/TOSC1/TOSC2
Port B is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for
each bit). The Port B output buffers have symmetrical drive characteristics with both high
sink and source capability. As inputs, Port B pins that are externally pulled low will source
current if the pull-up resistors are activated. The Port B pins are tri-stated when a reset
condition becomes active, even if the clock is not running.
Depending on the clock selection fuse settings, PB6 can be used as input to the
inverting Oscillator amplifier and input to the internal clock operating circuit.
Depending on the clock selection fuse settings, PB7 can be used as output from the inverting
Oscillator amplifier.
If the Internal Calibrated RC Oscillator is used as chip clock source, PB7..6 is used as
TOSC2..1 input for the Asynchronous Timer/Counter2 if the AS2 bit in ASSR is set.
Port C (PC5..PC0)
Port C is an 7-bit bi-directional I/O port with internal pull-up resistors (selected for
each bit). The Port C output buffers have symmetrical drive characteristics with both high
sink and source capability. As inputs, Port C pins that are externally pulled low will source
current if the pull-up resistors are activated. The Port C pins are tri-stated when a reset
condition becomes active, even if the clock is not running.
PC6/RESET
If the RSTDISBL Fuse is programmed, PC6 is used as an I/O pin. Note that the
electrical characteristics of PC6 differ from those of the other pins of Port C. If the
RSTDISBL Fuse is unprogrammed, PC6 is used as a 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. Shorter pulses are not guaranteed to generate a Reset.
Port D (PD7..PD0)
Port D is an 8-bit bi-directional I/O port with internal pull-up resistors (selected for
each bit). The Port D output buffers have symmetrical drive characteristics with both high
sink and source capability. As inputs, Port D pins that are externally pulled low will source
current if the pull-up resistors are activated. The Port D pins are tri-stated when a reset
condition becomes active, even if the clock is not running.
RESET
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. Shorter pulses are not guaranteed to
generate a reset.
AVCC
AVCC is the supply voltage pin for the A/D Converter, Port C (3..0), and ADC (7..6).
It should be externally connected to VCC, even if the ADC is not used. If the ADC is used, it
should be connected to VCC through a low-pass filter. Note that Port C (5..4) use digital
supply voltage, VCC.
AREF
AREF is the analog reference pin for the A/D Converter.
CHAPTER 3
PROCESSING OF AVR CPU CORE
INTRODUCTION
This section discusses the AVR core architecture in general. 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.
In order to maximize performance and parallelism, the AVR uses a Harvard
architecture with separate memories and buses for program and data. Instructions in the
Program memory are executed with a single level pipelining. While one instruction is being
executed, the next instruction is pre-fetched from the Program memory. This concept enables
instructions to be executed in every clock cycle. The Program memory is In- System
Reprogrammable Flash memory.
The fast-access Register File contains 32 x 8-bit general purpose working registers
with a single clock cycle access time. This allows single-cycle Arithmetic Logic Unit (ALU)
operation. In a typical ALU operation, two operands are output from the Register File, the
operation is executed, and the result is stored back in the Register File in one clock cycle.
ARCHITECTURE
Six of the 32 registers can be used as three 16-bit indirect address register pointers for
Data Space addressing enabling efficient address calculations. One of these address pointers
can also be used as an address pointer.
The ALU supports arithmetic and logic operations between registers or between a
constant and a register. Single register operations can also be executed in the ALU. After an
arithmetic operation, the Status Register is updated to reflect information about the result of
the operation.
The Program flow is provided by conditional and unconditional jump and call
instructions, able to directly address the whole address space. Most AVR instructions have a
single 16-bit word format. Every Program memory address contains a 16- or 32-bit
instruction.
Program Flash memory space is divided in two sections, the Boot program section
and the Application program section. Both sections have dedicated Lock Bits for write and
read/write protection. The SPM instruction that writes into the Application Flash memory
section must reside in the Boot program section.
During interrupts and subroutine calls, the return address Program Counter (PC) is
stored on the Stack. The Stack is effectively allocated in the general data SRAM, and
consequently the Stack size is only limited by the total SRAM size and the usage of the
SRAM. All user programs must initialize the SP in the reset routine (before subroutines or
interrupts are executed). The Stack Pointer SP is read/write accessible in the I/O space. The
data SRAM can easily be accessed through the five different addressing modes supported in
the AVR architecture.
The memory spaces in the AVR architecture are all linear and regular memory maps.
A flexible interrupt module has its control registers in the I/O space with an additional global
interrupt enable bit in the Status Register. All interrupts have a separate Interrupt Vector in the
Interrupt Vector table. The interrupts have priority in accordance with their Interrupt Vector
position. The lower the Interrupt Vector address, the higher the priority. The I/O memory
space contains 64 addresses for CPU peripheral functions as Control Registers, SPI, and other
I/O functions. The I/O Memory can be accessed directly, or as the Data Space locations
following those of the Register File, 0x20 - 0x5F.
STATUS REGISTER
The Status Register contains information about the result of the most recently
executed arithmetic instruction. This information can be used for altering program flow in
order to perform conditional operations. Note that the Status Register is updated after all
ALU operations, as specified in the Instruction Set Reference. This will in many cases
remove the need for using the dedicated compare instructions, resulting in faster and more
compact code.
The Status Register is not automatically stored when entering an interrupt routine and
restored when returning from an interrupt. This must be handled by software.
GENERAL PURPOSE REGISTER
The Register File is optimized for the AVR Enhanced RISC instruction set. In order to
achieve the required performance and flexibility, the following input/output schemes are
supported by the Register File:
One 8-bit output operand and one 8-bit result input.
Two 8-bit output operands and one 8-bit result input.
Two 8-bit output operands and one 16-bit result input.
One 16-bit output operand and one 16-bit result input.
STACK POINTER
The Stack is mainly used for storing temporary data, for storing local variables and
for storing return addresses after interrupts and subroutine calls. The Stack Pointer Register
always points to the top of the Stack. Note that the Stack is implemented as growing from
higher memory locations to lower memory locations. This implies that a Stack PUSH
command decreases the Stack Pointer.
The Stack Pointer points to the data SRAM Stack area where the Subroutine and Interrupt
Stacks are located. This Stack space in the data SRAM must be defined by the program
before any subroutine calls are executed or interrupts are enabled. The Stack Pointer must be
set to point above 0x60. The Stack Pointer is decremented by one when data is pushed onto
the Stack with the PUSH instruction, and it is decremented by two when the return address is
pushed onto the Stack with subroutine call or interrupt.
The Stack Pointer is incremented by one when data is popped from the Stack with the
POP instruction, and it is incremented by two when address is popped from the Stack with
return from subroutine RET or return from interrupt RETI.
The AVR Stack Pointer is implemented as two 8-bit registers in the I/O space. The
number of bits actually used is implementation dependent. Note that the data space in some
implementations of the AVR architecture is so small that only SPL is needed. In this case, the
SPH Register will not be present
Arduino Uno
Arduino Uno R3 Front Arduino Uno R3 Back
Arduino Uno R2 Front Arduino Uno SMD Arduino Uno Front Arduino Uno Back
Overview
The Arduino Uno is a microcontroller board based on the ATmega328
(datasheet). It has 14 digital
input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16
MHz ceramic
resonator, a USB connection, a power jack, an ICSP header, and a reset button. It
contains everything needed to support the microcontroller; simply connect it to
a computer with a USB cable or power it with a AC-to-DC adapter or battery to
get started. The Uno differs from all preceding boards in that it does not use the
FTDI USB-to-serial driver chip. Instead, it features the Atmega16U2 (Atmega8U2
up to version R2) programmed as a USB-to-serial converter. Revision 2 of the Uno
board has a resistor pulling the 8U2 HWB line to ground, making it easier to put
into DFU mode.
Revision 3 of the board has the following new features:
1.0pinout: added SDA and SCL pins that are near to the AREF pin and two
other new pins
placed near to the RESET pin, the IOREF that allow the shields to adapt to the
voltage provided
from the board. In future, shields will be compatible both with the board that use
the AVR,
which operate with 5V and with the Arduino Due that operate with 3.3V. The
second one is a
not connected pin, that is reserved for future purposes.
"Uno" means one in Italian and is named to mark the upcoming release of
Arduino 1.0. The Uno and version 1.0 will be the reference versions of Arduino,
moving forward. The Uno is the latest in a series of USB Arduino boards, and the
reference model for the Arduino platform; for a comparison with previous
versions, see the index of Arduino boards.
Summary
Microcontroller ATmega328
Operating Voltage 5V
Input Voltage (recommended) 7-12V
Input Voltage (limits) 6-20V
Digital I/O Pins 14 (of which 6 provide PWM output)
Analog Input Pins 6
DC Current per I/O Pin 40 mA
DC Current for 3.3V Pin 50 mA
Flash Memory 32 KB (ATmega328) of which 0.5 KB used by bootloader
SRAM 2 KB (ATmega328)
EEPROM 1 KB (ATmega328)
Clock Speed 16 MHz
Schematic & Reference Design
EAGLE files: arduino-uno-Rev3-reference-design.zip (NOTE: works with Eagle 6.0
and newer)
Schematic: arduino-uno-Rev3-schematic.pdf
Note:
The Arduino reference design can use an Atmega8, 168, or 328,
Current models use an ATmega328, but an Atmega8 is shown in the schematic
for reference. The pin configuration is identical on all three processors.
Power
The Arduino Uno can be powered via the USB connection or with an external
power supply. The power source is selected automatically. External (non-USB)
power can come either from an AC-to-DC adapter (wall-wart) or battery. The
adapter can be connected by plugging a 2.1mm center-positive plug into the
board's power jack. Leads from a battery can be inserted in the Gnd and Vin pin
headers of the POWER connector.
The board can operate on an external supply of 6 to 20 volts. If supplied with less
than 7V, however, the 5V pin may supply less than five volts and the board may
be unstable. If using more than 12V, the voltage regulator may overheat and
damage the board. The recommended range is 7 to 12 volts.
The power pins are as follows:
VIN. The input voltage to the Arduino board when it's using an external
power source (as
opposed to 5 volts from the USB connection or other regulated power source).
You can supply
voltage through this pin, or, if supplying voltage via the power jack, access it
through this pin.
5V.This pin outputs a regulated 5V from the regulator on the board. The
board can be supplied with power either from the DC power jack (7 - 12V),
the USB connector (5V), or the VIN pin of the board (7-12V). Supplying
voltage via the 5V or 3.3V pins bypasses the regulator, and can damage
your board. We don't advise it.
3V3. A 3.3 volt supply generated by the on-board regulator. Maximum
current draw is 50 mA.
GND. Ground pins.
Memory
The ATmega328 has 32 KB (with 0.5 KB used for the bootloader). It also has 2 KB
of SRAM and 1 KB
of EEPROM (which can be read and written with the EEPROM library).
Input and Output
Each of the 14 digital pins on the Uno can be used as an input or output, using
pinMode(),
digitalWrite(), and digitalRead() functions. They operate at 5 volts. Each pin can
provide or receive a
maximum of 40 mA and has an internal pull-up resistor (disconnected by default)
of 20-50 kOhms. In
addition, some pins have specialized functions:
Serial: 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL serial
data. These pins
are connected to the corresponding pins of the ATmega8U2 USB-to-TTL Serial
chip.
External Interrupts: 2 and 3. These pins can be configured to trigger an
interrupt on a low
value, a rising or falling edge, or a change in value. See the attachInterrupt()
function for
details.
PWM: 3, 5, 6, 9, 10, and 11. Provide 8-bit PWM output with the analogWrite()
function.
SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). These pins support SPI
communication
using the SPI library.
LED: 13. There is a built-in LED connected to digital pin 13. When the pin is
HIGH value, the
LED is on, when the pin is LOW, it's off.
The Uno has 6 analog inputs, labeled A0 through A5, each of which provide 10
bits of resolution (i.e.
1024 different values). By default they measure from ground to 5 volts, though is
it possible to change
the upper end of their range using the AREF pin and the analogReference()
function. Additionally, some
pins have specialized functionality:
TWI: A4 or SDA pin and A5 or SCL pin. Support TWI communication using the
Wire library.
There are a couple of other pins on the board:
AREF. Reference voltage for the analog inputs. Used with analogReference().
Reset. Bring this line LOW to reset the microcontroller. Typically used to add a
reset button to
shields which block the one on the board.
See also the mapping between Arduino pins and ATmega328 ports. The mapping
for the Atmega8,
168, and 328 is identical.
Communication
The Arduino Uno has a number of facilities for communicating with a computer,
another Arduino, or
other microcontrollers. The
communication, which is
ATmega328
provides
UART
TTL
(5V)
serial
The ATmega328 also supports I2C (TWI) and SPI communication. The Arduino
software includes a
Wire library to simplify use of the I2C bus; see the documentation for details. For
SPI communication,
use the SPI library.
Programming
The Arduino Uno can be programmed with the Arduino software (download).
Select "Arduino Uno from
the Tools > Board menu (according to the microcontroller on your board). For
details, see the
reference and tutorials.
The ATmega328 on the Arduino Uno comes preburned with a bootloader that
allows you to upload new
code to it without the use of an external hardware programmer. It communicates
using the original
STK500 protocol (reference, C header files).
You can also bypass the bootloader and program the microcontroller through the
ICSP (In-Circuit
Serial Programming) header; see these instructions for details.
The ATmega16U2 (or 8U2 in the rev1 and rev2 boards) firmware source code is
available . The
ATmega16U2/8U2 is loaded with a DFU bootloader, which can be activated by:
On Rev1 boards: connecting the solder jumper on the back of the board (near
the map of Italy)
and then resetting the 8U2.
On Rev2 or later boards: there is a resistor that pulling the 8U2/16U2 HWB
line to ground,
making it easier to put into DFU mode.
You can then use Atmel's FLIP software (Windows) or the DFU programmer (Mac
OS X and Linux) to
load a new firmware. Or you can use the ISP header with an external
programmer (overwriting the
DFU bootloader). See this user-contributed tutorial for more information.
Automatic (Software) Reset
Rather than requiring a physical press of the reset button before an upload, the
Arduino Uno is
designed in a way that allows it to be reset by software running on a connected
computer. One of the
connector and power jack extending beyond the former dimension. Four screw
holes allow the board to
be attached to a surface or case. Note that the distance between digital pins 7
and 8 is 160 mil
(0.16"), not an even multiple of the 100 mil spacing of the other pins.
16x2 LCD
A 16x2 LCD means it can display 16 characters per line and there are 2 such
lines. In this LCD each character is displayed in 5x7 pixel matrix. This LCD has two
registers, namely, Command and Data.
The command register stores the command instructions given to the LCD. A
command is an instruction given to LCD to do a predefined task like initializing it,
clearing its screen, setting the cursor position, controlling display etc. The data
register stores the data to be displayed on the LCD. The data is the ASCII value of
the character to be displayed on the LCD. Click to learn more about internal structure
of a LCD.
Blue Mode STN - This is the basic LCD, which needs lot of improvement on contrast
ratio and viewing angle.
FSTN (Film STN) - Comes with an additional linearization film to offer better
contrast.
CSTN (colour STN) - Layers of color filters are added to create up to 65,000 colors.
DSTN (Double STN) - Improves contrast and eliminates any other colors appearing
on the screen.
1. Segment LCD: Displays numbers, letters and fixed symbols and were used in old
style industrial panel display and such standard where we need to display fixed
number of characters.
Passive Matrix
Active Matrix
LCDs unlike LEDS do not produce light, they need some external light source
to view. So most the latest LCD screens used in notebook computers use a light
source. They use CFT or EL Panel or in recent times white LED as source of light
fixed in the background of LCD.
LED lamp is a better choice over CFT and EL due to its ability to offer variety of
colors, intensity, long life (>100K Hrs), wide temperature range, and low voltage
operation.
Reflective: In the reflective mode LCDs use ambient light to illuminate the display
making them more suitable for outdoor use.
Transmissive: Transmissive mode will depend on internal backlight and is only
viewable in indoors.
Liquid Crystals are very sensitive to constant electric fields. Only AC-voltages
should be applied as DC voltages can cause an electrochemical reaction, which
destroys the liquid crystals irreversibly.
Temperature dependent and in a very cold or hot environment LCD may not
work correctly. This is a reversible effect. Some displays need temperature
compensation circuits to automatically adjust the applied LC voltage.
1. Resolution: The horizontal and vertical size measured by number of pixels (e.g.,
1024x768).
2. Dot pitch: The distance between the centers of two adjacent pixels. Smaller dot
pitch indicate sharper image.
3. Viewable size: The diagonal size of the LCD display panel
4. Response time: The minimum time LCD takes to change a pixel's color or
brightness.
5. Refresh rate: The rate at which the data is loaded in the monitor measured with
the unit of number of times per second. Higher the refresh rate lesser is the
flickering.
6. Matrix type: Active TFT or Passive.
7. Viewing angle: The angle from which the user can view the image on the display
clearly.
8. Color support: The types and number of colors supported by the LCD (known as
color gamut).
9. Brightness: The amount of light emitted from the display (known as luminance).
10. Contrast ratio: The ratio of the intensity of the brightest bright to the darkest
dark.
11. Aspect ratio: The ratio of the width to the height (for example, 4:3, 5:4, 16:9 or
16:10).
12. Gamma correction: It is the name of a nonlinear operation used to code and
decode luminance or tristimulus values in video or still image systems
Advantages of LCDs:
Consumes less power and generates less heat.
Saves lot of space compared picture tubes due to LCD's flatness.
Due to less weight and flatness LCDs are highly portable.
No flicker and less screen glare in LCDs to reduce eyestrain.
Drawbacks:
PIN Diagram
PIN Description
LCD Interfacing:
GSM/GPRS MODEM
GSM/GPRS MODEM is a class of wireless MODEM devices that are
designed for communication of a computer with the GSM and GPRS
2.
3.
AT COMMANDS:
AT commands are used to control MODEMs. AT is the abbreviation
for Attention. These commands come from Hayes commands that were
used by the Hayes smart modems. The Hayes commands started with AT
to indicate the attention from the MODEM. The dial up and wireless
MODEMs (devices that involve machine to machine communication) need
AT commands to interact with a computer. These include the Hayes
command set as a subset, along with other extended AT commands.
AT commands with a GSM/GPRS MODEM or mobile phone can be
used to access following information and services:
1.
Information and configuration pertaining to mobile device or
MODEM and SIM card.
2.
SMS services.
3.
MMS services.
4.
Fax services.
5.
The Hayes subset commands are called the basic commands and the
commands specific to a GSM network are called extended AT commands.
AT+CMGF=<mode>
As one types AT+CMGW and phone number, > sign appears on next line
where one can type the message. Multiple line messages can be typed in
this case. This is why the message is terminated by providing a Ctrl+z
combination. As Ctrl+z are pressed, the following information response is
displayed on the screen.
+CMGW: Number on which message has been stored.
GSM/GPRS Module:
A Fig below show GSM/GPRS module assembles a GSM/GPRS modem
with standard communication interfaces like RS-232 (Serial Port), USB etc.,
so that it can be easily interfaced with a computer or a microprocessor /
microcontroller based system. The power supply circuit is also built in the
module that can be activated by using a suitable adaptor.
Circuit Diagram:
IR SENSOR:
Infrared radiation is the portion of electromagnetic spectrum having
wavelengths longer than visible light wavelengths, but smaller than
microwaves, i.e., the region roughly from 0.75m to 1000 m is the
infrared region. Infrared waves are invisible to human eyes. The
wavelength region of 0.75m to 3 m is called near infrared, the region
TYPES OF IR SENSORS:
There are different types of IR sensors working in various regions of
the IR spectrum but the physics behind "IR sensors" is governed by three
laws:
1. Plancks radiation law:
Every object at a temperature T not equal to 0 K emits radiation.
Infrared radiant energy is determined by the temperature and surface
condition of an object. Human eyes cannot detect differences in infrared
energy because they are primarily sensitive to visible light energy from
400 to 700 nm. Our eyes are not sensitive to the infrared energy.
block diagram :
1. Infrared Source
All objects above 0 K radiate infrared energy and hence are infrared
sources. Infrared sources also include blackbody radiators, tungsten lamps,
silicon carbide, and various others. For active IR sensors, infrared Lasers and
LEDs of specific IR wavelengths are used as IR sources.
2. Transmission Medium
Three main types of transmission medium used for Infrared transmission are
vacuum, the atmosphere, and optical fibres.
Signal Processing
Since detector outputs are typically very small, preamplifiers with associated circuitry
are used to further process the received signals.
IR SENSOR CIRCUIT:
Light absorption: Absorption occurs when light enters a semiconductor and its energy
is transferred to the semiconductor to generate additional free electrons and holes. This
effect is widely used and enables devices like to photo-detectors and solar cells to
operate.
Stimulated emission:
semiconductor lattice will strike an electron and release energy in the form of another
light photon. The way in which this occurs releases this new photon of identical
wavelength and phase. In this way the light that is generated is said to be coherent.
The key to the laser diode operation occurs at the junction of the highly doped p and n type
regions. In a normal p-n junction current flows across the p-n junction. This action can occur
because the holes from the p-type region and the electrons from the n-type region combine. With
an electromagnetic wave (in this instance light) in passing through the laser diode junction diode
junction it is found that the photo-emission process occurs. Here the photons release further
photons of light occurs when they strike electrons during the recombination of holes and
electrons occurs.
Naturally there is some absorption of the light, resulting in the generation of holes and electrons
but there is an overall gain in level.
The structure of the laser diode creates an optical cavity in which the light photons have multiple
reflections. When the photons are generated only a small number are able to leave the cavity. In
this way when one photon strikes an electron and enables another photon to be generated the
process repeats itself and the photon density or light level starts to build up. It is in the design of
better optical cavities that much of the current work on lasers is being undertaken. Ensuring the
light is properly reflected is the key to the operation of the device.
PHOTORESISTOR