ARM7
ARM7
A microcontroller (sometimes
abbreviated µC or MCU) is a small
computer on a single IC containing
a processor core, memory, and
programmable input/output
peripherals.
MEMORY:
SPEED:
DAC:
Idle mode
Power-down mode
Advance Technology
• To set several pins to output at once
Advance Technology
• Read the current state of all pins in GPIO block 0
portdata_0 = IOPIN0;
RESET
LCD
MOTOR MD ROM
MAX CPU`
AVR
COMP BUZZER
232
SWITCH
RAM
INTERRUPT
ARM7 LED
O
GND S
C
ARM Microcontroller Programing
Input file
For
MCU
ARM
Microcontroller
Transferring file Compiling &
Using
Suitable medium
Building
Like USB or Of the Code
RS-232cable
Source Code
In
C- Language
Let’s check how to put brain in our
device
Light Emitting Diodes (LEDs) interface
Function
LEDs emit light when an
electric current passes
through them.
Advance Technology
Circuit symbol:
Program LED BLINK
#include<lpc214x.h>
void delay()
{
unsigned long int i;
for(i=0;i<=300000;i++);
}
int main()
Advance Technology
{
IODIR0=0XFFFFFFFF;
while(1)
{
IOCLR0=0XFFFFFFFF;
delay();
IOSET0=0XFFFFFFFF;
delay();
}
}
Switch Circuitry
A switch generates a
high to low pulse.
The pulse acts as
input to
microcontroller.
Microcontroller
senses the transition
and perform
appropriate task.
Advance Technology
PROGRAM FOR LED AND SWITCH
#include<lpc214x.h>
int main()
{
IODIR0&=~(1<<10);
IODIR0|=(1<<16);
while(1)
{
if(IOPIN0&(1<<10))
IOSET0|=(1<<16);
else
IOCLR0|=(1<<16);
}
}
LED Displays
LEDs can be combined together in a single
package to produce displays such as bar
graphs, strips, arrays and 7-segment displays.
Advance Technology
The Common Cathode The Common Anode
Display (CCD) Display (CAD)
All cathodes are common All anodes are
and ground is being common and VCC is
provided.
being provided.
Advance Technology
Interfacing common anode
display
Advance Technology
PROGRAM(0-9 count)
#include<lpc214x.h>
void delay(unsigned long int h)
{
unsigned long int i,j;
for(j=0;j<h;j++)
for(i=0;i<5000;i++);
}
int main()
{
int a;
unsigned char arr[] = {0xbf, 0x86, 0xdb, 0xcf, 0xe6, 0xed, 0xfd, 0x87, 0xff, 0xef};
IODIR0 = 0xffffffff;
while(1)
{
for(a=0;a<=9;a++)
{
IOCLR0 = 0xffffffff;
IOSET0 = arr[a];
delay(1000);
}}}
#include"lpc214x.h" COUNT (00 to 99)
void delay(unsigned long int h)
{
unsigned long int i,j;
for(j=0;j<h;j++)
for(i=0;i<5000;i++);
}
int main()
{
int c,d,e;
unsigned char arr[] = {0xbf, 0x86, 0xdb, 0xcf, 0xe6, 0xed, 0xfd, 0x87, 0xff, 0xef};
IODIR0 = 0xffffffff;
while(1)
{ for(c=0;c<=9;c++)
{ for(d=0;d<=9;d++)
{ for(e=0;e<=100;e++)
{ IOCLR0 = 0xFFFFFFFF;
IOSET0 = arr[d]<<16 | 0x0100;
delay(5);
IOCLR0 = 0xFFFFFFFF;
IOSET0 = arr[c]<<16 | 0x0200;
delay(5);
} }}} }
Liquid Crystal Display
Liquid Crystal Displays
HD44780(LCDs)
cheap and easy way to
display text, Displays
numbers, letters and fixed
Advance Technology
symbols
Various configurations (1
Line, 2 Line or 4 Line LCDs ).
Integrated controller
Data lines (DB7-DB0) used
to transfer data and
commands
Inside LCD
DDRAM - Display Data RAM
Display data RAM (DDRAM) stores display data
represented in 8-bit character codes.
Advance Technology
CGRAM - Character Generator
RAM
CGRAM area is used to create custom characters
in LCD. In the character generator RAM, the user
can rewrite character patterns by program.
Inside LCD
Instruction Register (IR)
Instruction register corresponds to
the register where you send commands to
LCD e.g. LCD shift command, LCD clear,
LCD address etc.
Advance Technology
Data Register (DR)
Data register is used for storing data
which is to be displayed on LCD.
Pin Information of LCD:
Advance Technology
UNDERSTANDING LCD Pins
8 data pins D7:D0
Bi-directional data/command pins.
Alphanumeric characters are sent in ASCII
format.
Advance Technology
LCD Initialization Commands:
1.Specify function set:
Send 38H for 8-bit,double line and 5x7 dot character
format.
Advance Technology
3.Entry mode set:
Send 06H for cursor in increment position and shift
is invisible.
4. Clear display:
Send 01H to clear display and return cursor to home
position.
Advance Technology
LCD Commands:
Algorithm to send data to LCD:
Advance Technology
3. Pulse on E (HIGH to LOW)
4. Repeat the steps to send another
data byte
LCD CONNECTION
LPC2148 has two inbuilt ADC Modules, named as ADC0 & ADC1.
ADC0 has 6-Channels (AD0.1-AD0.6).
ADC1 has 8-Channels (AD1.0-AD1.7).
ADC operating frequency is 4.5 MHz (max.), operating frequency decides
the conversion time.
Supports power down mode.
Burst conversion mode for single or multiple inputs.
There are several registers associated with ADC feature but we will mainly
discussing about ADC Control Register (ADCR) & ADC Global Data
Register (ADGDR).
ADC RELATED PINS
egister Name Function
A/D Control Register: The ADCR register must be written to select the operating mode before
ADCR A/D conversion can occurs.
A/D Global Data Register: This register contains ADC’s DONE bit and the result of the most
ADGDR recent A/D conversion.
A/D Status Register: This register contains DONE and OVERRUN flag for all the A/D
ADSTAT Channels, as well as the A/D interrupt flag.
A/D Global Start Register: This address can be written (in the AD0 address range) to start
ADGSR conversions in both A/D converters simultaneously.
A/D Interrupt Enable Register: This register contains enable bits that allow the DONE flag
ADINTEN of each A/D channel to be included or excluded from contributing to the generation of an A/D
interrupt.
Registers Description/Function
U0THR
Transmit Hold Register: This register contains 8-bit write data which can be transmitted
through UART0. This is write only register.
Receive Buffer Register: This register contains 8-bit received data from UART0. This data
U0RBR is nothing but top most byte of Rx FIFO. When we use 5, 6 or 7-bit data then remaining bits
are padded with 0’s by default. This is read only register.
Line Control Register: The value or settings in this register configure the UART0 block. As
this is an 8-bit register. There are several parameters configured through this register such
U0LCR
as word length, stop bit, parity enable, parity select, break control, divisor latch access bit.
This register setting plays important role while initializing UART0 before using it.
U0DLL & U0DLM are standard UART0 baud rate generator divider registers. Each of this
U0DLL & register holds 8-bit values. Together these registers form a 16-bit divisor value which will be
U0DLM used for baud rate generation. This will be discussed further while code explanation with
respect to real world example.
Fractional Divider Register: This is another very important register, which plays
significant role in baud rate generation. In this 8-bit register, first four bits i.e. Bit[3 to 0]-
U0FDR
DIVADDVAL: This is the Prescale Divisor value. If this value is 0 then fractional baud rate
generator have no effect on UART0 baud rate. The remaining 4-bits i.e. Bit[4 to 7]-
MULVAL: This defines Prescale Multiplier value. Even if fractional baud rate generator is not
used the value in this register must be more than or equal to ‘1’.
UART0 REGISTER MAP
U0LCR- Line Control Reg
• 8-BIT byte addressable reg
• Line control reg is used to select the length of char
BAUD RATE=CLK/16*9600
U0RBR(UART0 Receive buffer reg)
8-bit byte addressable reg
int main()
{
init_uart0(9600);
string_uart0("SERIAL COMMUNICATION TEST
WITH ARM\n\r");
while(1)
{
trans_uart0(rec_uart0());
}
}
RFID interface
Radio-Frequency Identification (RFID) is the use of a
wireless non-contact system that uses radio-frequency
electromagnetic fields to transfer data from a tag attached to
an object, for the purposes of automatic identification and
tracking.
COMPONENTS OF RFID
There are two main components of RFID