Академический Документы
Профессиональный Документы
Культура Документы
Topics
1. What is Interfacing and Need of interfacing.
2. Different Interfacing techniques.
3. Basic embedded C programs for on-chip peripherals
studied in system architecture.
4. Interfacing of different displays including Graphic LCD
(320X240), Interfacing of input devices including touch
screen etc,
5. Interfacing of output devices like thermal printer etc.,
6. Embedded communication using CAN and Ethernet,
7. RF modules, GSM modem for AT command study etc.
What is Interfacing
An interface is the point of interaction with software, or computer
hardware, or with peripheral devices such as a computer monitor or
a keyboard.
Some computer interfaces such as a touch screen can send and
receive data, while others such as a mouse, microphone or joystick
can only send data.
Types of Interfacing
1. Hardware
2. Software
Hardware interfaces
Hardware interfaces exist in computing systems between many of
the components such as the various buses, storage devices,
other I/O devices, etc.
A hardware interface is described by the mechanical, electrical and
logical signals at the interface and the protocol for sequencing
them (sometimes called signaling).
A standard interface, such as SCSI, decouples the design and
introduction of computing hardware, such as I/O devices, from the
design and introduction of other components of a computing
system, thereby allowing users and manufacturers great flexibility
in the implementation of computing systems.
Software interfaces
A software interface may refer to a wide range of different types of
interface at different "levels": an operating system may interface
with pieces of hardware.
Applications or programs running on the operating system may need
to interact via streams, and in object oriented programs, objects
within an application may need to interact via methods.
programming
style
on
Benefits
1.Low cost
2.Easy interfacing & Design
3.Easy Production
4.users choice for interfacing
5.No Maintenance
6.Easier Handling
Disadvantages
1.Compact size is not possible
2.Power consumption is more as compared to SOC
3.Leakage current is more
4.Limited Devices Addressing
5.No Support of Multi/ Master configuration
Click Next.
Belo s ree ill appear. ele t De ug a d
Release configurations.
Click Finish.
The project is created and opened in the IDE. You should see the following components:
The Proje ts i do , hi h o tai s a tree ie of the o po e ts of the project, including
source files and properties file that your code depends on. .
The our e Editor i do
ith a file alled ke pad_ ai . ope .
To build Project right click on keypad project and select Build Project.
Open the build console view to check for any errors as shown in the below figure.
330_09
30
IOPIN
GPIO Port Pin value register. The current state of the port pins
can always be read from this register, regardless of pin
direction and mode.
IOSET
GPIO Port Output set register. This register controls the state
of output pins in conjunction with the IOCLR register. Writing
ones produces highs at the corresponding port pins. Writing
zeroes has no effect.
IODIR
GPIO Port Direction control register. This register individually
controls the direction of each port pin.
IOCLR
GPIO Port Output clear register. This register controls the state
of output pins. Writing ones produces lows at the
corresponding port pins and clears the corresponding bits in
the IOSET register. Writing zeroes has no effect.
330_09
31
LED Interfacing
P0-15
P0-16
P0-17
P0-18
P0-19
P0-20
P0-21
P0-22
P0-23
330_09
32
A27262524
A23222120
A19181716
A15141312
A111098
A7654
A3210
0000
0000
0111
1111
1000
0000
0000
0000
A27262524
A23222120
A19181716
A15141312
A111098
A7654
A3210
0000
0000
0111
1111
1000
0000
0000
0000
330_09
33
A27262524
A23222120
A19181716
A15141312
A111098
A7654
A3210
0000
0000
0101
0101
0000
0000
0000
0000
A27262524
A23222120
A19181716
A15141312
A111098
A7654
A3210
0000
0000
0010
1010
1000
0000
0000
0000
330_09
34
#include<LPC21xx.h>
void delay();
int main(void)
{
*IODIR0 = 0x7f8000;
while(1)
{
*IOPIN0 = 0x550000;
delay();
*IOPIN0 = 0x2A8000;
delay();
}
return 0;
}
void delay()
{
unsigned int x=500000;
while( x > 0 )
x--;
}
330_09
35
Seven-Segment Display
Seven-segment Displays
0 thru 9
a through g
Two types
Common anode
Common cathode
330_09
36
Seven-Segment Display
Common Anode
330_09
37
330_09
38
330_09
39
Look-Up Table
Serial Number
0
1
2
3
4
5
6
7
8
9
A
B
C
D
E
F
DP
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
G
0
0
1
1
1
1
1
0
1
1
1
1
0
1
1
1
F
1
0
0
0
1
1
1
0
1
1
1
1
1
0
1
1
E
1
0
1
0
0
0
1
0
1
0
1
1
1
1
1
1
330_09
D
1
0
1
1
0
1
1
0
1
1
0
1
1
1
1
0
C
1
1
0
1
1
1
1
1
1
1
1
1
0
1
0
0
B
1
1
1
1
1
0
0
1
1
1
1
0
0
1
0
0
A
1
0
1
1
0
1
1
1
1
1
1
0
1
0
1
1
Code
3FH
06H
5BH
4FH
66H
6DH
7DH
07H
7FH
6FH
77H
7DH
39H
5EH
79H
71H
40
#include<LPC21xx.h>
void delay();
int main(void)
{
*IODIR1 = 0XFF0000;
while(1)
{
*IOCLR1 = 0Xff0000;
*IOSET1 = 0x3f0000; //0
delay();
*IOCLR1 = 0Xff0000;
*IOSET1 = 0x060000; //1
delay();
*IOCLR1 = 0Xff0000;
*IOSET1 = 0x5b0000; //2
delay();
*IOCLR1 = 0Xff0000;
*IOSET1 = 0x4f0000; //3
delay();
*IOCLR1 = 0Xff0000;
*IOSET1 = 0x660000; //4
delay(); 330_09
41
*IOCLR1 = 0Xff0000;
*IOSET1 = 0x6d0000; //5
delay();
*IOCLR1 = 0Xff0000;
*IOSET1 = 0x7d0000; //6
delay();
*IOCLR1 = 0Xff0000;
*IOSET1 = 0x070000; //7
delay();
*IOCLR1 = 0Xff0000;
*IOSET1 = 0x7f0000; //8
delay();
*IOCLR1 = 0Xff0000;
*IOSET1 = 0x6f0000; //9
delay();
*IOCLR1 = 0Xff0000;
*IOSET1= 0x770000; //A
delay();
330_09
42
*IOCLR1 = 0xff0000;
*IOSET1 = 0x7c0000;
delay();
*IOCLR1 = 0xff0000;
*IOSET1 = 0x390000;
delay();
*IOCLR1 = 0xff0000;
*IOSET1 = 0x5e0000;
delay();
*IOCLR1 = 0xff0000;
*IOSET1 = 0x790000;
delay();
*IOCLR1 = 0xff0000;
*IOSET1 = 0x710000;
delay();
}
return 0;
}
330_09
//b
//C
//d
//E
//F
43
void delay()
{
int x=500000;
while( x > 0 )
x--;
}
330_09
44
330_09
45
330_09
46
330_09
47
void ISRHandlerEXTINT3(void)
{
*EXTINT=0x00000008;
q_printf("External Interrupt\n");
*IOCLR1 = 0Xff0000;
*IOSET1 = 0x3f0000;//0
delay();
*IOCLR1 = 0Xff0000;
*IOSET1 = 0x060000; //1
delay();
*IOCLR1 = 0Xff0000;
*IOSET1 = 0x5b0000; //2
delay();
*IOCLR1 = 0Xff0000;
*IOSET1 = 0x4f0000; //3
delay();
330_09
48
*IOCLR1 = 0Xff0000;
*IOSET1 = 0x660000; //4
delay();
*IOCLR1 = 0Xff0000;
*IOSET1 = 0x6d0000; //5
delay();
*IOCLR1 = 0Xff0000;
*IOSET1 = 0x7d0000; //6
delay();
*IOCLR1 = 0Xff0000;
*IOSET1 = 0x070000; //7
delay();
*IOCLR1 = 0Xff0000;
*IOSET1 = 0x7f0000; //8
delay();
*IOCLR1 = 0Xff0000;
*IOSET1 = 0x6f0000; //9
delay();
330_09
49
*IOCLR1 = 0Xff0000;
*IOSET1 = 0x770000; //A
delay();
*IOCLR1 = 0xff0000;
*IOSET1 = 0x7c0000; //b
delay();
*IOCLR1 = 0xff0000;
*IOSET1 = 0x390000; //C
delay();
*IOCLR1 = 0xff0000;
*IOSET1 = 0x5e0000; //d
delay();
*IOCLR1 = 0xff0000;
*IOSET1 = 0x790000; //E
delay();
*IOCLR1 = 0xff0000;
*IOSET1 = 0x710000; //F
330_09
50
delay();
*IOCLR1 = 0xff0000;
*IOSET1 = 0x760000;//H
delay();
*IOCLR1 = 0xff0000;
*IOSET1 = 0x800000;//DP
delay();
330_09
51
void IRQInit()
{
*PINSEL1=0x20000000;
*EXTMODE=0x8;
*VICVectAddr0=(unsigned int)ISRHandlerEXTINT3;
*VICVectCntl0=0x20|0x11;
*VICIntEnable=0x20000 |*VICIntEnable;
}
int main(void)
{
*IODIR0=0x7F8000;
IRQInit();
q_printf("main\n ");
return 0;
}
330_09
52
330_09
53
330_09
54
Software technique
S-R latch
330_09
Wait for 10 to 20 ms
after detection of a
switch closure
If the reading is still the
same it is accepted
55
330_09
56
330_09
57
330_09
58
Interfacing LCD
Problem statement
330_09
59
Interfacing LCD
Hardware
330_09
60
330_09
61
Interfacing LCD
P1-16
P1-17
P1-18
P1-19
P1-20
P1-21
P1-22
P1-23
P0-28
GND
P0-29
GND
ARM -7
62
Interfacing LCD
Driver HD44780
330_09
63
Interfacing LCD
Can be interfaced either in 8-bit mode or 4-bit mode
Table 9-3
330_09
64
65
LCD Commands
66
Interfacing LCD
LCD Operation
330_09
67
Interfacing LCD
Writing to or Reading from LCD
The MPU:
330_09
68
Interfacing LCD
Timing diagram: writing to LCD
330_09
69
Interfacing LCD
Software
330_09
70
Pin 13 (P0.28)
Pin 14 (P0.29)
GND
RS
EN
WR
330_09
71
A27262524
A23222120
A19181716
A15141312
A111098
A7654
A3210
0000
0000
1 1 1 1
1 1 1 1
0000
0000
0000
0000
A27262524
A23222120
A19181716
A15141312
A111098
A7654
A3210
0011
0000
0000
0000
0000
0000
0000
0000
A31302928
A27262524
A23222120
A19181716
A15141312
A111098
A7654
A3210
0010
0000
0000
0000
0000
0000
0000
0000
A31302928
A27262524
A23222120
A19181716
A15141312
A111098
A7654
A3210
0001
0000
0000
0000
0000
0000
0000
0000
330_09
72
#include<lpc21xx.h>
void lcddata(int value);
void lcdcmd(int value);
void delay(int itime);
int main()
{
*IODIR1=0x00FF0000;
*IODIR0=0x30000000;
lcdcmd(0x38);
delay(250);
lcdcmd(0x0e);
delay(250);
lcdcmd(0x80);
delay(250);
330_09
73
lcddata('h');
delay(250);
lcddata('e');
delay(250);
lcddata('l');
delay(250);
lcddata('l');
delay(250);
lcddata('o');
delay(250);
return 0;
}
330_09
74
330_09
75
76
77
330_09
78
79
P0-11
P0-12
P0-13
P0-14
80
330_09
81
330_09
82
Motors with greater number of phases also exhibit smoother operation than those
with fewer phases.
330_09
83
APPLICATIONS
Computer-controlled stepper motors are one of the most versatile
forms of positioning systems . They are typically digitally
controlled as part of an open loop system, and are simpler and
more rugged than closed loop servo systems. Industrial applications
are in high speed pick and place equipment and multi-axis machine
CNC machines often directly driving lead screws or ball screws .
In the field of lasers and optics they are frequently used in precision
positioning equipment such as linear actuators , linear stages ,
rotation stages and mirror mounts . Other uses are in packaging
machinery, and positioning of valve pilot stages for fluid control
systems. Commercially, stepper motors are used in floppy disk
drives , flatbed scanners , computer printers , plotters and many
more devices.
84
A27262524
A23222120
A19181716
A15141312
A111098
A7654
A3210
00 00
0000
0000
0000
0111
1000
0000
0000
Step
A31302928
A27262524
A23222120
A19181716
A15141312
A111098
A7654
A3210
00 00
0000
0000
0000
0111
1000
0000
0000
00 00
0000
0000
0000
0010
1000
0000
0000
00 00
0000
0000
0000
0011
0000
0000
0000
00 00
0000
0000
0000
0101
0000
0000
0000
00 00
0000
0000
0000
0100
1000
0000
0000
0
85
#include <LPC21xx.h>
#include<board.h>
int main(void)
{
unsigned long int i,j;
*IODIR0 = *IODIR0 | (0X00007800);
q_lcdinit(TITAN);
while(1)
{
q_displaylcd("clkwise directxn",16);
86
for(j=0;j<12;j++)
{
*IOSET0 = 0x00002800;
for(i=0;i<25000;i++);
*IOCLR0 = 0x00002800;
for(i=0;i<25000;i++);
*IOSET0 = 0x00003000;
for(i=0;i<25000;i++);
*IOCLR0 = 0x00003000;
for(i=0;i<25000;i++);
*IOSET0 = 0x00005000;
for(i=0;i<25000;i++);
*IOCLR0 = 0x00005000;
for(i=0;i<25000;i++);
*IOSET0 = 0x00004800;
for(i=0;i<25000;i++);
*IOCLR0 = 0x00004800;
for(i=0;i<25000;i++);
}
330_09
87
q_clrscreen();
q_displaylcd("anticlk directxn",16);
for(j=0;j<12;j++)
{
*IOSET0 = 0x00002800;
for(i=0;i<25000;i++);
*IOCLR0 = 0x00002800;
for(i=0;i<25000;i++);
*IOSET0 = 0x00004800;
for(i=0;i<25000;i++);
*IOCLR0 = 0x00004800;
for(i=0;i<25000;i++);
*IOSET0 = 0x00005000;
for(i=0;i<25000;i++);
*IOCLR0 = 0x00005000;
for(i=0;i<25000;i++);
*IOSET0 = 0x00003000;
for(i=0;i<25000;i++);
*IOCLR0 = 0x00003000;
for(i=0;i<25000;i++);
}
q_clrscreen();
}
return 0;
}
330_09
88
330_09
89
What is GSM ?
Global System for Mobile (GSM) is a
second generation cellular standard
developed to cater voice services and
data delivery using digital modulation
330_09
91
Introduction:
GSM (Global System for Mobile) / GPRS (General Packet Radio Service)
TTL Modem is SIM900 Quad-band GSM / GPRS device, works on
frequencies 850 MHZ, 900 MHZ, 1800MHZ and 1900 MHZ. It is very
compact in size and easy to use as plug in GSM Modem. The Modem is
designed with 3V3 and 5V DC TTL interfacing circuitry, which allows
User to directly interface with 5V Microcontrollers (PIC, AVR, Arduino,
8051, etc.) as well as 3V3Microcontrollers (ARM, ARM Cortex XX, etc.).
The baud rate can be configurable from 9600-115200 bps through AT
(Attention) commands. This GSM/GPRS TTL Modem has internal TCP/IP
stack to enable User to connect with internet through GPRS feature. It is
suitable for SMS as well as DATA transfer application in mobile phone to
mobile phone interface.
The modem can be interfaced with a Microcontroller using USART
(Universal Synchronous Asynchronous Receiver and Transmitter) feature
(serial communication).
92
Features:
Quad
93
330_09
94
330_09
95
MAX232 IC:
The MAX232 is an integrated circuit that converts signals from an RS-232 serial
port to signals suitable for use in TTL compatible digital logic circuits, so that
devices works on TTL logic can share the data with devices connected through
Serial port (DB9 Connector).
330_09
96
330_09
97
330_09
98
330_09
99
330_09
100
Indicator LEDs:
Indicator LEDs just used to indicate status accordingly. These are three LEDs
represents Power On/Off Status, Network Status and Module On/Off Status
respectively. Power LED will keep on until the power supply is enable to this board
by using push-on push-off switch. Network Status LED will show whether inserted
SIM card successfully connected to service providers Network or not, in short
signal strength. Module On/Off indicator LED will show status of GSM
modules power on/off.
330_09
101
330_09
102
Audio Connectors:
Audio Connectors deals with Audio related operations. These pins already shown
in hardware description diagram. These are eight pins in a group of two each
denoted by SV4.
GND (0V Supply) and VCC (+5V Supply) are used to have source for external
device. MIC+ and MICused to connect Microphone (abbr. as Mic) through which
user can give audio input while calling. SP- and SP+ used to connect Speaker (can
be connected to amplifier circuit if necessary) through which User can hear audio
output. LN-L and LN-R used to connect Line in to GSM module.
330_09
103
330_09
104
330_09
105
330_09
106
330_09
107
330_09
108
Connect three Single Berg Wires to CP2102 moduless RXD, TXD and GND pin.
Then connect RXD wire to TXD of GSM module and TXD wire to RXD of GSM
module. Make GND common by connecting GND wire to GND pin of GSM
module.
330_09
109
330_09
110
330_09
111
SMS Command:-
2. To send SMS
Step 1 AT + CMGS = Enter mobile number
Step 2 - <Press Enter>
Step 3 Enter Text
Step 4 Press ctrl + Z
CMGS Send Message
3. For acknowledge SMS (if not acknowledge the SMS, SMS server
will resend SMS)
Step 1 AT + CNMA
CNMA Message Acknowledge
330_09
112
Power supply
Null male-male
connector
COM 1
DB9ARM
Female
PROCESSOR
data 2
/BOARD
GND-3
GSM
RS 238
Cable
GSM antenna
LCD DISPLAY
330_09
113
GSM Applications
Mobile telephony
GSM-R
Telemetry System
- Fleet management
- Automatic meter reading
- Toll Collection
- Remote control and fault reporting of DG sets
Value Added Services
330_09
115
330_09
116
Interface: FBI-compliant scanners often have analogue output and a frame grabber is
necessary to digitize the images. This introduces an extra cost and usually requires an internal
board to be mounted in the host. In non-AFIS devices, the analogue-to-digital conversion is
performed by the scanner itself and the interface to the host is usually through a simple
Parallel Port or USB connection.
Frames per second: This is the number of images the scanner is able to acquire and send to
the host in a second.
Automatic finger detection: Some scanners automatically detect the presence of a finger on
the acquisition surface, without requiring the host to continually grab and process frames; this
allows the acquisition process to be automatically initiated as soon as the users finger touches
the sensor.
Encryption: This is the securing of the communication channel between the scanner and the
host.
117
119
330_09
120
ARM
PROCESSOR
/BOARD
Power supply
Null male-male
connector
COM 1
DB9Female
data 2
GND-3
FIM
RS 323
Cable
Keypad
(4 4)
CN 13, 1-,
10 19,20
LCD DISPLAY
330_09
121
Communication:FIM has RS serial communication port through that FIM communicates at the
same time.
These ports support 6 baud rate modes such as 9600, 14400, 19200, 38400, 57600
and 115200 bps.
User Data Area:FIM provides 64 bytes flash memory. Using this memory, host can save
private data for specific usage.
The caution is needed because the responsibility for reading, writing and
erasing user data area is given to the best.
Key Function:FIM supports 3 function key input such as Enroll _ Key, Delete _ Key, and
Identify _ Key.
Using these keys without serial communication, enrollment, deletion, all
deletion and identification operating can be executed.
330_09
122
Applications
Print on scale device
Ticket generation
Bill printing
ATM machines
123
Fingerprint sensing
Based on the mode of acquisition, a fingerprint image is classified
as
Off line image
Live-scan image
There are a number of live-scan sensing mechanisms that can
detect the ridges and valleys present in the fingertip
Examples are
Optical FTIR
Capacitive
Pressure-based
Ultrasound
124
125
Fingerprint images
Interface: FBI-compliant scanners often have analogue output and a frame grabber is
necessary to digitize the images. This introduces an extra cost and usually requires an internal
board to be mounted in the host. In non-AFIS devices, the analogue-to-digital conversion is
performed by the scanner itself and the interface to the host is usually through a simple
Parallel Port or USB connection.
Frames per second: This is the number of images the scanner is able to acquire and send to
the host in a second.
Automatic finger detection: Some scanners automatically detect the presence of a finger on
the acquisition surface, without requiring the host to continually grab and process frames; this
allows the acquisition process to be automatically initiated as soon as the users finger touches
the sensor.
Encryption: This is the securing of the communication channel between the scanner and the
host.
127
Fingerprint Sensing
The most important part of a fingerprint scanner is the sensor.
Sensors belong to one of the three families:
Optical sensors
Solid-state sensors
Thermal
Electric field
Piezoelectric
Ultrasound sensors
128
129
130
Optical Fibers
A significant reduction of the packaging size can be achieved by substituting prism and
lens with a fiber-optic platen. The finger is in direct contact with the upper side of
the platen; on the opposite side, a CCD or CMOS, tightly coupled with the platen,
receives the finger residual light conveyed through the glass fibers. Unlike the FTIR
devices, the CCD/CMOS is in direct contact with the platen and therefore its size
has to cover the whole sensing area. This may result in a high cost for producing
large area sensors.
131
Electro-Optical
Electro-optical sensors contain light-emitting
polymer instead of a prism that activates the
photodiode array embedded in glass to obtain
fingerprint image.
132
Optical Sensors
133
134
Ultrasound sensors
Ultrasound sensing is based on sending acoustic signals toward the fingertip and
capturing the echo signal. The echo signal is used to compute the range
image of the fingerprint and subsequently, the ridge structure itself. This
method images the subsurface of the finger skin (even through thin gloves).
Therefore, it is resilient to dirt and oil accumulations that may visually mar
the fingerprint. However, the scanner is large with mechanical parts and
quite expensive. Moreover, it takes a few seconds to acquire an image.
135
Touch systems
136
137
138
139
140
Quality of images
Good quality
fingerprint
Dry finger
Wet finger
Intrinsically
bad fingerprint
141
142
143
2.
3.
144
330_09
145
330_09
146
330_09
147
330_09
148
330_09
149
330_09
150
#include <LPC214x.H>
#include "GLCD.H"
#include "GLCDBMP.H"
#define RST 7
void main()
{
PINSEL0 = 0;
PINSEL1 = 0;
IODIR0 = 0x0000FFFF;
GLCD_Init (&IO0PIN, 8);
while(1)
{
Delay();
Delay();
Delay();
Delay();
330_09
151
330_09
152