Professional Documents
Culture Documents
CHAPTER 1
Page 1
EMBEDDED SYSTEM
Process Quality:
1. Experience in SPICE Level 3 development.
2. Functional Safety ISO 26262 - ASIL B products
3. Adaptable to Customer procedures and guidelines
Technologies:
1. Microcontrollers 8, 16, 32 bit
2. Embedded C, Python, Iot (PHP Front End & MY SQL Back End) Wireless –
Bluetooth, GPS, GPRS, Wi-Fi
3. Communication protocols – Spi, I2c, CAN, LIN
4. Mat Lab simlink, Xilinx, Modelsim, LabView
Management:
The Management team as mixture of Technical and Business development expertise with
14+years of experience in the Information Technology Field.
Current status of Technofly solution:
Present the company is involved with developing the GPS Training system for two wheels
with our associated partners also more focusing on Corporate Trainings on AUTOMOTIVE
EMBEDDED and Focused on providing ASIC solutions that involves Design and
Verification IP’s And Functional Verification of Designs.
Page 2
EMBEDDED SYSTEM
Company Profile:
TechnoFly was formed by professionals with formal qualifications and industrial experience
in the fields of embedded systems, real-time software, process control and industrial
electronics. The company is professionally managed and supported by qualified experienced
specialists and consultants with experience in embedded systems – including hardware and
software.
Initially, the company Developed system software tools; these include C Compilers for
micro-controllers and other supporting tools such as assembler, linker, simulator and
Integrated Development Environment. Later Single Board Computers (SBCs) – were
developed and are still manufactured. Such hardware boards support a broad range of
processors – including 8 bit, 16 and 32 bit processor.
Since 2015, company also started offering design and development services. This includes a
complete spectrum of activities in product development life cycle that is idea generation,
requirement gathering to prototype making, testing and manufacturing. Company has so far
provided product design services for various sectors which include the Industrial automation,
Instrumentation, Automotive, Consumer and Defense sector.
Services of Technofly:
When you don’t have enough time, or the right skills on hand, you can supplement your team
with expert embedded engineers from Technofly, who can tackle your projects with
confidence, take out the risk, and hit your milestones. We’ll take as much ownership as you
want us to, and make sure your project is done right, on time and on budget. Go ahead, check
our reputation for on-time, on-budget delivery. We've earned it, time and again.
We can help you cut risk on embedded systems R&D, and accelerate time to market.
Technofly is your best choice for designing and developing embedded products from
concept to delivery. Our team is well-versed in product life cycles. We build complex
software systems for real-time environments and have unique expertise and core
competencies in the following domains: Wireless, Access and IOT/Cloud.
Technofly solution also offer services which includes
1. Developing client / server applications to run on Windows / Linux
Page 3
EMBEDDED SYSTEM
Page 4
EMBEDDED SYSTEM
The department is actively involved in acquiring latest technologies related projects in Low
power VLSI, wireless domain and these projects are well thought out and detailed
implementations are carried out. Projects are mainly done on Verilog, MATLAB platform
(from math works) and may also depend on NS2, NetSim and Xilinx platforms as per the
requirements of the project in progress.
Current internship involves study implementation and analysis of High speed and Energy
Efficient Carry Skip adder (CSKA) with Hybrid model for achieving high speed and reducing
the power consumption.
1. Study Requirements: Low power VLSI design and fundamentals of Digital circuits
2. Implementation Requirements: Verilog code / Modelsim tool
3. Detection Test Static: Simulation results
4. Platform: Verilog and simulated by Modelsim 6.4cand synthesized by Xilinx tool.
Real Time Embedded System and Low power VLSI design Department:
Technofly solution embedded software, hardware, system development, system integration,
verification and product realization services to customers in automotive electronics and
consumer electronics segments worldwide. Technofly solution has more than 14 years of
experience in embedded systems on a variety of platforms such as Microprocessors,
Programmable Logic Devices (PLDs) and ASICs. Accord develops applications based on the
various commercially available real time and embedded operating systems.
Technofly solution provides services in the following areas:
1. Design Services
2. Product Realization
Design Services:
Technofly solution offer services in the areas of:
1. Hardware design and development
Page 5
EMBEDDED SYSTEM
The hardware design and development follow stringent life cycle guidelines laid out at
Technofly solution while accomplishing the following –
Design Assurance
1. Signal Integrity
2. Cross-talk
3. Matching and Impedance control
4. Power supply design with due emphasis for Low-power battery operated
5. applications
6. Thermal analysis
7. Clock distribution
8. Timing analysis
9. PCB layer stacking
Design optimization
Selection of components keeping in mind
1. Cost , Size
2. Operating and storage temperature
3. MIL/Industrial/Commercial grades based on application
4. Environmental specifications like vibration, humidity, and radiation
PCB design
1. Optimum number of layers for a given application
2. Material used for PCB
3. Rigid, Flexi and Rigid-Flexi designs based on applications
Page 6
EMBEDDED SYSTEM
Pilot production
1. Component sourcing, inward inspection and inventory management
2. PCB assembly
3. Assembled PCB testing
Software Development
Software design and development services are related to
1. Real-time Embedded Application Development
2. Device Driver Development
3. BSP Development
4. Processor/OS Porting Services
5. RTOS based development
6. Board bring-up
7. Digital Signal Processing Algorithms
8. Porting across platforms
ASIC
1. Design IP’s
2. Verification IP’s (VIP’s)
3. Complete verification Solution
Skill Set
1. Language: C, C++, Assembly languages, Verilog and SystemVerilog
2. Hardware Platforms: ADI DSPs, TI DSPs, ARM, PowerPC, Xscale architecture
3. RTOS: Integrity, VDK, DSP OS, Micro C OS and OASYS
4. FPGA: Xilinx (Spartan and Virtex), Actel, Altera
Tools
1. Development Tools: In-circuit emulators of various processor environments
2. Compilers: Compilers/IDEs of various processor environments
FPGA Tools
1. Front End Design: XST, Synplify, SynplifyPro, Precision Synthesis
2. Back End Design: Xilinx ISE 9.1.03i ,Actel’s Libero 6.0 , Altera’s MAXPlusII
Page 7
EMBEDDED SYSTEM
Simulation:
1. Xilinx ModelSim SE
2. Actel’s Libero 6.0
3. Altera’s MAXPlusII
Coverage Analysis:
TransEDA VN-Cover
Debugging:
ChipScope
Hardware Tools:
1. Spectrum Analyzer
2. Signal Generators
3. Logic Analyzer
4. Digital Storage Oscilloscopes
5. Multifunction Counters
6. Development Tools and In-circuit Emulators for all ADI DSP’s, TI DSP’s,
7. ARM Processor, PowerPC
8. ORCAD, Allegro, Pspice
9. Temperature and Humidity Chamber
Product Realization
Product Realization services are provided in the areas of:
1. Consumer Electronics
2. Automotive
3. Space
4. Defense
5. Simulation/Emulation
6. Temperature and Humidity Chamber
7. Temperature and Humidity Chamber
Page 8
EMBEDDED SYSTEM
Our Work group productivity software suite Smart Works consists of software
applications which can help you plan and track your projects, Manage meetings and Track
various issues to its closures. Smart Works is affordably priced and uses TCP/IP based client
server architecture at its core. Smart Works server runs on all the windowing platforms
(Windows 95/98/NT/2000/ME). Efforts are on to make Smart works available on other
platforms as well.
Technofly solution also offer services which includes
1. Developing client / server applications to run on Windows / Linux
2. Develop / Test Internet based applications
3. Test suite development for applications and network protocols
4. Developing Networking tools for the enterprises
5. Verification & Validation of Enterprise applications
6. Software maintenance of enterprise applications
Following are the skill sets Technofly solution has garnered in the area of software:
1. Programming Languages: C, C++, VC++, Java, C#, ASP.Net, PHP, Lex &Yacc,
Perl, Python, Assembly Language and Ada
2. Operating Environments: Real Time Operating Systems such as, GreenHills
Integrity and Micro C-OS. DSP OS, VDK, OASYS and MS-WINCE, MS-
Windows, Unix/Linux and MPE/iX are the operating systems that Accord
provides services.
Page 9
EMBEDDED SYSTEM
Chapter 2
Introduction to Embedded Systems
2.1 Definition of Embedded System
An embedded system is one kind of a computer system mainly designed to perform several
tasks like to access, process, store and also control the data in various electronics-based
systems.
Embedded systems are a combination of hardware and software where software is usually
known as firmware that is embedded into the hardware.
As with any electronic system, an embedded system requires a hardware platform on which it
performs the operation. Embedded system hardware is built with a microprocessor or
microcontroller. The embedded system hardware has elements like input output (I/O)
interfaces, user interface, memory and the display. Usually, an embedded system consists of:
Power Supply
Processor
Memory
Timers
Serial communication ports
System application specific circuits
Page10
EMBEDDED SYSTEM
A system is said to be real time, if it is essential to complete its work and deliver its service
on time. Real time operating system manages the application software and affords a
mechanism to let the processor run. The Real Time operating system is responsible for
handling the hardware resources of a computer and host applications which run on the
computer.
Page11
EMBEDDED SYSTEM
Embedded systems find numerous applications in various fields such as digital electronics,
telecommunications, computing network, smart cards, satellite systems, military defense
system equipment, research system equipment, and so on.
Page12
EMBEDDED SYSTEM
The ARM stands for Advanced RISC machine and it is a 32-bit reduced instructions set
computer (RISC) microcontroller. It was first introduced by the Acron computers’
organization in 1987. The ARM is a family of the microcontroller developed by the different
manufacturers such as ST microelectronics, Motorola and so on .The ARM microcontrollers
are cost sensitive and high performance devices which are used in a wide range of application
such as industrial instrument control systems, wireless networking and sensors and
automotive body system etc.
The ARM microcontroller architecture come with a few different versions such as ARMv1,
ARMv2 etc and each one has its own advantage and disadvantages.
2.3.1 ARM v7
ARM7 is one of the widely used micro-controller family in embedded system application.
This section is humble effort for explaining basic features of ARM-7.
LPC2148 is the widely used IC from ARM-7 family. It is manufactured by Philips and it is pre-
loaded with many inbuilt peripherals making it more efficient and a reliable option for the
beginners as well as high end application developer.
Page13
EMBEDDED SYSTEM
Page14
EMBEDDED SYSTEM
• USB 2.0 Full Speed compliant Device Controller with 2 kB of endpoint RAM.In addition,
the LPC2148 provides 8 kB of on-chip RAM accessible to USB by DMA.
• Two 32-bit timers/external event counters (with four capture and four comparechannels
each), PWM unit (six outputs) and watchdog.
• Low power real-time clock with independent power and dedicated 32 kHz clock input.
• Multiple serial interfaces including two UARTs (16C550), two Fast I2C-bus(400 kbit/s),
SPI and SSP with buffering and variable data length capabilities.
• On-chip integrated oscillator operates with an external crystal in range from 1 MHz to30
MHz and with an external oscillator up to 50 MHz.
1. Keil µVision.
2. Flash Magic.
Page15
EMBEDDED SYSTEM
4. After this, a dialog box will pop-up on screen. This will ask you whether to copy startup
code for LPC2148. Click on Yes.
Page16
EMBEDDED SYSTEM
Page17
EMBEDDED SYSTEM
7. Now right click on Target 1 and hit on Options for target “Target 1”.
8.In Options for target “Target 1”. In output tab, click on check box Create HEX File.
Then go to Linker tab. Click on Use Memory Layout for Target Dialog.
Page18
EMBEDDED SYSTEM
Page19
EMBEDDED SYSTEM
Chapter 3
TASK PERFORMED
Page20
EMBEDDED SYSTEM
delay(10000);
IO0CLR |= LED; // led off
delay(10000);
}
}
void delay(int i)
{
int j,k;
for (j=0;j<i;j++)
for (k=0;k<35;k++);
}
Page21
EMBEDDED SYSTEM
The control pins help us configure the LCD in command mode or data mode. They also help
configure read mode or write mode and also when to read or write.
LCD 16x2 can be used in 4-bit mode or 8-bit mode depending on the requirement of the
application. In order to use it we need to send certain commands to the LCD in command
mode and once the LCD is configured according to our need, we can send the required data in
data mode.
Since we are using LCD in 4-bit mode, we require only 4 Data pins.
LCD Data pins D4-D7 are connected to respective pins.
LCD control pins RS, RW and EN are connected to their respective pins.
Page22
EMBEDDED SYSTEM
#define en (1<<17)
#define data_mask (d4 | d5 | d6 | d7)
#define flag d7
void wait_lcd (void);
void command_write(unsigned char command);
void set_lcd_port_output(void);
void lcd_clear(void);
void data_write (unsigned char data);
void putchar(int c);
void putstring(char *string);
void init_lcd(void);
int lcdgotoxy( unsigned int x, unsigned int y);
void delay(int count);
void test_cmd(void);
void wait_lcd (void)
{
IO0DIR &= ~flag;
IO0CLR |= rs;
IO0SET |= rw | en;
while(IO0PIN & flag);
IO0CLR |= en | rw;
IO0DIR |= data_mask;
delay(100);
}
void command_write(unsigned char command)
{
unsigned char temp=0;
unsigned int temp1=0;
temp=command;
temp=(temp>>4)&0x0F;
temp1=(temp<<18)&data_mask;
IO0CLR = rs;
IO0SET = en;
Page23
EMBEDDED SYSTEM
IO0CLR = data_mask;
IO0SET = temp1;
delay(100000);
IO0CLR = en;
temp=command;
temp&=0x0F;
temp1=(temp<<18)& data_mask;
delay(100*2);
IO0CLR |= rs;
IO0SET |= en;
IO0CLR = data_mask;
IO0SET = temp1;
delay(100000);
IO0CLR |= en;
wait_lcd();
}
void set_lcd_port_output(void)
{
IO0DIR |= (en | rs | rw);
IO0CLR |= (en | rs | rw);
IO0DIR |= data_mask;
}
void lcd_clear(void)
{
command_write(0x01);
}
Page24
EMBEDDED SYSTEM
IO0SET |= en|rs;
IO0CLR = data_mask;
IO0SET = temp1;
IO0CLR |= en;
temp=data;
temp&=0x0F;
temp1=(temp<<18)& data_mask;
IO0SET |= en | rs;
IO0CLR=data_mask;
IO0SET=temp1;
IO0CLR |= en;
wait_lcd();
}
void putchar(int c)
{
data_write(c);
}
void putstring(char *string)
{
while ( *string != '\0' )
{
putchar( *string );
string++;
}
}
void init_lcd(void)
{
set_lcd_port_output();
command_write(0x28);
command_write(0x02);
command_write(0x06);
command_write(0x0F);
}
int lcdgotoxy( unsigned int x, unsigned int y)
Page25
EMBEDDED SYSTEM
{
int retval=0;
if ((x > 1) && (y > 15))
{
retval=-1;
} else {
if( x==0 )
{
command_write(0x80 + y);
} else
if (x==1)
{
command_write(0xC0 + y);
}
}
return retval;
}
void delay(int count)
{
int j=0,i=0;
for(j=0;j<count;j++)
{
for(i=0;i<65;i++);
}
}
int main(void)
{
init_lcd();
command_write(1);
command_write(0x80);
putstring("pulse");
delay(200000);
command_write(0xC0);
putstring("Bengaluru");
Page26
EMBEDDED SYSTEM
while(1)
{
command_write(0x1C);
delay(200000);
}
}
void test_cmd(void)
{
command_write(0x08); //Display off,cursor off
command_write(0x18);
command_write(0x0C); //Display on cursor off
command_write(0x10); //Move cursor left by 1 char
command_write(0x14); //Move cursor right by 1 char
command_write(0x01); //Clear display
}
3.3 DC Motor
DC motor converts electrical energy in the form of Direct Current into mechanical energy.
In case of a motor, the mechanical energy produced is in the form of rotational movement of
the motor shaft .The direction of rotation of the shaft of the motor can be reversed by
reversing the direction of Direct Current through the motor.
The motor can be rotated at a certain speed by applying a fixed voltage to it. If the voltage
varies, the speed of the motor varies.
Thus, the DC motor speed can be controlled by applying varying DC voltage; whereas the
direction of rotation of the motor can be changed by reversing the direction of current
through it.
Page27
EMBEDDED SYSTEM
Page28
EMBEDDED SYSTEM
void motor_stop(void)
{
//IO0CLR |=En1;
IO1CLR |=In1;
IO1CLR |=In2;
//delay(count);
}
int main (void)
{
IO1DIR&=~Sw1;
IO1DIR&=~Sw2;
IO1DIR&=~Sw3;
IO1DIR |= In1;
IO1DIR |= In2;
while(1)
{
if(!(IO1PIN & Sw1))
{
//while(1)
{ motor_clk();
delay(count);
}
}
else if (!(IO1PIN & Sw2))
{motor_anticlk();
delay(count);
}
else if (!(IO1PIN & Sw3))
{ motor_stop();
delay(count);
}
}
}
Page29
EMBEDDED SYSTEM
3.4 Sensors
A sensor is a device, module, or subsystem whose purpose is to detect events or changes in
its environment and send the information to other electronics, frequently a computer
processor.
2.Flame/Fire detector-
A flame detector is a sensordesigned to detect and respond to the presence of aflame or fire,
allowing flame detection. Responses to a detected flame depend on the installation, but can
include sounding an alarm, deactivating a fuel line (such as a propane or a natural gas line),
and activating a fire suppression system.
Page30
EMBEDDED SYSTEM
3. Temperature detector-
A temperature sensor is a device, usually an RTD (resistance temperature detector) or a
thermocouple, that collects the data about temperature from a particular source and converts
the data into understandable form for a device or an observer and so on.
Page31
EMBEDDED SYSTEM
putstring("fire detected");
}
}
3.5 UART
UART stands for Universal Asynchronous Receiver/Transmitter. A UART’s main purpose is
to transmit and receive serial data.
In UART communication, two UARTs communicate directly with each other. The
transmitting UART converts parallel data from a controlling device like a CPU into serial
form, transmits it in serial to the receiving UART, which then converts the serial data back
into parallel data for the receiving device. Only two wires are needed to transmit databetween
two UARTs. Data flows from the Tx pin of the transmitting UART to the Rx pin of the
receiving UART:
UARTs transmit data asynchronously, which means there is no clock signal to synchronize
the output of bits from the transmitting UART to the sampling of bits by the receiving
UART. Instead of a clock signal, the transmitting UART adds start and stop bits to the data
packet being transferred. These bits define the beginning and end of the data packet so the
receiving UART knows when to start reading the bits.
When the receiving UART detects a start bit, it starts to read the incoming bits at a
specific frequency known as the baud rate. Baud rate is a measure of the speed of data
transfer, expressed in bits per second (bps). Both UARTs must operate at about the same
Page32
EMBEDDED SYSTEM
baud rate. The baud rate between the transmitting and receiving UARTs can only differ by
about 10% before the timing of bits gets too far off.
#include <LPC214x.H>
#include "Lcdtask.h" /* LPC21xx definitions */
//#include "Serial.h"
#define CR 0x0D
unsigned char ch;
int sendchar (int ch)
{ /* Write character to Serial Port */
if (ch == '\n')
{
while (!(U1LSR & 0x40));
U1THR = CR; /* output CR */
}
while (!(U1LSR & 0x40));
return (U1THR = ch);
}
int uart0_getkey (void) { /* Read character from Serial Port */
while (!(U0LSR & 0x01));
return (U0RBR);
}
int uart1_getkey (void) { /* Read character from Serial Port */
if((U1LSR & 0x01)){
ch = U1RBR;
return 1; //(U1RBR);
}
else
return 0;
}
Page33
EMBEDDED SYSTEM
void uart1_init()
{
PINSEL0 |= 0x00050000; /* Enable RxD1 and TxD1 */
U1LCR = 0x83; /* 8 bits, no Parity, 1 Stop bit */
U1DLL = 97;
// U1DLL = 195; /* 9600 Baud Rate @ 15MHz VPB Clock 97 , 4800=197 */
U1LCR = 0x03; /* DLAB = 0 */
}
void uart1_putc(char c)
{
while(!(U1LSR & 0x40)); // Wait until UART1 ready to send character
U1THR = c; // Send character
}
void uart1_puts(char *p)
{
while(*p) // Point to character
{
uart1_putc(*p++); // Send character then point to next character
}
}
void uart0_init()
{
PINSEL0 |= 0x00000005; /* Enable RxD0 and TxD0 */
U0LCR = 0x83; /* 8 bits, no Parity, 1 Stop bit */
U0DLL = 97; /* 9600 Baud Rate @ 15MHz VPB Clock */
U0LCR = 0x03; /* DLAB = 0 */
}
void uart0_putc(char c)
{
while(!(U0LSR & 0x40)); // Wait until UART0 ready to send character
U0THR = c; // Send character
}
void uart0_puts(char *p)
{
Page34
EMBEDDED SYSTEM
Page35
EMBEDDED SYSTEM
Page36
EMBEDDED SYSTEM
if(strcmp(buff,"02557698")==0)
if(ret==0)
{
command_write(0x01);
command_write(0x80);
putstring("valid user");
delay(10000);
}
else
{
command_write(0x01);
command_write(0x80);
putstring("invalid user");
delay(10000);
}
}
}
3.7 Keypad
A keypad is a set of buttons arranged in a block or "pad" which usually bear digits, symbols
and usually a complete set of alphabetical letters. If it mostly contains numbers then it can
also be called a numeric keypad. Here we are using 4 X 4 matrix keypad.
Page37
EMBEDDED SYSTEM
The rows are connected to an output port and the columns are connected to an input port.
To detect a pressed key, the microcontroller grounds all rows by providing 0 to the output
latch, and then it reads the columns. If the data read from the columns is D3-D0=1111, no
key has been pressed and the process continues until a key press is detected. However, if one
of the column bits has a zero, this means that a key press has occurred. For example, if D3-
D0=1101, this means that a key in the D1 column has been pressed.
If the data read is all 1s, no key in that row is activated and the process is moved to the next
row. It grounds the next row, reads the columns, and checks for any zero. This process
continues until the row is identified. After identification of the row in which the key has been
pressed, the next task is to find out which column the pressed key belongs to.
Page38
EMBEDDED SYSTEM
Check_2();
Check_3();
Check_4();
}
int main (void)
{
IO1DIR|=R_1; // Row as output
IO1DIR|=R_2;
IO1DIR|=R_3;
IO1DIR|=R_4;
IO1DIR &=~C_1; //Column as input
IO1DIR &=~C_2;
IO1DIR &=~C_3;
IO1DIR &=~C_4;
IO1SET|=R_1;
IO1SET|=R_2;
IO1SET|=R_3;
IO1SET|=R_4;
init_lcd();
command_write(0x01);
command_write(0x80);
putstring("KEYPAD");
delay(count);
while(1)
{
Keypad();
}
}
Page39
EMBEDDED SYSTEM
3.8 PWM
Pulse width modulation (PWM) is a powerful technique for controlling analog circuits with a
processor's digital outputs. PWM is employed in a wide variety of applications, ranging from
measurement and communications to power control and conversion.
3.8.1 Calculations
1. We know that, v=IR as the resistance decreases the voltage increases and vice versa,there
we can control voltage by varying resistance.
𝑓 = 1⁄𝑇
2. We know that the time period, T=Ton +Toff.
𝐓𝐨𝐧
3. DC= 𝑻
4. Vout=vmax*DC
Page40
EMBEDDED SYSTEM
int main()
{
VPBDIV=0x01; //60MHz CLOCK
pwm_init();
while(1)
{
PWMPCR=0x0200; //PWM1 ENABLED
PWMTCR=0X09; //COUNTER ENABLE
}
}
GSM modem interfacing with microcontroller for SMS control of industrial equipment’s. The
sending SMS through GSM modem when interfaced with microcontroller or PC is much
simpler as compared with sending SMS through UART.
The transmit signal of serial port of microcontroller is connected with transmit signal (TxD)
of the serial interface of GSM Modem while receive signal of microcontroller serial port is
connected with receive signal (RxD) of serial interface of GSM Modem.
Page41
EMBEDDED SYSTEM
Page42
EMBEDDED SYSTEM
Page43
EMBEDDED SYSTEM
GsmPutSSerial( str );
GsmPutCSerial(26); //Send Control Z.
recvResponse1( response );
if( response[3] != 'S' )
{
recvResponse1( response );
return 1;
}
return 0 ;
}
unsigned char getSMS(sms_data *sms_data_ptr)
{
unsigned char ch, i;
GsmPutSSerial("AT+CMGL=\"ALL\"\r");
while( (ch = GsmGetCSerial()) != 'K' && ch != '+' ) ;
if( ch == 'K' )
{
while( GsmGetCSerial() != '\r' );
while( GsmGetCSerial() != '\n' );
return 0;
}
while( (ch = GsmGetCSerial()) != 'S' && ch != 'G' ) ;
if( ch == 'S' )
{
while( GsmGetCSerial() != '\r' );
while( GsmGetCSerial() != '\n' );
return 0;
}
while( GsmGetCSerial() != ' ' );
i=0;
while( (ch = GsmGetCSerial()) != ',' ) sms_data_ptr->index[i++] = ch;
sms_data_ptr->index[i++] = '\0';
while( GsmGetCSerial() != ',' );
while( GsmGetCSerial() != '\"' );
Page44
EMBEDDED SYSTEM
i=0;
while( (ch = GsmGetCSerial()) != '\"' ) sms_data_ptr->phone_num[i++] = ch;
sms_data_ptr->phone_num[i++] = '\0';
while( GsmGetCSerial() != '\n' );
i=0;
while( (ch = GsmGetCSerial()) != '\r' ) sms_data_ptr->dat[i++] = ch;
sms_data_ptr->dat[i++] = '\0';
while( GsmGetCSerial() != '\n' );
while(1)
{
if( GsmGetCSerial() == '+' )
{
while( GsmGetCSerial() != '\n' );
while( GsmGetCSerial() != '\r' );
while( GsmGetCSerial() != '\n' );
}
else
{ while( GsmGetCSerial() != '\n' );
while( GsmGetCSerial() != '\n' );
return 1;
}
}
}
unsigned char deleteSms(unsigned char *index)
{
unsigned char response[10];
GsmPutSSerial("AT+CMGD=");
GsmPutSSerial(index);
GsmPutSSerial("\r");
recvResponse1( response );
return 1;
}
Page45
EMBEDDED SYSTEM
Page46
EMBEDDED SYSTEM
3.10.2 Accelerometer
Accelerometer is an electromechanical device that measures the force of acceleration due to
gravity in g unit.
The ADXL335 measures acceleration along X, Y and Z axes and gives analog voltage output
proportional to the acceleration along these 3 axes.
Microcontrollers can process these voltages by converting them to digital signals using ADC.
Page47
EMBEDDED SYSTEM
Page48
EMBEDDED SYSTEM
putstring("technology");
delay(10000);
while(1)
{
tempx=adc_read(0,1);
tempy=adc_read(0,2);
tempz=adc_read(0,3);
command_write(0x01);
command_write(0x80);
sprintf(buff,"%d",tempx);
putstring(buff);
delay(100000);
command_write(0x87);
sprintf(buff,"%d",tempy);
putstring(buff);
delay(100000);
command_write(0xC0);
sprintf(buff,"%d",tempz);
putstring(buff);
delay(100000);
}
}
3.10.3Temperature Sensor
A temperature sensor is a device, usually an RTD (resistance temperature detector) or a
thermocouple, that collects the data about temperature from a particular source and converts
the data into understandable form for a device or an observer and so on.
Page49
EMBEDDED SYSTEM
Page50
EMBEDDED SYSTEM
do
{
i = AD1GDR; // Read A/D Data Register
} while ((i & 0x90000000) == 0); // Wait for end of A/D Conversion
break;
}
return (i >> 6) & 0x03FF; // bit 6:15 is 10 bit AD value
}
int main (void)
{
init_lcd();
init_adc0();
command_write(0x01);
command_write(0x80);
putstring("ELECTRONIC VALVE");
command_write(0xC0);
putstring("USING WIFI");
delay(100000);
while(1)
{
TEMP_MONITOR();
}
}
void TEMP_MONITOR(void)
{
short adc_value = 0;
float volts = 0.0 ,temp = 0.0;
adc_value = adc_read (ADC0,CHANNEL_2);
volts = ( (adc_value * 3.3))/1023;
temp = volts * 100;
sprintf ((char * )buf, "TEMP:%.3fC ", temp);
command_write(0x01);
command_write(0x80);
putstring((char *)buf);
Page51
EMBEDDED SYSTEM
delay (1000);
if (temp>33)
{
command_write(0x01);
command_write(0x80);
putstring("MORE TEMPERATURE");
delay(1000000);
}
else
{
command_write(0x01);
command_write(0x80);
putstring("NORMAL TEMPERATURE");
delay(1000000);
}
3.10.4Timer
LPC2148 comes loaded with two 32-bit-Timer blocks. Each Timer block can be used as a
‘Timer’ (like for e.g. triggering an interrupt every ‘t’ microseconds) or as a ‘Counter’ and can
be also used to demodulate PWM signals given as input.
A timer has a Timer Counter(TC) and Prescale Register(PR) associated with it. When Timer
is Reset and Enabled TC is set to 0 and incremented by 1 every ‘PR+1’ clock cycles. When it
reaches its maximum value it gets reset to 0 and hence restarts counting. Prescale Register is
used to define the resolution of the timer. If PR=0 then TC is incremented every 1 clock cycle
of the peripheral clock. If PR=1 then TC is incremented every 2 clock cycles of peripheral
clock and so on. By setting an appropriate value in PR we can make timer increment or count
: every peripheral clock cycle or 1 microsecond or 1 millisecond or 1 second and so on.
Page52
EMBEDDED SYSTEM
int main(void)
{
VPBDIV=0x01;
IO0DIR|=LED;
while(1)
{
IO0SET|=LED;
//while(1);
timer0delay(10);
IO0CLR|=LED;
timer0delay(200);
}
}
void timer0delay(unsigned int a) //1ms
{
T0CTCR=0X0000;
T0PR=59; // 1ms
T0MR0=a;
T0MCR=0x00000004;
T0TCR=0X02; //reset
T0TCR=0X01; //start
while(T0TC!=T0MR0);
T0TC=0;
}
Page53
EMBEDDED SYSTEM
Chapter 4
OUTCOMES
4.1 Robot with security
A robot is a machine—especially one programmable by a computer— capable of carrying
out a complex series of actions automatically. Robots can be guided by an external control
device or the control may be embedded within. Robots may be constructed to take on human
form but most robots are machines designed to perform a task with no regard to how they
look. By interfacing the above programs, we can run the robot.
Page54
EMBEDDED SYSTEM
Page55
EMBEDDED SYSTEM
void scan_row3(void);
void scan_row4(void);
int keypad_arm (void);
void PASSWORD();
void delay (int i);
void ir_sen(void);
void fire_sen(void);
int rfid1(void);
unsigned char code1[8]="02557698";
int a=0;
unsigned char buff1[10];
void init_key()
{ IO1DIR = (ROW1 |ROW2 |ROW3 | ROW4);
IO1DIR = ~(COL1 |COL2 |COL3 | COL4); //columns as INPUT
IO1SET = (ROW1 |ROW2 |ROW3 | ROW4);
}
unsigned char scan_key()
{ scan_row1();
scan_row2();
scan_row3();
scan_row4();
return key;
}
void scan_row(unsigned char i)
{ if(!(IO1PIN & COL1))
{
while(!(IOPIN1 & COL1));
{
// continue;
}
key_num = keyboard[0+i];
key = keyboard[0+i];
keypressed = 1;
}
Page56
EMBEDDED SYSTEM
Page57
EMBEDDED SYSTEM
for (k=0;k<1024;k++);
}
void delay(int i)
{ int j,k;
for (j=0;j<i;j++)
for (k=0;k<1024;k++);
}
void ir_sen(void)
{ if((IO0PIN & ir_sensor)==0)
{ motor_stop();
command_write(0x01);
command_write(0x80);
putstring("object detected");
IO0SET |= LED; // led on
delay(10000);
IO0CLR |= LED; // led off
delay(10000);
rfid1();
}
}
void fire_sen(void)
{ if((IO0PIN & fire_sensor)==0)
{ motor_stop();
command_write(0x01);
command_write(0x80);
putstring("fire detected");
IO0SET |= BUZZ; // led on
delay(10000);
rfid1();
}
}
int rfid1(void)
{ int k=0;
command_write(0x01);
Page58
EMBEDDED SYSTEM
command_write(0x80);
putstring("swipe");
delay(10000);
command_write(0x01);
command_write(0x80);
putstring("the card");
while(1)
{
for(k=0;k<8;k++)
{ buff1[k]=uart0_getkey();
}
buff1[8]='\0';
command_write(0x01);
putstring(buff1);
delay(5000);
if(strcmp(buff1,"02557698")==0)
{ command_write(0x01);
command_write(0x80);
putstring("valid user");
delay(10000);
PASSWORD();
}
else{
command_write(0x01);
command_write(0x80);
putstring("invalid user");
delay(10000);
}
}
}
void PASSWORD()
{ command_write(0x01);
command_write(0x80);
putstring("ENTER PASSWORD");
Page59
EMBEDDED SYSTEM
delay(10000);
command_write(0xC0);
while(1)
{ while(a<4)
{ hold=scan_key();
if(keypressed==1)
{ putchar(hold);
keypressed=0;
buffer[a++]=hold;
}
}
buffer[4]=0;
if(strcmp(buffer,"1234")==0)
{ command_write(0x01);
command_write(0x80);
putstring("valid");
delay(10000);
motor_clk();
}
else{ command_write(0x01);
command_write(0x80);
putstring("invalid");
delay(10000);
}
}
}
int main (void)
{ IO1DIR&=~Sw1;
IO1DIR&=~Sw2;
IO1DIR&=~Sw3;
IO1DIR |= In1;
IO1DIR |= In2;
IO1DIR |= In3;
Page60
EMBEDDED SYSTEM
IO1DIR |= In4;
IO0DIR&=~ir_sensor;
IO0DIR&=~fire_sensor;
IO0DIR |= LED;
IO0DIR|=BUZZ;
init_lcd();
init_key();
while(1)
{ if(!(IO1PIN & Sw1))
{motor_clk();
ir_sen();
fire_sen();
}
else if (!(IO1PIN & Sw2))
{ motor_anticlk();
ir_sen();
fire_sen();
}
else if (!(IO1PIN & Sw3))
{ motor_stop();
ir_sen();
fire_sen();
}
}
}
Page61
EMBEDDED SYSTEM
Conclusion
Many embedded systems have requirements that differ significantly both in details and in
scope from desktop computers. In particular, the demands of the specific application and the
interface with external equipment may dominate the system design. Also, long life-cycles and
in some cases extreme cost sensitivity require more attention to optimization based on these
goals rather than maximizing the computational throughput.
Page62
EMBEDDED SYSTEM
Outcomes
I have carried out my internship my in Technofly Solutions. I have learnt about Embedded
Systems, ARM LPC-2148 and Arduino microcontroller. Designed an embedded system to
control robotic motions using various sensors.
Outcomes of internship are
1. Enhancement the client interface to make it more intuitive and user-friendly.
2. Enhancements of clients to work on all types of clients.
3. Enhancement of embedded system to control more types of embedded systems.
4. Handling of error scenarios.
I have learnt in a friendly environment and all my friends and mentors were supportive to
me.
I have also learnt about interfacing of LED, LCD, Switch, DC Motor, Sensors, RFID card,
Wi-Fi, GSM, Buzzer and UART.
I have also learnt to control speed of DC motor and to control brightness of LED using
PWM.
I have done mini-project which involves the control of movement of Robot using LED,
LCD, Switch, DC Motor, Sensors, RFID card, Buzzer and 4X4 keyboard.
Page63
EMBEDDED SYSTEM
References
1. “Computers as Components: Principles of Embedded Computing Systems Design” by
Wayne Wolf.
2.”Embedded Systems: A Contemporary Design Tool” by James K Peckol.
3.”Embedded Systems: Design and Applications” by Barrett
Page64
EMBEDDED SYSTEM
Page65