Download as pdf or txt
Download as pdf or txt
You are on page 1of 98

THENI KAMMAVAR SANGAM

COLLEGE OF TECHNOLOGY

ELECTRONICS AND COMMUNICATION


ENGINEERING

ET3491- EMBEDDED SYSTEMS


AND IOT DESIGN

NAME :

REG NO :
THENI KAMMAVAR SANGAM
COLLEGE OF TECHNOLOGY
KODUVILARPATTI, THENI-625 534

BONAFIDE CERTIFICATE

Name : ------------------------------------
Reg.no : ------------------------------------
Sem. /Dept : ------------------------------------
Subject : ------------------------------------

Certified that this is the bonafide record of work


done by The above student in
Laboratory during the year 2023 - 2024.

LAB-IN CHARGE HEAD OF THE DEPT.

Submitted for the Practical Examination held on -----------

INTERNAL EXAMINER EXTERNAL EXAMINAR


EXP.NO DATE CONTENTS PAGE MARKS STAFF
NO AWARDED INITIAL

3
EXP.NO DATE CONTENTS PAGE MARKS STAFF
NO AWARDED INITIAL
MICROCONTROLLR
8051

5
EXP NO: DATE: ---/---/---

ARITHMATIC OPERATION IN 8051


8 BIT ADDITIONS OF TWO NUMBERS WITH CARRY

Aim:
To write on ALP to perform addition of two 8 bit data using 8051 microcontroller.

Apparatus Required:
1. 8051 microcontroller kit
2. Keyboard

Algorithm:
1. Initialize carry value in R0 register.
2. Initialize Acc with first data.
3. Add the next data with Acc.
4. If carry flag is not set, jump to L1.
5. Increment the carry and initialize DPTR
6. Move the sum value of DPTR.
7. Move the carry to Acc from there moves it to DPTR.
8. Halt the program.

PROGARM: ADDITION
ADDRESS LABEL MNEMONICS OPCODE COMMENTS

4100 MOV R0,#00H 78 Clear R0 to store carry


4101 00
4102 MOV A,#05H 74 Initialize first data
4103 05
4104 ADD A,#03H 24 Add the data
4105 03
4106 JNC L1 50 If no carry jump to L1
4107 01
4108 INC R0 08 Increment R0
4109 L1 MOV DPTR,#5000H 90 Initialize DPTR with 4106
410A 50
410B 00
410C MOVX @DPTR,A F0 Move carry in external memory
410D INC DPTR A3 Increment DPTR
410E MOV A,R0 E8 Carry to Acc
410F MOVX @ DPTR,A F0 Move carry in external memory
4110 L2 SJMP L2 80 Start jump(relative address)
4111 FE Halt the program
Result:

7
EXP NO: DATE: ---/---/---

8- BIT SUBTRACTION OF TWO NUMBERS WITH CARRY

Aim:
To write on ALP to perform subtraction of two 8 bit data using 8051 microcontroller.

Apparatus Required:

1.8051 microcontroller kit


2. Keyboard

Algorithm:
1. Initialize carry value in R0 register.
2. Initialize Acc with first data.
3. Subtract the next data with Acc.
4. If carry flag is not set, jump to L1.
5. Increment the carry and initialize DPTR
6. Move the sum value of DPTR.
7. Move the carry to Acc from there moves it to DPTR.
8. Halt the program.

PROGARM: SUBRACTION

ADDRESS LABEL MNEMONICS OPCODE COMMENTS

4100 MOV R0,#00H 78 Clear R0 to store carry


4101 00
4102 MOV A,#05H 74 Initialize first data
4103 05
4104 SUBB A,#03H 24 Add the data
4105 03
4106 JNC L1 50 If no carry jump to L1
4107 01
4108 INC R0 08 Increment R0
4109 L1 MOV DPTR,#5000H 90 Initialize DPTR with 5000
410A 50
410B 00
410C MOVX @DPTR,A F0 Move carry in external memory
410D INC DPTR A3 Increment DPTR
410E MOV A,R0 E8 Carry to Acc
410F MOVX @ DPTR,A F0 Move carry in external memory
4110 L2 SJMP L2 80 Start jump(relative address)
4111 FE Halt the program
Result:

9
EXP NO: DATE: ---/---/---

8 BIT MULTIPLICATION OF TWO NUMBERS WITH CARRY

Aim:
To write on ALP to perform Multiplication of two 8 bit data using 8051 microcontroller.

Apparatus Required:
1.8051 microcontroller kit
2. Keyboard

Algorithm:
1. Initialize carry value in R0 register.
2. Initialize Acc with first data.
3. Initialize B register with data.
4. Multiply the both register values.
5. Initialize the DPTR register.
6. Move the multiplied value of DPTR.
7. Increment the DPTR register.
8. Move the carry to Acc from their moves it to DPTR.
9. Halt the program

PROGARM: MULTIPLICATION

ADDRESS LABEL MNEMONICS OPCODE COMMENTS

4100 MOV R0,#00H 78 Clear R0 to store carry


4101 00
4102 MOV A,#05H 74 Initialize first data
4103 05
4104 MOV B,#03H 75 Initialize second data
4105 F0
4106 03
4107 MUL AB A4 Multiply the two data
4108 MOV DPTR,#5000H 90 Initialize DPTR with 5000
4109 50
410A 00
410B MOVX @ DPTR,A F0
410C INC DPTR A3 Increment DPTR
410D MOV A,B E5 Move the content of B to A
410E MOVX @ DPTR,A F0 Move carry in external memory
410F L1 SJMP L1 80 Start jump(relative address)
4110 FE Halt the program
Result:
EXP NO: DATE: ---/---/---

8 BIT DIVISION TWO NUMBERS WITH CARRY

Aim:
To write on ALP to perform Division of two 8 bit data using 8051 microcontroller.

Apparatus Required:
1.8051 microcontroller kit
2. Keyboard

Algorithm:
1. Initialize carry value in R0 register.
2. Initialize Acc with first data.
3. Initialize B register with data.
4. Multiply the both register values.
5. Initialize the DPTR register.
6. Move the multiplied value of DPTR.
7. Increment the DPTR register.
8. Move the carry to Acc from there moves it to DPTR.
9. Halt the program

PROGARM: DIVISION

ADDRESS LABEL MNEMONICS OPCODE COMMENTS

4100 MOV R0,#00H 78 Clear R0 to store carry


4101 00
4102 MOV A,#05H 74 Initialize first data
4103 05
4104 MOV B,#03H 75 Initialize second data
4105 F0
4106 03
4107 DIV AB 84 Divide the two data
4108 MOV DPTR,#5000H 90 Initialize DPTR with 5000
4109 50
410A 00
410B MOVX @DPTR,A F0
410C INC DPTR A3 Increment DPTR
410D MOV A,B E5 Move the content of B to A
410E MOVX @ DPTR,A F0 Move carry in external memory
410F L1 SJMP L1 80 Start jump(relative address)
4110 FE Halt the program
Result:
EXP NO: DATE: ---/---/---
INTERFACING OF DAC WITH 8051

AIM:

To write an ALP program to interface DAC with 8051 and to generate square &
rectangular waveform.

APPARATUS REQUIRED:
• 8051 Trainer Kit
• Keyboard
• 50 core cable
• DAC Interface Board
• Power chord
• CRO

ALGORITHM

TRIANGULAR WAVEFORM GENERATION


1. Initialize the data pointer with address FFC8
2. Move the data 00 to accumulator
3. Out the data to address FFC8
4. Call delay program
5. Move the data FF to accumulator
6. Out the data to address FFC8
7. Call delay program
8. Go to step 1
9. Halt the program

SAWTOOTH WAVEFORM GENERATION


1. Initialize the data pointer with address FFC0
2. Move the data 00 to accumulator
3. Out the data to address FFC0
4. Increment the accumulator value by one
5. Out the value to DPTR address
6. Halt the program

PROGRAM:

GENERATION OF TRIANGULAR WAVE:

ADDRESS OPCODE LABEL MNEMONICS COMMENTS


4100 90 FF C8 MOV DPTR,#FFC8H Move the data to data pointer
4103 74 00 START: MOV A,#00 Move the data 00 to ACC
4105 F0 LOOP1 MOVX @DPTR,A Move the data from ACC to DPTR
4106 04 INC A Increment the ACC value
4107 70 FC JNZ LOOP1 Jump on no zero to LOOP1
4109 74 FF MOV A,#FF Move the data FF to ACC
410B F0 LOOP2 MOVX @DPTR,A Move the data from ACC to DPTR
410C 14 DEC A Decrement the ACC value
410D 70 FC JNZ LOOP2 Jump on no zero to LOOP2
410F 02 41 03 LJMP START Jump to start
GENERATION OF SAWTOOTH WAVE:

ADDRESS OPCODE LABEL MNEMONICS COMMENTS


4100 90 MOV DPTR,#FFC0 Move the data to data pointer
4101 FF
4102 C0
4103 74 MOV A,#00 Move the data 00 to ACC
4104 00
4105 F0 LOOP: MOVX @DPTR,A Move the data from ACC to DPTR

4106 04 INC A Increment the ACC value


4107 80 SJMP LOOP Jump to LOOP
4108 FC

Result:
EXP NO: DATE: ---/---/---
INTERFACING OF ADC WITH 8051
Aim:
To write an ALP program for interfacing ADC using 8051 microcontroller.
Apparatus Required:
1. 8051 microcontroller kit
2. Keyboard
3. 50 core cable
4. ADC Interface board
5. Power Chord
Algorithm:
1. Initialize the data pointer with address FFC8.
2. Select channel 0 in ADC.
3. Out the channel address to address FFC8.
4. Make the ALE Low and High.
5. Give SOC signal to ADC.
6. Check the EOC pin in ADC (high or not).
7. If it is high means read the Digital value from ADC.
8. Store the digital value to memory location 4150.
9. Halt the program.

PROGRAM:
ADDRESS LABEL MNEMONICS OPCODE COMMENTS
4100 START MOV DPTR ,#FFC8H 90 FF C8 Move the content of FFC8 to the
DPTR
4103 MOV A, #10 74 10 Select channel 10.
4105 MOVX @DPTR, A F0 Make ALE low
4106 MOV A, #18 74 18 Make ALE high
4108 MOVX @DPTR, A F0 Move the data from ACC to DPTR
4109 MOV DPTR, #FFD6 90 FF D6 Move the content of FFD6 to the
DPTR
410C MOV A,#01 74 01 SOC signal high.
410E MOVX @DPTR, A F0 Move the data from ACC to DPTR
410F MOV A,#00 74 00 SOC signal low.
4111 MOV X @DPTR, A F0 Move the data from ACC to DPTR
4112 MOV DPTR, #FFD8 90 FF D8 Move the content of FFD6 to the
DPTR
4115 WAIT MOV X A,@DPTR E0 Move the data from DPTR TO ACC
4116 JNB E0,WAIT 30 E0 FC Check for EOC.
4119 MOV DPTR, #FFC0 90 FF C0 Read ADC data.
411C MOVX A,@DPTR E0 Move the data from ACC to DPTR

411D MOV DPTR, #4150 90 41 50 Store the Data in memory .


4120 MOVX @DPTR, A F0 Move the data from ACC to DPTR
4121 SJMP HERE 80 FE Start jump(relative address)
Result:
EX NO: 2'S COMPLEMENT, SQUARE AND CUBE OF A NUMBER
DATE :
Aim:
To write on ALP to perform of two’s complement and square ,cube of a number using 8051
microcontroller.

Apparatus Required:
1.8051 microcontroller kit
2. Keyboard

Algorithm:2’s complement
1. Initialize address in DPTR register and store the data at same address.
2. Complement the value in DPTR address.
3. Increment the DPTR data by one.
4. Increment the DPTR address by one.
5. Move the data to DPTR address 4501
6. Halt the program

Algorithm: Square of a number


1. Initialize address in DPTR register with 4500h.
2. Store the data at 4500h and move the data to ACC.
3. Move the data to B register.
4. Multiply both ACC and B register.
5. Store the Result at address 4501
6. Halt the program

Algorithm: Cube of a number


1. Initialize address in DPTR register with 4500h.
2. Load data two with R0 register.
3. Store the data at 4500h and R1 and B register.
4. Multiply both ACC and B register.
5. Multiply the result of acc with R0 register.
6. Increment DPTR and store result at address 4501.
7. Halt the Program
PROGARM: TWO’S COMPLEMENT OPERATIONS USING 8051 CONTROLLER

EXPERIMENT NAME: TWO’S COMPLEMENT

ADDRESS LABEL OPCODE MNEMONICS COMMENTS

4100 904500 MOV DPTR,#4500H Move the address 4500 to dptr


4103 E0 MOVX A,@DPTR From dptr content to acc.
4104 F4 CPL A Complement the acc.

4105 04 INC A Increment acc by 01.

4106 A3 INC DPTR Increment the dptr


4107 F0 MOVX @DPTR,A Move the result to address 4501.

4108 80FE HERE: SJMP HERE End.

SQUARE AND CUBE OPERATIONS USING 8051 CONTROLLER

EXPERIMENT NAME: a) SQUARE

ADDRESS LABEL OPCODE MNEMONICS COMMENTS


4100 904500 MOV Move the address 4500 to dptr
DPTR,#4500H
4103 E0 MOVX A,@DPTR From dptr content to acc.
4104 F5F0 MOV B,A Move the acc content to b reg

4106 A4 LOOP: MUL AB Multiply a and b register value.

4107 A3 INC DPTR Increment the dptr address


4108 F0 MOVX @DPTR,A Store the result in address 4501.
4109 80FE HERE: SJMP End
HERE
END End

EXPERIMENT NAME: b) CUBE

ADDRESS LABEL OPCODE MNEMONICS COMMENTS


4100 904500 MOV DPTR,#4500H Move the address 4500 to dptr
4103 E0 MOVX A,@DPTR From dptr content to acc.
4104 7802 MOV R0,#02H Move the content 02 to reg r0
4106 F5F0 MOV B,A Move a value to b register.

4108 A9F0 MOV R1,B Move b value to R1.

410A A4 LOOP:MUL AB Multiply a and b register value.

410B 89F0 MOV B,R1 Move the register R1 value to B.


410D D8FB DJNZ R0,LOOP Decrement r0 value until it reaches
00.
410F A3 INC DPTR Increment the dptr address

4110 F0 MOVX @DPTR,A Store the result in address 4501.

4111 80FE HERE: SJMP HERE End

END End

RESULT:
EXP NO:
SQUARE WAVE GENERATION USING DAC

AIM:
To interface the DAC with 8051 microcontroller and generate the square wave.

REQUIREMENTS:

S.No Hardware & Software Requirements Quantity


1 8051 Trainer Kit 1No
2 Power Chord 1No

3 DAC interfacing board 1 No


4 CRO 1 No
CIRCUIT DIAGRAM:

WAVEFORM:
SQUARE WAVE

ADDRESS LABEL MNEMONICS OPCODE COMMENTS


4100 MOV DPTR, # FFC0 90,FF,C8 Move the immediate
Data FFC0
4103 ST A RT MOV A, # 00 74,00
4105 MOVX @ DPTR, A F0 Initialize the Accumulator
4106 LCALL DELAY 12,41,12 To zero
4109 MOV A, # FF 74,FF Long call the delay
410B MOVX @ DPTR, A F0 Move the content of
410C LCALL DELAY 12,41,12 Accumulator to FF
410F LJMP START 02,41,03 Long call delay
4112 DELAY MOV R1, # 05 79,05 Long jump to start
4114 LOOP MOV R2, # FF 74,FF Move the 05 data
4116 HE RE DJNZ R2, HERE DA,FE To R register
4118 DJNZ R1, LOOP D9,FA Decrement Jump NON zero
411A RET 22 Return to main program
411C SZMP START 80,E3 Short jump to start

OBSERVATION:

AMPLITUDE TIME PERIOD

Result :
DIGITAL CLOCK
AIM:-

To display the digital clock specifically by displaying t h e hours, minutes


and seconds using 8051 kits
Theory:
Observation:
Input
1200 00
1201 00
1202 00
1203 00
1204 00

Output:
Time is displayed in the RTC board as
! Hour ŀ Minutes ŀ seconds ŀ
X 0 0 0 5 9

X 0 0 1 0 0

RESULT:
.
l O M o A R c P S D | 3 71 2 4 2 9 0

Introduction to IDE

An Integrated Development Environment (IDE) is a software application or platform that


provides comprehensive tools and features for computer programmers and software developers
to create, edit, debug, and manage code. IDEs are designed to streamline the development
process by consolidating various aspects of software development into a single environment,
making it more efficient and productive for developers.

Keil C, also known as Keil µ Vision, is an integrated development environment (IDE)


specifically designed for programming embedded systems and microcontrollers. It is developed
by Keil Software, a subsidiary of Arm Holdings. Keil C is particularly popular among embedded
systems developers and is widely used for developing firmware and software for various
microcontroller architectures.

Workingwithkeil:–

To open keil software click on start menu then program and then select keil2 (or any other
version keil3 etc. here the discussion is on keil2 only). Following window will appear on your
screen
l O M o A R c P S D | 3 71 2 4 2 9 0

Fig. 1: Screenshot of Keil IDE


You can see three different windows in this screen. 1) project work space window 2) editing
window 3) output window.
Project workspace window is for showing all the related files connected with your project.
Editing window is the place where you will edit the code
Output window will show the output when you compile or build or run your project.
Now to start with new project follow the steps
● click on project menu and select new project
● you will be asked to create new project in specific directory
● just move to your desired directory and there create a new folder for your project
named “first”. Here I am creating new project in d:keil2myprojectsfirst as shown in
figure
l O M o A R c P S D | 3 71 2 4 2 9 0

Fig. 2: Screenshot of New Project creation on Keil IDE


● give the name of project as “test”. By default it will be saved as *.v2 extension.

Target Selection
● now you will be asked to chose your target device for which you want to write the
program.
● scroll down the cursor and select generic from list. expand the list and select 8051
(all variants)

Fig. 3: Screenshot of selecting target device on Keil IDE


when you click OK, you will be asked to add startup code and file to your project folder. click
yes. Now on your screen expand target1 list fully. You will see following window.
l O M o A R c P S D | 3 71 2 4 2 9 0

Fig. 4: Screenshot of New Project in Keil


● now click on file menu and select new file. editor window will open. Now you can
start writing your code.

Include Header File


● as you start writing program in C, same way here also you have to first include the
header file. Because our target is 8051 our header file will be “reg51.h”
● after including this file. just right click on the file and select open document
<reg51.h>. The following window will appear
l O M o A R c P S D | 3 71 2 4 2 9 0

Fig. 5: Screenshot of adding a header file in a project in Keil


● if you scroll down cursor you will see that all the SFRs like P0-P3, TCON, TMOD,
ACC, bit registers and byte registers are already defined in this header file. so one
can directly use these register names in coding
● now you can write your program same as c language starting with void main()
● after completing the code save the file in project folder with “.c” extension.
● now right click on “source group 1” in project workspace window. select “add files
to source gorup 1”
● select the C file you have created and click add button
l O M o A R c P S D | 3 71 2 4 2 9 0
● Fig. 6: Screenshot of adding a file to a source group in Keil
● you will see that the c file has been added in source group

Building Target
● now to compile the program from project menu select “build target”. In the output
window you will see the progress
● if there is any compilation error then target will not be created. Remove all the
errors and again build the target till you find “0 Error(s)”
● now you are ready to run your program. from debug menu select “start/stop debug
session”
● you will see your project workspace window now shows most of the SFRs as well
as GPRs r0-r7. also one more window is now opened named “watches”. in this
window you can see different variable values.
l O M o A R c P S D | 3 71 2 4 2 9 0

Fig.
7: Screenshot of building a target in Keil

● to add variable in watch window goto “watch#1” tab. then type F2 to edit and type
the name of your variable
● if you want to see the output on ports go to peripheral menu and select I/O ports.
select the desire port. you can give input to port pins by checking or unchecking
any check box. here the check mark means digit 1 and no check mark means 0. the
output on the pin will be shown in same manner
● to run the program you can use any of the option provided “go”, “step by step”,
“step forward”, “step ove” etc.
● now after testing your program you need to down load this program on your target
board that is 8051. for this you have to create hax file
● to create hex file first stop debug session. Again you will be diverted to project
workspace window.
● right click on “target 1” and select “option for target 1”. Following window will
appear.
l O M o A R c P S D | 3 71 2 4 2 9 0

Fig. 8: Screenshot of Target options in Keil


● select output tag and check “create hex file” box
● now when you again build your program you will see the message in the output
window “hex file is created”.
● in your project folder you can see the hex file with the same name of your project as
“test.hex”.
● this file you can directly load in 8051 target board and run the application on actual
environment

Result:
l O M o A R c P S D | 3 71 2 4 2 9 0

Ex.No: Configuring an I/O port using bitwise programming


Date:

Aim:
To develop a C language program to configure an I/O port bitwise.

Apparatus & Software Required


1.Personal Computer
2. Keilµ Vision5 software.
3. Flash Magic
4. USB cable

Algorithm:
1.Include the project header file.
2.Configure P1 as an output port and P0.5 as output.

Procedure:
1. Follow the steps to create a New project
2. Choose the device as 89C51.
3. Type the below code and save it with the name (anyname.c)
4. Follow the steps to create a New Project to compile and build the program
5. Follow the procedures to download your Hex code to the processor using Flash Magic
Software.

Program:

#include <reg51.h>
sbit eee= P0^5;
void delay( )
{
unsigned int i;
for(i=0;i<=0xFF;i++);
}
void main()
{
while(1)
{
P1 = 0x00;
eee=0;
delay( );
P1 = 0xFF;
eee=1;
delay( );
}
}
Result :
l O M o A R c P S D | 3 71 2 4 2 9 0

Ex.No. Serial communication using UART port of 8051


Date:

Aim:
To develop a C language program to perform serial communication using UART port of
8051.

Apparatus & Software Required

1. 8051 Microcontroller kit


2. Keilµ Vision5software.
3. Flash Magic.
4. USB cable.

Algorithm:
1.Include the project header file.
2. Calculate the value to be loaded in the timer register to set the baud rate to 9600.
3. Initialize the timer 1 in Mode 2 (8-bit auto-reload)
4.Load TH1 with the high byte of the Baud rate
5.Configure SCON (Serial Control Register) with 8-bit data, variable baud rate, enable
reception (RI), and enable UART (TI).
4.Start the timer 1.
5.Store the character ‘Super’ in the SBUF register in 2nd program store the character 's' in the
SBUF register.
6.Check the transmit interrupt TI for the completion of data transfer.
7.Disable the transmit interrupt.
8.Stop the timer.
9.Repeat the loop for a continuous process.
Procedure:
1. Follow the steps to create a New project
2. Choose the device as AT89C51 .
3. Type the below code and save it with the name (anyname.c)
4. Follow the steps to create a New Project to compile and build the program
5. Follow the procedures to download your Hex code to the processor using Flash Magic
Software.

Program1:

#include <reg51.h>
void main()
{
unsignedinti=0;
unsigned char a[5]={'s','u','p','e','r'};
TMOD = 0x20; //8 bit auto reload mode selection
TH1 = 0xFD; // 9600 Baud rate selection
SCON = 0x50; 8-bit data, variable baud rate, enable reception (RI), and enable UART (TI)
TR1=1;
l O M o A R c P S D | 3 71 2 4 2 9 0

while(i<=4)
{
SBUF =a[i];
while(TI==0);
i++;
TI=0;
TR1=1;
}
}

Program 2 :

#include <reg51.h>
void main()
{
TMOD = 0x20;
TH1 = 0xFD;
SCON = 0x50;
TR1=1;
SBUF ='S';
while(TI==0);
TI=0;
TR1=0;

Result:
l O M o A R c P S D | 3 71 2 4 2 9 0

Ex.No: Configuring timer for generating hardware delay


Date:

Aim:
To develop a C language program to configure a timer for generating hardware delay of
1s.

Apparatus & Software Required

1. 8051 Microcontroller kit


2. Keilµ Vision5software.
3. Flash Magic.
4. USB cable.

Algorithm:

1.Include the project header file.


2.Define the delay function.
3.Set Timer 0 in Mode 1 (16-bit timer)
4.Load the initial value for a 1-second delay for 11.0985 MHz crystal frequency.
5.Start Timer 0
6.Check for the timer0 overflow flag.
7.Stop Timer 0
8.Clear the timer overflow flag
9. Repeat the delay loop for a continuous process.

Procedure:
1. Follow the steps to create a New project
2. Choose the device as AT89C51 .
3. Type the below code and save it with the name (anyname.c)
4. Follow the steps to create a New Project to compile and build the program
5. Follow the procedures to download your Hex code to the processor using Flash Magic
Software.

Program:

#include <reg51.h>

#include <reg51.h>
void timer0Delay()
{
TMOD |= 0x01;
TR0 = 1;
TH0=0xFF;
while (TF0 == 0);
P1=0x55;
P1=0xAA;
l O M o A R c P S D | 3 71 2 4 2 9 0

TR0 = 0; // Stop Timer 0


TF0 = 0; // Clear the timer
overflow flag
}
void main()
{
while (1)
{
timer0Delay();
}
}

Result:
Working with IAR Embedded Workbench

HOW TO CREATE A NEW PROJECT

1. CREATING A NEW PROJECT:

IAR Embedded Workbench Installation is completed; Shortcut ICON is placed at your


Desktop. Just make a double click on that ICON. New Window is open as given below.

1. To create a new project, choose Project>Create New Project. The Create New
Project
Dialog box appears, which lets you base your new project on a project template.
2. Make sure the Tool chain is set to ARM, and click OK.
3. Select the project template Empty project, and click ok button. This simply
creates an empty project that uses default project setting.
4. In the standard Save As dialog box that appears, specify where you want to
place your project file, that is, in your newly created projects directory. Type
your project name in the File name box, and click Save to create the new
project. E.g. LED.

The project will appear in the Workspace window

37
To Creating your Application ‘C’ file, Choose FILE menu and select NEW>File

Edit the application code in C Language. E.g. Led.c


To Save your ‘C’ file, Choose File>Save As. In the standard Save As dialog box that
appears, specify where you want to place your project file, that is, in your project
directory. Type your filename in the File name box, and click Save to create the new
project. E.g. Led.c

2. ADDING FILES TO THE PROJECT

1. In the Workspace window, select the destination to which you want to add a
source file; a group or, as in this case, directly to the project.
2. Choose Project>Add Files to open a standard browse dialog box. Locate the files
led.c Select them in the file selection list, and click Open to add them to the project.

To save your work space, Choose File>Save Workspace and specify where you
want to place your workspace file. In this tutorial, you should place it in your newly
created project directory. Type LED in the File name box, and click save button.

3. SETTING PROJECT OPTIONS

Now you will set the project options. For application projects, options can be set on all
levels of nodes. First you will set the general options to suit the processor configuration
in this tutorial. Because these options must be the same for the whole build
configuration,they must be set on the project node.
1. Select the project folder icon LED - Debug in the Workspace window and choose
Project>Options. Then select Output Converter in the Category list to display the
linker option pages.

The Output options are used for specifying details about the output format and the level
of debugging information included in the output file.

Select “option” on the popup menu. After selecting popup menu window shows as given
below. Select output format as “Intel Extended”, output file in the format of .hex format.
45
Select the linker file menu, linker configuration file available at project directory. To
Compile your Project, Choose Project>Rebuild ALL
If your project has no error, then it will show Building successfully and the Hex file will
be generated.
HOW TO CREATE RTOS PROGRAMS

μC/OS-II Porting with IAR Embedded Workbench

1. Create a New Project

1. To create a new project, choose Project>Create New Project. The Create New
Project
Dialog box appears, which lets you base your new project on a project template.

2. Make sure the Tool chain is set to ARM, and click OK.
3. Select the project template Empty project, and click ok button. This simply creates
an empty project that uses default project settings.
4. In the standard Save As dialog box that appears, specify where you want to place
your project file, that is, in your newly created projects directory. Type your
project name in the File name box, and click Save to create the new project. E.g.
LED.
RTOS Package comprises set of ‘C’ files and headed files. C Files are classified as
Application file, CPU files, μC/OS-II Files and BSP.

In this project, we have to split the C files according to the functions. So these files are
integrated under separate folder.

Project Group Names are

APP
BSP
CPU
UCOS-II
- PORT
- SOURCE

2. ADDING Groups TO THE PROJECT

1. Creating several groups is a possibility for you to organize your source files
logically according to your project needs.
2. To create new group Choose Project>Add Group.
3. Type your group name and click ok button.
Now create APP group

Add files to APP group


Create new group

Add files to BSP Group


Create new group

Add Files to CPU


Create new group

Under ucos-ii group, create two group named as source and ports.
Add Corresponding files to above mentioned group
3. SETTING PROJECT OPTIONS
Now you will set the project options. For application projects, options can be set
on all levels of nodes. First you will set the general options to suit the processor
configuration in this tutorial. Because these options must be the same for the whole build
configuration, they must be set on the project node.

1. Select the project folder icon UART - Debug in the Workspace window and
choose Project>Options. Then select C/C++ Compiler where you have select
CODE menu, enable ARM Processor Mode.

57
After that Select Preprocessor menu from same window.
At Preprocessor, we have to include all the directories as given below
$PROJ_DIR$
$PROJ_DIR$\..\uCOS-II\ports
$PROJ_DIR$\..\uCOS-II\source
$PROJ_DIR$\..\BSP
$PROJ_DIR$\..\CPU

For Creating the Hex file, we choose output file format as given below.
Select Linker file as given below.

To Compile this Project, Choose Project>Rebuild ALL

If there is no error, Message window shows like this. Now Hex file is created.

ISP UTILITY
NXP Semiconductors produce a range of Microcontrollers that feature both onchip
Flash memory and the ability to be reprogrammed using In-System Programming
technology. Flash Magic is Windows software that allows easy access to all the ISP
features provided by the devices. These features include:

Erasing the Flash memory (individual blocks or the whole device)


• Programming the Flash memory
• Modifying the Boot Vector and Status Byte
• Reading Flash memory
• Performing a blank check on a section of Flash memory
• Reading the signature bytes
• Reading and writing the security bits
• Direct load of a new baud rate (high speed communications)
• Sending commands to place device in Boot loader mode
Under Windows, only one application may have access the COM Port at any one
time, preventing other applications from using the COM Port. Flash Magic only obtains
access to the selected COM Port when ISP operations are being performed. This means
that other applications that need to use the COM Port, such as debugging tools, may be
used while Flash Magic is loaded. Note that in this manual third party Compilers are
listed alphabetically. No preferences are indicated or implied.

HOW TO DOWNLOAD A CODE TO OUR CONTROLLER

Procedure:
1. Select the COM Port
2. Select the Baud Rate
3. Select Device ( Eg.LPC2148)
4. Interface – None ISP
5. Select Osc. Frequency – 12Mhz
6. Enable “ Erase Blocks used by Hex files”
7. Select the Hex File to be downloaded.
8. Click start
Processing……..
After downloaded completely, window shows like this

Result:
EX. NO:

DATE:
INTERFACING OF ADC AND DAC

AIM To develop a C-Language program for reading an on-chip ADC, convert into decimal
and to display it in PC and to generate a square wave depending on this ADC reading. The ADC
input is connected to any analog sensor/ on board potentiometer.

APPARATUS & SOFTWARE REQUIRED:

1. LPC2148 syllabus board.


2. IAR IDE software.
3. Flash Magic.
4. CRO
5. USB cable.

THEORY:
PROGRAM :ADC
/* - - - - - HEADER FILES - - - - - */
#include<nxp/iolpc2148.h>
#include<stdio.h>
#include "uart.h"
#include "adc.h"
/* - - - - - User defined Variables - - - - - */
unsigned int val=0,volt;
/* - - - - - MAIN FUNCT ION STARTS HERE - - - - - */
void main(void)
{
PINSEL1_bit.P0_28=1;
init(); /* Call the initialization function. Function definition is in “uart.h” */
uart_inital(); /* Call the uart function. Function definition is in
“uart.h” */ adc(); /* Call adc function. Function definition is in “adc.h”
*/ PINSEL1=0X01000000; /*ADC0.1*/
while(1)
{
while(AD0DR_bit.DONE==0); /* Start A/D Conversion */
val=AD0DR1_bit.RESULT;
printf("adc = %d \r\n",val);
}
}

Procedure to View the Result: ADC

1.Compile, Debug & Simulate the above code in IAR.


2.Connect the RS232 cable/USB cable provided to the PC/Laptop and the VSK-
2148 Board, and Power on the Board.
3. For seeing the output in real-time, select the PROG mode, reset the board
and download the code on to the board using Flash Magic through UART0/USB.
4. Now change the Mode-Selection-Switch to EXEC position and reset the board. Open
Win X-Talk, and select the COM port and the baud rate as 9600.
5.Now vary the on board potentiometer knob and observe the values displayed in PC.
6. As you tune the knob, the values displa yed in the PC/Laptop should vary from 0 to 1023
and there will be a shift in the position of the load line depending on the values in the
ADC.
7. You can interface any other analog sensor also (range 0-3.3V) to measure and displa y
the following parameters: temp./pressure/force/flow/acceleration/humidity etc.
PROGRAM: DAC
/* - - - - - Header Files - - - - - */
#include<nxp/iolpc2148.h>
/*The settling time of the DAC is 2.5 µs and the maximum current is 350 µA when BIAS=1*/
#define DAC_BIAS 0x00010000
/* - - - - - delay routine - - - - - */
void delay(unsigned int x)
{
for(int i=0;i<=x;i++);
}
/* - - - - - main function - - - - -*/
void main()
{
PINSEL1=0X00080000;
while(1)
{
/* The Datas has to be passed or moved on to the VALUE bits i.e 15 - 6 and the result will be
(VALUE/(1024*Vref)) */
DACR = (1023 << 6) |
DAC_BIAS;
delay(100000);
delay(100000);
delay(100000);
delay(100000);

/* The Datas has to be passed or moved on to the VALUE bits i.e 15 - 6 and the result will
be
(VALUE/(1024*Vref))
*/

DACR = (0 << 6) | DAC_BIAS;


dela y(100000);
dela y(100000);
dela y(100000);
delay(100000);
}
}
Procedure to View the Result: DAC

1. Compile, Debug & Simulate the above code in IAR.


2. Connect the RS232 cable/USB cable provided to the PC/Laptop and the VSK-
2148 Board, and Power on the Board.
3. For seeing the output in real-time, select the PROG mode, reset the board and
download the code on to the board using Flash Magic through UART0/USB.
4. Now change the Mode-Selection-Switch to EXEC position and reset the
board. Connect the +ve terminal of the CRO probe to A out and _ve terminal
to AGND pins on the board to see the variation in the pulse.

RESULT:
EX. NO:

DATE:

INTERFACING REAL TIME CLOCK AND SERIAL PORT

AIM :

To develop a C-Language program for reading the RTC, convert into decimal and to
display it.

APPARATUS & SOFTWARE REQUIRED :

1. LPC2148 syllabus board.


2. IAR IDE software.
3. Flash Magic.
PROGRAM
/* - - - - - Header Files - - - - - */
#include<nxp/iolpc2148.h>
#include<stdio.h>
#include<string.h>
#include "uart.h"
/* - - - - - Real Time Clock Initialization - - - - - */
void RTC_Init()
{
ILR = 3; /* Disable 32'768 interrupt */
CCR = 0x11; /* Clock enable + 32'767Hz quartz enable; starts the RTC */
CIIR = 0x01; /* Interupt every second */
PREINT = 0x0000016D; /* the integer portion of the prescale value */
PREFRAC = 0x00001B00; /* fractional portion of the prescale value */
YEAR = 2015; /* Year */
MONTH = 05; /* Month */
DOM = 09; /* Day of month loads the date as 09.05.2015 */
DOY = 129; /* Day of year */
DOW = 04; /* Day of week */
HOUR = 10; /* Hours */
MIN = 21; /* Minutes loads the time as 10:21:00 */
SEC = 00; /* Seconds */

}
/* Hint: ARM processor crystal freq. = 12 MHz = 12,000,000 Hz
RTC crystal freq. = 32.768 KHz = 32,768 Hz
Calculate,
PREINT = (12,000,000 / 32,768)-1 = 365 in Decimal = 0x16D in Hex.
PREFRAC = 12,000,000 - (365+1)*32,768 = 6912 in Decimal = 0x1B00 in Hex.
And, for
CIIR = Counter Increment Interrupt Register,
CCR = Clock Control Register
ILR = Interrupt Location Register
Refer, "Volume 1: LPC214x User Manual" PDF Document */

/* - - - - - Start the Clock - - - - - */


void RTCStart( void )
{
CCR |= 0x01; /* CTC Reset */
ILR = 0x01; /* Interrupt location Register */
}
/* - - - - - Read Clock - - - - - */
void Read_rtc( void )
{
printf("TIME--->%d:%d:%d\t",HOUR,MIN,SEC);
printf("DATE--->%d:%d:%d\n",DOM,MONTH,YEAR);
}
/* - - - - - main function starts - - - - - */
void main()
{
baudrate_settings(); /* call function baudrate_settings */
RTC_Init(); /* call function RTC_Init */
RTCStart(); /* call function RTCStart */
while(1)
{
Read_rtc(); /* call function Read_rtc */
}
}

Procedure to View the Result:

1. Compile, Debug & Simulate the above code in IAR.


2.Connect the RS232 cable / USB cable provided to the PC / Laptop and the VSK
- 2148 Board, and Power on the Board.
3. For seeing the output in real-time, select the PROG mode, reset the board
and download the code in the board using Flash Magic through UART0.
4.Now change the Mode-Selection-Switch to EXEC position and reset the board.
5.Open Win X- Talk, Select COM port and Baud rate as 9600
6. Now observe the output data in the PC, it should displa y the digital clock
running with Hr., Min., & Sec. Digits following format: “HH:MM:SS “. along with
Day as “DD:MM:YYYY”
7. Digital Clock will start running from 10:21:00 as programmed by default, you
can modify the code and you can load your desired timing also.
8. Apart from timing it can be programmed to display AM-PM (12Hr mode) also.

RESULT:
EX. NO:
DATE:
INTERFACING KEYBOARD AND LCD

AIM:

To develop a C-Language program for displaying the Key pressed in the Keypad in the
LCD module. The display should come in the desired line and column.

APPARATUS & SOFTWARE REQUIRED :

1. LPC2148 syllabus board.


2. IAR IDE software.
3. Flash Magic.

THEORY :
PROGRAM
/* Keypad Interface
// K1 TO K8 : P0.16 TO P0.23
// Key Value is displayed on UART0
// SCAN LINES : P0.20 TO P0.23 (OUTPUT)
// READ LINES : PO.16 TO P0.19 (INPUT) */
/* - - - - - Header Files - - - - - */
#include<nxp/iolpc2148.h>
#include<stdio.h>
# include "lcd.h"
#include "ke y.h"
/* - - - - - main function starts here - - - - - */
void main()
{
PINSEL2 = 0x00000000; /* P0.16 TO P0.23 Configured as GPIO. */
IO0DIR = 0X00F00F05; /* P0.20 TO P0.23 (O/P), P0.16 TO P0.19(I/P) */
IO1DIR=0x00FF0000; /* LCD data pins as output */
comm(command); /* function to call LCD co mmands */
data1("Press any Key"); /* call the function to display the data in LCD */
while(1)
{
scomm(0xC0); /* function to write single datas in LCD location C0 */
key(); /* call the keypad function*/
}
}

Procedure to see OUTPUT:


• Compile, Debug & Simulate the above code in IAR.
• Connect the RS232 cable / USB cable provided to the PC / Laptop and the VSK -
2148 Boards, and Power on the Board.
• For seeing the output in real-time, select the PROG mode, reset the board
and download the code in VSK-2148 board using Flash Magic through
UART0.
• Now change the Mode-Selection-Switch to EXEC position and reset the board.
• Now observe the LCD output, it should display the Alphabets & Numbers.
• 1st line (upper line) should display the Alphabets Press any Ke y and the 2nd line
(lower line) should display the corresponding data as the Key is Pressed
• You can change Address for upper line from 0x80 to 0x8F and for lower line
from 0xC0 to 0xCF

RESULT :
EX. NO:

DATE: INTERFACING OF ADC AND DAC

AIM :
To develop a C-Language program for reading an on-chip ADC, convert into decimal
and to display it in PC and to generate a square wave depending on this ADC reading. The ADC
input is connected to any analog sensor/ on board potentiometer.

APPARATUS & SOFTWARE REQUIRED:

1. LPC2148 syllabus board.


2. IAR IDE software.
3. Flash Magic.
4. CRO
5. USB cable.

THEORY:
PROGRAM :ADC
/* - - - - - HEADER FILES - - - - - */
#include<nxp/iolpc2148.h>
#include<stdio.h>
#include "uart.h"
#include "adc.h"
/* - - - - - User defined Variables - - - - - */
unsigned int val=0,volt;
/* - - - - - MAIN FUNCT ION STARTS HERE - - - - - */
void main(void)
{
PINSEL1_bit.P0_28=1;
init(); /* Call the initialization function. Function definition is in “uart.h” */
uart_inital(); /* Call the uart function. Function definition is in
“uart.h” */ adc(); /* Call adc function. Function definition is in “adc.h”
*/ PINSEL1=0X01000000; /*ADC0.1*/
while(1)
{
while(AD0DR_bit.DONE==0); /* Start A/D Conversion */
val=AD0DR1_bit.RESULT;
printf("adc = %d \r\n",val);
}
}

Procedure to View the Result: ADC

1.Compile, Debug & Simulate the above code in IAR.


2.Connect the RS232 cable/USB cable provided to the PC/Laptop and the VSK-
2148 Board, and Power on the Board.
3. For seeing the output in real-time, select the PROG mode, reset the board
and download the code on to the board using Flash Magic through UART0/USB.
4. Now change the Mode-Selection-Switch to EXEC position and reset the board. Open
Win X-Talk, and select the COM port and the baud rate as 9600.
5.Now vary the on board potentiometer knob and observe the values displayed in PC.
6. As you tune the knob, the values displa yed in the PC/Laptop should vary from 0 to 1023
and there will be a shift in the position of the load line depending on the values in the
ADC.
7. You can interface any other analog sensor also (range 0-3.3V) to measure and displa y
the following parameters: temp./pressure/force/flow/acceleration/humidity etc.

I
I
PROGRAM: DAC
/* - - - - - Header Files - - - - - */
#include<nxp/iolpc2148.h>
/*The settling time of the DAC is 2.5 µs and the maximum current is 350 µA when BIAS=1*/
#define DAC_BIAS 0x00010000
/* - - - - - delay routine - - - - - */
void delay(unsigned int x)
{
for(int i=0;i<=x;i++);
}
/* - - - - - main function - - - - -*/
void main()
{
PINSEL1=0X00080000;
while(1)
{
/* The Datas has to be passed or moved on to the VALUE bits i.e 15 - 6 and the result will be
(VALUE/(1024*Vref)) */
DACR = (1023 << 6) |
DAC_BIAS;
delay(100000);
delay(100000);
delay(100000);
delay(100000);

/* The Datas has to be passed or moved on to the VALUE bits i.e 15 - 6 and the result will
be
(VALUE/(1024*Vref))
*/

DACR = (0 << 6) | DAC_BIAS;


dela y(100000);
dela y(100000);
dela y(100000);
delay(100000);
}
}
Procedure to View the Result: DAC

1. Compile, Debug & Simulate the above code in IAR.


2. Connect the RS232 cable/USB cable provided to the PC/Laptop and the VSK-
2148 Board, and Power on the Board.
3. For seeing the output in real-time, select the PROG mode, reset the board and
download the code on to the board using Flash Magic through UART0/USB.
4. Now change the Mode-Selection-Switch to EXEC position and reset the
board. Connect the +ve terminal of the CRO probe to A out and _ve terminal
to AGND pins on the board to see the variation in the pulse.

RESULT:
EX. NO:

DATE:

INTERFACING REAL TIME CLOCK AND SERIAL PORT

AIM :

To develop a C-Language program for reading the RTC, convert into decimal and to
display it.

APPARATUS & SOFTWARE REQUIRED :

1. LPC2148 syllabus board.


2. IAR IDE software.
3. Flash Magic.
PROGRAM
/* - - - - - Header Files - - - - - */
#include<nxp/iolpc2148.h>
#include<stdio.h>
#include<string.h>
#include "uart.h"
/* - - - - - Real Time Clock Initialization - - - - - */
void RTC_Init()
{
ILR = 3; /* Disable 32'768 interrupt */
CCR = 0x11; /* Clock enable + 32'767Hz quartz enable; starts the RTC */
CIIR = 0x01; /* Interupt every second */
PREINT = 0x0000016D; /* the integer portion of the prescale value */
PREFRAC = 0x00001B00; /* fractional portion of the prescale value */
YEAR = 2015; /* Year */
MONTH = 05; /* Month */
DOM = 09; /* Day of month loads the date as 09.05.2015 */
DOY = 129; /* Day of year */
DOW = 04; /* Day of week */
HOUR = 10; /* Hours */
MIN = 21; /* Minutes loads the time as 10:21:00 */
SEC = 00; /* Seconds */

}
/* Hint: ARM processor crystal freq. = 12 MHz = 12,000,000 Hz
RTC crystal freq. = 32.768 KHz = 32,768 Hz
Calculate,
PREINT = (12,000,000 / 32,768)-1 = 365 in Decimal = 0x16D in Hex.
PREFRAC = 12,000,000 - (365+1)*32,768 = 6912 in Decimal = 0x1B00 in Hex.
And, for
CIIR = Counter Increment Interrupt Register,
CCR = Clock Control Register
ILR = Interrupt Location Register
Refer, "Volume 1: LPC214x User Manual" PDF Document */

/* - - - - - Start the Clock - - - - - */


void RTCStart( void )
{
CCR |= 0x01; /* CTC Reset */
ILR = 0x01; /* Interrupt location Register */
}
/* - - - - - Read Clock - - - - - */
void Read_rtc( void )
{
printf("TIME--->%d:%d:%d\t",HOUR,MIN,SEC);
printf("DATE--->%d:%d:%d\n",DOM,MONTH,YEAR);
}
/* - - - - - main function starts - - - - - */
void main()
{
baudrate_settings(); /* call function baudrate_settings */
RTC_Init(); /* call function RTC_Init */
RTCStart(); /* call function RTCStart */
while(1)
{
Read_rtc(); /* call function Read_rtc */
}
}

Procedure to View the Result:

1. Compile, Debug & Simulate the above code in IAR.


2.Connect the RS232 cable / USB cable provided to the PC / Laptop and the VSK
- 2148 Board, and Power on the Board.
3. For seeing the output in real-time, select the PROG mode, reset the board
and download the code in the board using Flash Magic through UART0.
4.Now change the Mode-Selection-Switch to EXEC position and reset the board.
5.Open Win X- Talk, Select COM port and Baud rate as 9600
6. Now observe the output data in the PC, it should displa y the digital clock
running with Hr., Min., & Sec. Digits following format: “HH:MM:SS “. along with
Day as “DD:MM:YYYY”
7. Digital Clock will start running from 10:21:00 as programmed by default, you
can modify the code and you can load your desired timing also.
Apart from timing it can be programmed to display AM-PM (12Hr mode) also.

RESULT:
EX. NO:
DATE:
INTERFACING KEYBOARD AND LCD

AIM:

To develop a C-Language program for displaying the Key pressed in the Keypad in the
LCD module. The display should come in the desired line and column.

APPARATUS & SOFTWARE REQUIRED :

1. LPC2148 syllabus board.


2. IAR IDE software.
3. Flash Magic.

THEORY :
PROGRAM
/* Keypad Interface
// K1 TO K8 : P0.16 TO P0.23
// Key Value is displayed on UART0
// SCAN LINES : P0.20 TO P0.23 (OUTPUT)
// READ LINES : PO.16 TO P0.19 (INPUT) */
/* - - - - - Header Files - - - - - */
#include<nxp/iolpc2148.h>
#include<stdio.h>
# include "lcd.h"
#include "ke y.h"
/* - - - - - main function starts here - - - - - */
void main()
{
PINSEL2 = 0x00000000; /* P0.16 TO P0.23 Configured as GPIO. */
IO0DIR = 0X00F00F05; /* P0.20 TO P0.23 (O/P), P0.16 TO P0.19(I/P) */
IO1DIR=0x00FF0000; /* LCD data pins as output */
comm(command); /* function to call LCD co mmands */
data1("Press any Key"); /* call the function to display the data in LCD */
while(1)
{
scomm(0xC0); /* function to write single datas in LCD location C0 */
key(); /* call the keypad function*/
}
}

Procedure to see OUTPUT:


• Compile, Debug & Simulate the above code in IAR.
• Connect the RS232 cable / USB cable provided to the PC / Laptop and the VSK -
2148 Boards, and Power on the Board.
• For seeing the output in real-time, select the PROG mode, reset the board
and download the code in VSK-2148 board using Flash Magic through
UART0.
• Now change the Mode-Selection-Switch to EXEC position and reset the board.
• Now observe the LCD output, it should display the Alphabets & Numbers.
• 1st line (upper line) should display the Alphabets Press any Ke y and the 2nd line
(lower line) should display the corresponding data as the Key is Pressed
• You can change Address for upper line from 0x80 to 0x8F and for lower line
from 0xC0 to 0xCF

RESULT :
EX.NO:

DATE:
FLASHING OF LED
AIM :

To develop a ‘C’ program to make the LED blink (including delay routine).
Upon change in the delay program the speed should vary.

APPARATUS & SOFTWARE REQUIRED :

1. LPC2148 syllabus board.


2. IAR IDE software.
3. Flash Magic.

THEORY:
PROGRAM :
#include <includes.h>
#include <intrinsics.h>
#include<stdio.h>
main( )
{
PINSEL1=0X00000001;
IO1DIR=0XFF000000;
while(1)
{
IO1SET=0XFF000000;
delay( );
IO1CLR=0XFF000000;
delay( );
}
}
void delay( )
{
for(i=0;i<=0x00ff;i++)
for(j=0;j<=0x0ff;j++);
}

Procedure to view the result:


• Compile, Debug & Simulate the above code in IAR.
• For seeing the output in real-time, select the PROG mode, reset the board and
download the code in board using Flash Magic through UART0.
• Now change the Mode-Selection-Switch to EXEC position and reset the board.
• Run/Execute the program on the VSK – 2148 board and observe the LED blink
duration (on/off).

RESULT:
Garbage Segregator and Bin Level Indicator

IDEA:

With progress in human technolo gy we have seen a substantial progress in the amount of waste
generated. Rec ycling is the only way to manage this huge amount of waste. But recycling requires
garb age to be segregated. Without segregation garbage cannot be recycled because different type
of garbage requires different recycling processes.

Also It is important to educate users and instruct them every time they come near the dustbin
about instructions about throwing the trash. For this purpose we design a garbage disposal s ystem
that uses multiple dustbins with a voice based system that speaks to the user each time he she
stands before the dustbin.

The system makes use o f a camera to detect presence if any person in front of the dustbin. If a
person is detected, the s ystem issues voice instructions to the user about throwing right garbage in
the right bin. In case the dustbin is full it instructs the user to find another dustbin to throw
garbage in.

To develop this s ystem we make use of a raspberry Pi controller. The controller is interfaced with
a camera and a voice speaker for detection and communication. The controller gets dustbin level
input using ultrasonic level sensors each having LED indicators interfaced to it. The level sensors
are used to constantly feed the raspberry pi with bin levels.

The raspberry pi is also interfaced with a Wifi module to transmit the level data over the internet.
The Level sensor panels are made to be easily mounted over any dustbin. This allows the system
to be easily screwed over any dustbin for instant installation.

The data is transmitted over IO T to IOT gecko platform which displa ys the bin level data over
internet. This indication can be used to alert the authorities that the garbage bins need to be
emptied. Thus the system automates garbage segregation and level monitoring to help counter the
garbage crisis using IOT.

Note: The Dustbins are not included in this kit. The sensors can be mounted over any op en
dustbins.

Components

Raspberry P i

Wifi Module
Ultrasonic Level Sensors

LED Indicators

Camera

Speaker

Wiring

Supporting Frame

Buttons & Switches

Screws & Bolts

Resistors

Capacitors

Diodes

IC‟s

Transistors

Connectors

PCB
Colour based Product Sorting

IDEA:

Color Based Object Sorting has a wide usage in fruit sorting as well as cand y sorting industries.
This system puts forward a mechanism to detect color and sort items through ima ge processing.
Once identified a mechanism is used to sort the candies into particular bins baskets. We here
demonstrate this mechanism using a camera with electronic circuitry along with sorting
mechanism using 3 bins. The system uses raspberry pi connected to a controller circuit to achieve
this task. The controller circuit consists of a camera attached to it that detects color of a sma ll
object in front of it. A motor is used to feed an object to the camera chamber. As soon is the color
is detected a signal is sent to the sorter mechanism which uses a motor to position the sorting tube
towards respective sectio n. A feeder is then used to push the object towards the tubs so that it gets
sorted and next object is pulled in b y the feeder. The action details are sent to the IOT server
using iotgecko platform to keep track of the number of objects sorted in each section. Thus, we
achieve a completely automated IOT based sorting system.

Hardware Specifications

Raspberry Pi 3

Camera Servo

Motor LCD

Display

Resistors

Capacitors

Transistors

Cables and Connectors

Diodes

PCB and Breadboards

LED

Transformer/Adapter

Push Buttons

Switch
IC

IC Sockets

Connector Shaft

Bed Frame

Tubes

Screws & Joints

Supporting Frame

Software Specifications

Programming Language:

Python

IOTGecko

BLOCK DIAGRAM:

87
Image Processing based Fire Detection

IDEA:

The main advantage o f Image Processing Based F ire Detection S ystem is the early
warning benefit. This system can be installed just about anywhere in a commercial
building, malls and at many more public places for fire d etection. This system uses camera
for detecting fires. So we do not need any other sensors to detect fire. S ystem processes
the camera input and then processor processes it to detect fires. The heat signatures and
fire illumination patterns are detected in images to determine if it is a fire and take action
accordingly. On detecting fire system goes into emergency mode and sounds an alarm.
Also displays the status on the LCD display informing about the system.

Hardware Specifications

Raspberry Pi 3

Camera

Buzzer

LCD Display

Resistors

Capacitors

Transistors

Cables and Connectors

Diodes

PCB and Breadboards

LED

Transformer/Adapter

Push Buttons

Switch

IC

IC Sockets
Software Specifications

Linux

Programming Language: Python

BLOCK DIAGRAM:
Vehicle Numbe r Plate Detection

IDEA:
SMART LOCKSYSTEM

IDEA:

From connected cars to connected wearables to home security, the Internet of Things is rapidly marking its presenc e in
every field. Now we have IoT enabled home automation and security devices that can be controlled from anywhere
in the world using the Internet of Things. There are many kinds of Wi-Fi door lock available in the market which makes
your home more secure and saves time in f inding the keys. Here we are also building a s imilar Wi-Fi door lock which
can be controlled from the Smartphone

So in this project, we are going to make an IOT based Door Lock System using NodeMCU, Solenoid Lock,
and Adafruit IO . Here NodeMCU will act as the main controller and connect the user to the door lock system
using the Internet. This allows the user to lock/unlock his Home‟s door lock by us ing a smartphone from anywhere
in the world.

Components Required

NodeMCU ESP8266

Solenoid Lock

Rela y Module

Buzzer
Reference: https://www.researchgate.net/publication/367087623_Smart_Door_Locking_System_Using_IoT

You might also like