ESD Lab Manual

You might also like

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

VIDYA JYOTHI INSTITUTE OF TECHNOLOGY

DEPARTMENT OF ELECTRONICS AND COMMUNICATION


ENGINEERING

EMBEDDED AND VLSI LABORATORY


[For students admitted in the Academic Year: 2018 onwards]

Regulations : R 2018 / R2020

Class : III Year II Semester (ECE)

Prepared by
Mrs.A. Supraja
Assistant Professor

JUNE 2018
EMBEDDED LAB MANUAL R18 & R20

Vision
The Electronics & Communication Engineering department intends to be a leader in
creating the high quality engineers in the field of electronics and associated
technologies to cater to national and global technological needs promoting the human
prosperity and wellbeing.

Mission
 Providing an infrastructural and conducive environment to the students, faculty and
researchers for attaining domain knowledge and expertise in electronics &
communication engineering.
 Enable the students to develop into outstanding professionals with high ethical standards
capable of creating, developing and managing global engineering enterprises.
 Inculcate the spirit of lifelong learning by interacting with outside world and strengthen
professional, communication skills.

Quality Policy
Our policy is to nurture and build diligent and dedicated community of engineers
providing a professional and unprejudiced environment, thus justifying the purpose of
teaching and satisfying the stake holders.

A team of well qualified and experienced professionals ensure quality education with
its practical application in all areas of the Institute.

Philosophy
The essence of learning lies in pursuing the truth that liberates one from the darkness
of ignorance and Institute of Vidya Jyothi Institute of Technology firmly believes that
education is for liberation. Contained therein is the notion that engineering education
includes all fields of science that plays a pivotal role in the development of world-
wide community contributing to the progress of civilization. This institute, adhering to
the above understanding, is committed to the development of science and technology
in congruence with the natural environs. It lays great emphasis on intensive research
and education that blends professional skills and high moral standards with a sense of
individuality and humanity. We thus promote ties with local communities and
encourage transnational interactions in order to be socially accountable. This
accelerates the process of transfiguring the students into complete human beings
making the learning process relevant to life, instilling in them a sense of courtesy and
responsibility.

2 VIDYA JYOTHI INSTITUTE OF TECHNOLOGY, AZIZ NAGAR, HYDERABAD-75


EMBEDDED LAB MANUAL R18 & R20
Program Outcomes
PO1 Engineering knowledge: An ability to apply knowledge of basic sciences,
mathematical skills, engineering and technology to solve complex
electronics and communication engineering problems (Fundamental
Engineering Analysis Skills).
PO2 Problem analysis: An ability to identify, formulate and analyze
engineering problems using knowledge of Basic Mathematics and
Engineering Sciences. (Engineering Problem Solving Skills).
PO3 Design/development of solutions: An ability to provide solution and to
design Electronics and CommunicationSystems as per social needs
(Social Awareness)
PO4 Conduct investigations of complex problems: An ability to investigate the
problems in Electronics and Communication field and develop suitable
solutions (Creative Skills).
PO5 Modern tool usage An ability to use latest hardware and software tools to
solve complex engineering problems (Software and Hardware Interface).
PO6 The engineer and society: An ability to apply knowledge of contemporary
issues like health, Safety and legal which influences engineering design
(Social Awareness).
PO7 Environment and sustainability An ability to have awareness on society
and environment for sustainable solutions to Electronics & Communication
Engineering problems (Social awareness).
PO8 Ethics: An ability to demonstrate understanding of professional and ethical resp
PO9 Individual and team work: An ability to work efficiently as an
individual and in multidisciplinary teams (Team Work).
PO10 Communication: An ability to communicate effectively and efficiently both
in verbal and written form (Communication Skills).
PO11 Project management and finance: An ability to develop confidence to
pursue higher education and for life-long learning (Continuing education
awareness).
PO12 Life-long learning: An ability to design, implement and manage the
electronic projects for real world applications with optimum financial
resources (Practical engineering analysis skills).
Program Specific
Outcomes
PSO1 Professional Skills: An ability to understand the basic concepts in
Electronics & Communication Engineering and to apply them to various
areas, like Electronics, Communications, Signal processing, VLSI,
embedded systems etc., in the design and implementation of complex
systems.
PSO2 Problem-solving skills: An ability to solve complex Electronics and
communication Engineering problems, using latest hardware and software
tools, along with analytical skills to arrive cost effective and appropriate
solutions.

3 VIDYA JYOTHI INSTITUTE OF TECHNOLOGY, AZIZ NAGAR, HYDERABAD-75


EMBEDDED LAB MANUAL R18 & R20
EMBEDDED & VLSI LABORATORY
IV B.Tech I Semester
L T P C
0 0 2 1
COURSE OUTCOMES:
At the end of the course the student should be able to

1. Code the ARM cortex M0+ processor instruction set.


2. Articulate the concept of interfacing I/O devices with FRDM kit.
3. Synthesize a Verilog code for digital circuits
4. Devise the digital circuit in CPLD/FPGA
5. Formulate a system design using Embedded and VLSI technologies

Perform any 10 Experiments from each lab:


Embedded System Design Lab:
1. Blinking of LED : Hello World
2. Breath out 2 LEDs
3. Color Circle
4. ADC Potentiometer
5. Analog serial plotter
6. Interface to Accelerometer sensor using FRDM kit
7. Serial port communication using FRDM kit
8. Interface to touch sensor using FRDM kit
9. Radio frequency transmission operation using FRDM kit
10. LED intensity control using touch sensor using FRDM kit
11. Interface and plot LDR using FRDM kit
12. Interface and plot temperature sensor using FRDM kit
VLSI lab:
1. Verification of Logic Gates
2. Verification of Demorgon’s Law
3. Design of 8 to 1 multiplexer
4. Design of 1 to 8 Demultiplexer
5. Design of 2 to 4 Encoder
6. Design of 4-bit comparator
7. Design of 4 bit binary to gray converter
8. Design of full adder using 3 modeling styles
9. Design of flip flops SR, D, JK, and T
10. Design Ripple Counter
11. Design Modulo Counter
12. Design Shift Register
13. Design Inverter using PMOS / NMOS
14. Design of full adder using decoder and multiplexer
15. Design System using finite state Machine

4 VIDYA JYOTHI INSTITUTE OF TECHNOLOGY, AZIZ NAGAR, HYDERABAD-75


EMBEDDED LAB MANUAL R18 & R20

LIST OF EXPERIMENTS WITH PROGRAM OUTCOMES


& PROGRAM SPECIFIC OUTCOMES
Program
Program
S.No. Experiment Specific
Outcomes
Outcomes
Attained
Attained
1. Blinking of LED : Hello World PO2, PO9, PO10 PSO1
2. Breath out 2 LEDs PO2, PO3, PO9 PSO1,PSO2
3. Color Circle PO2, PO3, PO9 PSO1,PSO2
4. ADC Potentiometer PO2, PO9, PO10 PSO1

5. Analog serial plotter PO2, PO9, PO10 PSO1


6. Interface to Accelerometer sensor using FRDM PO2, PO3, PO9 PSO1,PSO2
kit
7. Serial port communication using FRDM kit PO2, PO9, PO10 PSO1
8. Interface to touch sensor using FRDM kit PO2, PO9, PO10 PSO1,PSO2
9. LED intensity control using touch sensor using PO2, PO3, PO9 PSO1,PSO2
FRDM kit
10. Interface and plot LDR using FRDM kit PO2, PO9, PO10 PSO1
11. Interface and plot temperature sensor using PO2, PO9, PO10 PSO1
FRDM kit
12. Radio frequency transmission operation using PO2, PO3, PO9 PSO1,PSO2
FRDM kit

5 VIDYA JYOTHI INSTITUTE OF TECHNOLOGY, AZIZ NAGAR, HYDERABAD-75


EMBEDDED LAB MANUAL R18 & R20

6 VIDYA JYOTHI INSTITUTE OF TECHNOLOGY, AZIZ NAGAR, HYDERABAD-75


EMBEDDED LAB MANUAL R18 & R20

INSTRUCTIONS TO THE STUDENTS

1. Students are required to attend all labs.

2. Students should work individually in the hardware and software laboratories.

3. Students have to bring the lab manual cum observation book, record etc along
with them whenever they come for lab work.

4. Should take only the lab manual, calculator (if needed) and a pen or pencil to the
work area.

5. Should learn the prelab questions. Read through the lab experiment to familiarize
themselves with the components and assembly sequence.

6. Should utilize 3 hours’ time properly to perform the experiment and to record the
readings. Do the calculations, draw the graphs and take signature from the
instructor.

7. If the experiment is not completed in the stipulated time, the pending work has to
be carried out in the leisure hours or extended hours.

8. Should submit the completed record book according to the deadlines set up by the
instructor.

9. For practical subjects there shall be a continuous evaluation during the semester
for 25 seasonal marks and 50 end examination marks.

10. Out of 25 internal marks, 15 marks shall be awarded for day-to-day work and 10
marks to be awarded by conducting an internal laboratory test.

7 VIDYA JYOTHI INSTITUTE OF TECHNOLOGY, AZIZ NAGAR, HYDERABAD-75


EMBEDDED LAB MANUAL R18 & R20

Ex No 1: STUDY OF FRDM –KL25Z


DATE:

Aim: To Study the Internal Architecture of FRDM-KL25Z


Overview of the Controller:
The Freescale Freedom KL25Z hardware, FRDM-KL25Z, is a simple, yet sophisticated
design featuring a Kinetis L series microcontroller, the industry’s first microcontroller built
on the ARM® Cortex™-M0+ core. It features a KL25Z128VLK, a KL2 family device
boasting a max operating frequency of 48MHz, 128KB of flash, a full speed USB controller,
and loads of analog and digital peripherals. The FRDM-KL25Z is the first hardware platform
to feature the Free scale open standard embedded serial and debug adapter known as Open
SDA. This circuit offers several options for serial communications, flash programming and
run-control debugging.
Features of FRDM-KL25Z
The features of the FRDM-KL25Z include:
 MKL25Z128VLK4 in an 80 LQFP package
 Capacitive touch slider
 MMA8451Q accelerometer
 Tri-color (RGB) LED
 Flexible power supply options – USB, coin cell battery, external source
 Battery-ready, power-measurement access points
 Easy access to MCU I/O via Arduino ™ R3 compatible I/O connectors
 Programmable Open SDA debug interface with multiple applications available including:
- Mass storage device flash programming interface
- P&E Debug interface provides run-control debugging and compatibility with IDE
tools
- CMSIS-DAP interface: new ARM standard for embedded debug interface
- Data logging application

Figure 1 Call out of different component of FRDM-KL25Z

8 VIDYA JYOTHI INSTITUTE OF TECHNOLOGY, AZIZ NAGAR, HYDERABAD-75


EMBEDDED LAB MANUAL R18 & R20

Figure 2 Block Diagram of FRDM-KL25Z Microcontroller

SERIAL AND DEBUG ADAPTER (OPENSDA)


OpenSDA is an open-standard serial and debug adapter. It bridges serial and debug
communications between a USB host and an embedded target processor as shown in Figure
3. The hardware circuit is based on a Freescale Kinetis K20 family microcontroller (MCU)
with 128 KB of embedded flash and an integrated USB controller. OpenSDA features a mass
storage device (MSD) bootloader, which provides a quick and easy mechanism for loading
different OpenSDA Applications such as flash programmers, run-control debug interfaces,
serial-to-USB converters, and more

Figure 3 HIGH LEVEL SDA BLOCK DIAGRAM


OpenSDA is managed by a Kinetis K20 MCU built on the ARM® Cortex™-M4 core. The OpenSDA
circuit includes a status LED (D4) and a pushbutton (SW1). The pushbutton asserts the Reset signal to

9 VIDYA JYOTHI INSTITUTE OF TECHNOLOGY, AZIZ NAGAR, HYDERABAD-75


EMBEDDED LAB MANUAL R18 & R20
the KL25Z target MCU. It can also be used to place the OpenSDA circuit into Bootloader mode. SPI
and GPIO signals provide an interface to either the SWD debug port of the KL25Z.

KL25Z Microcontroller
The target microcontroller of the FRDM-KL25Z is the KL25Z128VLK4, a Kinetis L series
device in an 80 LQFP package. The KL25Z MCU features include:
 32-bit ARM Cortex-M0+ core
- up to 48 MHz operation
- Single-cycle fast I/O access port
 Memories
- 128 KB flash
- 16 KB SRAM
 System integration
- Power management and mode controllers
- Low-leakage wakeup unit
- Bit manipulation engine for read-modify-write peripheral operations
- Direct memory access (DMA) controller
- Computer operating properly (COP) Watchdog timer
 Clocks
- Clock generation module with FLL and PLL for system and CPU clock generation
- 4 MHz and 32 kHz internal reference clock
- System oscillator supporting external crystal or resonator
- Low-power 1kHz RC oscillator for RTC and COP watchdog
 Analog peripherals
- 16-bit SAR ADC w/ DMA support
- 12-bit DAC w/ DMA support
- High speed comparator
 Communication peripherals
- Two 8-bit Serial Peripheral Interfaces (SPI)
- USB dual-role controller with built-in FS/LS transceiver
- USB voltage regulator
- Two I2 C modules
- One low-power UART and two standard UART modules
 Timers
- One 6-channel Timer/PWM module
- Two 2-channel Timer/PWM modules
- 2-channel Periodic Interrupt Timer (PIT)
- Real time clock (RTC)
- Low-power Timer (LPT)
- System tick timer
 Human-Machine Interfaces (HMI)
- General purpose input/output controller
- Capacitive touch sense input interface hardware module
 Clock Source
The Kinetis KL2 microcontrollers feature an on-chip oscillator compatible with three ranges
of input crystal or resonator frequencies: 32-40 kHz (low freq. mode), 3-8 MHz (high freq.
mode, low range) and 8-32 MHz (high freq. mode, high range). The KL25Z128 on the
FRDM-KL25Z is clocked from an 8 MHz crystal.

10 VIDYA JYOTHI INSTITUTE OF TECHNOLOGY, AZIZ NAGAR, HYDERABAD-75


EMBEDDED LAB MANUAL R18 & R20
 USB Interface
The Kinetis KL2 microcontrollers feature a dual-role USB controller with on-chip full-speed
and low speed transceivers. The USB interface on the FRDM-KL25Z is configured as a full-
speed USB device. J5 is the USB connector for this interface.
 Serial Port
The primary serial port interface signals are PTA1 and PTA2. These signals are connected to
both the OpenSDA and to the J1 I/O connector.
 Reset
The PTA20/RESET signal on the KL25Z128 is connected externally to a pushbutton, SW1,
and also to the OpenSDA circuit. The reset button can be used to force an external reset event
in the target MCU. The reset button can also be used to force the OpenSDA circuit into
bootloader mode.

Figure 4 KL25Z and Arduino Compatible signals


 Debug
The sole debug interface on all Kinetis L Series devices is a Serial Wire Debug (SWD) port.
The primary controller of this interface on the FRDM-KL25Z is the onboard OpenSDA
circuit. However, an unpopulated 10-pin (0.05”) Cortex Debug connector, J6, provides access
to the SWD signals. The Samtec FTSH-105-02-F-D or compatible connectors can be added
to the J6 through-hole debug connector to allow for an external debug cable to be connected.
 Capacitive Touch Slider

11 VIDYA JYOTHI INSTITUTE OF TECHNOLOGY, AZIZ NAGAR, HYDERABAD-75


EMBEDDED LAB MANUAL R18 & R20
Two Touch Sense Input (TSI) signals, TSI0_CH9 and TSI0_CH10, are connected to
capacitive electrodes configured as a touch slider. Freescale’s Touch Sense Software (TSS)
provides a software library for implementing the capacitive touch slider.
 3-axis Accelerometer
A Freescale MMA8451Q low-power, three-axis accelerometer is interfaced through an I2 C
bus and two GPIO signals. I2C address is 0x1D (SA0 pulled high).
 RGB LED
Three PWM-capable signals are connected to a red, green, blue LED, D3.

 Input/Output Connectors
The KL25Z128VLK4 microcontroller is packaged in an 80-pin LQFP. Some pins are utilized
in on-board circuitry, but many are directly connected to one of four I/O headers. The pins on
the KL25Z microcontroller are named for their general purpose input/output port pin
function. For example, the 1st pin on Port A is referred to as PTA1. The I/O connector pin
names are given the same name as the KL25Z pin connected to it, where applicable.

Figure 5 Pin Diagram of FRDM XL25Z

12 VIDYA JYOTHI INSTITUTE OF TECHNOLOGY, AZIZ NAGAR, HYDERABAD-75


EMBEDDED LAB MANUAL R18 & R20

Figure 5 Pin Diagram of peripherals in FRDM XL25Z


CONCLUSION:
The internal Architecture of the FRDM KL25Z is studied

13 VIDYA JYOTHI INSTITUTE OF TECHNOLOGY, AZIZ NAGAR, HYDERABAD-75


EMBEDDED LAB MANUAL R18 & R20

LIGHT EMMITING DIODE


A LED has Positive (Anode) and Negative (Cathode) ends. A New LED has its positive end
on the longer ends

DIODE CONFIGURATION

 COMMON ANODE CONFIGURATION requires a active low signal to make LED


glow
 COMMON CATHODE CONFIGURATION requires an active high signal to male
LED glow
SURFACE MOUNTED LED (SME)

14 VIDYA JYOTHI INSTITUTE OF TECHNOLOGY, AZIZ NAGAR, HYDERABAD-75


EMBEDDED LAB MANUAL R18 & R20

TRI COLOR LED

An RGB LED is actually three LEDs, red, green, and blue inside one package. LEDs need to
be turned on and off very fast for dimming (changing the voltage across it does not work like
it does in incandescent bulbs).The on and off times are so fast that human vision does not see
a flicker on the LED and only the average value is perceived. Three PWM output bits would
normally be used so that the brightness of each of the three LEDs can be controlled
independently. In the mbed APIs, three PWM Outs would be used to control the RGB LED.
A PWM value of 0.0 would be off and a 1.0 full on for each color LED. This allows a
program to vary both the color and brightness level of the LED. Typically an RGB LED has
four pins. One common pin and one for each of the three LEDs. In the LED seen below, the
common pin is the longest pin. If hardware PWM pins are not available, SoftPWM can
produce PWM signals on any pin by using software with timer interrupts.

15 VIDYA JYOTHI INSTITUTE OF TECHNOLOGY, AZIZ NAGAR, HYDERABAD-75


EMBEDDED LAB MANUAL R18 & R20

Ex No 2: BLINKING OF LIGHT EMITTING DIODE


DATE:

Aim: To write a Program in Embedded C++ to blink the led for specific time period
Apparatus used:
FRDM KL25Z with Samtec FFSD IDC cable,
Hardware Interfacing Diagram:

ALGORITHM:
Step 1: Initialize the LED1 as digital out pin
Step 2: When the FRDM Board is powered high the while loop is tru and program stats
executing
Step 3: Make LED1 as high and call for a delay for 1 second
Step 4: Make LED2 as low and call for a delay for 1 second
Step 5: Make the program as infinite loop so that the LED blnks

16 VIDYA JYOTHI INSTITUTE OF TECHNOLOGY, AZIZ NAGAR, HYDERABAD-75


EMBEDDED LAB MANUAL R18 & R20

PROGRAM
#include "mbed.h"
DigitalOut myled(LED1);
int main() {
while(1) {
myled = 1;
wait(1);
myled = 0;
wait(1);
}
}

CONCLUSION:
Thus a Embedded C++ program to blink an LED for a stipulated time was written and got
verified.

17 VIDYA JYOTHI INSTITUTE OF TECHNOLOGY, AZIZ NAGAR, HYDERABAD-75


EMBEDDED LAB MANUAL R18 & R20

Ex No 3: BREATH OUT OF LED


DATE:

Aim: To increase and decrease the brightness of the LED alternatively


Apparatus used:
FRDM KL25Z with Samtec FFSD IDC cable,
Hardware Interfacing Diagram:

Program:
#include "mbed.h"
PwmOut led(LED1);
int main() {
while(1) {
for(float p = 0.0; p < 1.0; p += 0.1) {
led = p;
wait(0.2); }
for(float p = 1.0; p > 0.0 ; p -= 0.1) {
led = p;
wait(0.2); } } }
Note: Change the Led pin for different colour led to control its brightness
Conclusion: Thus the brightness of the LED was increased and decreased alternatively.

18 VIDYA JYOTHI INSTITUTE OF TECHNOLOGY, AZIZ NAGAR, HYDERABAD-75


EMBEDDED LAB MANUAL R18 & R20

Ex No 4: COLOR CIRCLE (PATTERN OF GLOWING LED)


DATE:

Aim: To drive different colours from a Tricolor LED using a different combination infinitely
Apparatus used:
FRDM KL25Z with Samtec FFSD IDC cable,
Hardware Interfacing Diagram:

COLOR TABLE:
LED1(Red) LED2 (Green) LED3 (Blue) Color obtained
0 0 0
0 0 1
0 1 0
0 1 1
1 0 0
1 0 1
1 1 0
1 1 1

19 VIDYA JYOTHI INSTITUTE OF TECHNOLOGY, AZIZ NAGAR, HYDERABAD-75


EMBEDDED LAB MANUAL R18 & R20
PROGRAM:
#include "mbed.h"

DigitalOut rled(LED1);
DigitalOut gled(LED2);
DigitalOut bled(LED3);
int main() {
while(1) {
rled = 0;
gled = 0;
bled = 0;
wait(1);
rled = 0;
gled = 0;
bled = 1;
wait(1);
rled = 0;
gled = 1;
bled = 0;
wait(1);
rled = 0;
gled = 1;
bled = 1;
wait(1);
rled = 1;
gled = 0;
bled = 0;
wait(1);
rled = 1;
gled = 0;
bled = 1;
wait(1);
rled = 1;
gled = 1;
bled = 0;
wait(1);
rled = 1;
gled = 1;
bled = 1;
wait(1);
}
}

Conclusion: A Pattern of LED glowing was demonstrated and got verified.

20 VIDYA JYOTHI INSTITUTE OF TECHNOLOGY, AZIZ NAGAR, HYDERABAD-75


EMBEDDED LAB MANUAL R18 & R20
POTENTIOMETER:
Potentiometers are informally referred to as pots. The most common type of pots are three-
terminal resistors with an electrical contact that either slides or rotates along a resistor (or in
some cases between different resistors) in a voltage divider circuit to provide variable
resistance (and variable voltage output).

These simple pots include three leads - the outer two should be connected to 3.3v and gnd
(the Vout and Gnd pins on the mBed) and the inner lead should be connected to an analog
input.
LIGHT DEPENDENT RESISTOR:
Many embedded devices need to detect light levels. A low-cost photocell can be used to
determine different lighting levels in a room. The resistance of this type of a photocell (also
known as a photoresistor or light dependent resistor (LDR) ) varies with the light level on top
of the sensor. Photocells are more sensitive to red and green light levels and not very
sensitive at all to blue. A common application would be to dim an LED automatically in a
dark room and brighten it when it is in full daylight so that it is visible, or perhaps just turn on
the light when it is dark. The resistance response can vary quite a bit from photocell to
photocell (perhaps as much as 50%), so extremely accurate light level measurements are not
possible without individual calibration for each photocell.

21 VIDYA JYOTHI INSTITUTE OF TECHNOLOGY, AZIZ NAGAR, HYDERABAD-75


EMBEDDED LAB MANUAL R18 & R20

WIRING
The easiest way to hookup this device is to use a voltage divider circuit connected to an analog input
pin. The resistance of the device changes based on the lighting level (light levels are measured in lux).
This low cost device can measure approximate lighting levels and that is all that is needed in many
applications.

The typical way to interface this device is to hook it up to the 3.3 supply and use a 10K
pulldown resistor to build a voltage divider circuit as seen in the schematic above. An A/D is

22 VIDYA JYOTHI INSTITUTE OF TECHNOLOGY, AZIZ NAGAR, HYDERABAD-75


EMBEDDED LAB MANUAL R18 & R20
then used to read the analog voltage value into the microprocessor. The resistance values and
voltages shown in the table below are for the photocell from Adafruit. The photocell from
Sparkfun is very similar, but the datasheet lists a maximum dark value of 1MΩ. Note that the
analog voltage response is not linear (closer to a logarithmic response), but it is
monotonically increasing. To expand the high light-level readings or for a different photocell,
the pull down resistor value may need to change a bit to get the maximum analog voltage
swing. A rough rule of thumb for this is Rpd = (Rmin*Rmax)1/2, where Rmin and Rmax is the
region of interest to measure.

By checking the value of the analog voltage by using the AnalogIn API on mbed, the light
condition can be detected. Recall that the mbed AnalogIn API scales the voltage from 0.0 to
1.0 with 1.0 being an external analog input voltage of 3.3V.
TEMPERATURE SENSOR (LM35)
The LM35 series are precision integrated-circuit temperature devices with an output voltage
linearly proportional to the Centigrade temperature. The LM35 device has an advantage over
linear temperature sensors calibrated in Kelvin, as the user is not required to subtract a large
constant voltage from the output to obtain convenient Centigrade scaling.

23 VIDYA JYOTHI INSTITUTE OF TECHNOLOGY, AZIZ NAGAR, HYDERABAD-75


EMBEDDED LAB MANUAL R18 & R20
ANALOG TO DIGITAL CONVERSION:
ANALOG IN:

Use the AnalogIn API to read an external voltage applied to an analog input
pin. AnalogIn() reads the voltage as a fraction of the system voltage. The value is a floating
point from 0.0(VSS) to 1.0(VCC). For example, if you have a 3.3V system and the applied
voltage is 1.65V, then AnalogIn() reads 0.5as the value.

One of the most common types of analog to digital converters used in microcontrollers today
is called the successive-approximation ADC. Successive-approximation is a popular choice
in modern microcontrollers because of the fact that it is accurate and low-power and takes up
a small amount of space inside of the microcontroller.

The resolution for an ADC is the smallest distinguishable change in analog input that causes
the digital output to change. For example, a 12-bit ADC in a 3.3V system has 4,096
distinguishable outputs. Therefore, the resolution of a 12-bit ADC is 3.3/4096 = 0.81mV. In
an Mbed Enabled system where the digital result from the analog input is in the range of 0.0
to 1.0, a change of 0.81mV in the analog input results in a change in the digital output of
1.0/4096 = 0.00024.

ANALOG OUT:

Use the AnalogOut interface to set the output voltage of an analog output pin specified as a
percentage or as an unsigned short. Mbed OS provides separate APIs to use percentage or
range. Mbed OS supports a maximum resolution VCC/65,536 V, though the actual resolution
depends on the hardware.
SERIAL COMMUNICATION:

The Serial interface provides UART functionality. The serial link has two uni-direction
channels, one for sending and one for receiving. The link is asynchronous, and so both ends
of the serial link must be configured to use the same settings. One of the serial connections
uses the Arm Mbed USB port, allowing you to easily communicate with your host PC.

Serial (PinName tx, PinName rx, int baud)

VIRTUAL SERIAL PORT (TERA TERM):

Tera Term is a free terminal emulator for Windows. It can be used to communicate with
target hardware using a serial port or a telnet connection. Tera Term (alternatively TeraTerm)
is an open-source, free, software implemented, terminal emulator (communications) program.
It emulates different types of computer terminals, from DEC VT100 to DEC VT382. It
supports telnet, SSH 1 & 2 and serial port connections. It also has a built-in macro scripting
language (supporting Oniguruma regular expressions) and a few other useful plugin

24 VIDYA JYOTHI INSTITUTE OF TECHNOLOGY, AZIZ NAGAR, HYDERABAD-75


EMBEDDED LAB MANUAL R18 & R20
Ex No 5: POTENTIOMETER (VARIABLE RESISTOR)
DATE:

Aim: To interface Potentiometer with FRDM XL-25Z and switch on al LED based on a cut
in voltage
Apparatus used:
FRDM KL25Z with Samtec FFSD IDC cable, Potentiometer , LED, IOT Shield
Interfacing diagram:

POTENTIOMETER
LED
+3.3v
A0
GND PTA12

Program:
#include "mbed.h"
AnalogIn pot(A0);
DigitalOut rled(PTA12);
int main()
{
float store = 0.0;
while(1)
{
store = 3.3*pot.read();
if(store > 1.65)
{
rled = 0;
}

else
{
rled = 1;
}
}
}

25 VIDYA JYOTHI INSTITUTE OF TECHNOLOGY, AZIZ NAGAR, HYDERABAD-75


EMBEDDED LAB MANUAL R18 & R20
OBSERVATION:
S.No Status of LED Measured Voltage using Is the threshold reached?
DMM

RESOLUTION CALCULATION:
For example, a 12-bit ADC in a 3.3V system has 4,096 distinguishable outputs. Therefore,
the resolution of a 12-bit ADC is 3.3/4096 = 0.81mV. In an Mbed Enabled system where the
digital result from the analog input is in the range of 0.0 to 1.0, a change of 0.81mV in the
analog input results in a change in the digital output of 1.0/4096 = 0.00024.

RESULT:
Hence the Analog value of a potentiometer was received and based on which a LED is
switched on/off is executed and got verified.

26 VIDYA JYOTHI INSTITUTE OF TECHNOLOGY, AZIZ NAGAR, HYDERABAD-75


EMBEDDED LAB MANUAL R18 & R20
CONFIGURING TERA TERM
Step 1: Download PEDrivers and install in your computer from http://www.pemicro.com
/opensda/

STEP 2: Go to my computer / This PC and right click to choose properties.

Step 3: Click device manager from left corner of the window

27 VIDYA JYOTHI INSTITUTE OF TECHNOLOGY, AZIZ NAGAR, HYDERABAD-75


EMBEDDED LAB MANUAL R18 & R20

Step 4: Under ports ( COM & LPT) option note down the com port number. If the driver is
not present then it means that there is a error or the driver is not installed. Kindly repeat step
1 to 4.

Step 5: Download Tera Term software from https://tera-term.en.softonic.com/download


Sign in with Facebook and download the software and install it.

28 VIDYA JYOTHI INSTITUTE OF TECHNOLOGY, AZIZ NAGAR, HYDERABAD-75


EMBEDDED LAB MANUAL R18 & R20

Step 6: Double click on the Tera term Software

Step 7:Double click on the Tera Term software to have the screen shot as below

29 VIDYA JYOTHI INSTITUTE OF TECHNOLOGY, AZIZ NAGAR, HYDERABAD-75


EMBEDDED LAB MANUAL R18 & R20
Step 8: Select the com port which was inferred in step 4 and give ok

Step 9: Select Setup and select Serial Port and set the baud rate as 9600

30 VIDYA JYOTHI INSTITUTE OF TECHNOLOGY, AZIZ NAGAR, HYDERABAD-75


EMBEDDED LAB MANUAL R18 & R20

Make sure the Com Port inferred in Step 4 and the port name here are same. Give ok
Step 10: Now Go to Set up in Tera Term and select Terminal option

Step 11: Select Terminal set up and select Local echo option

Step 12: Now download program onto FRDM and open Tera Term to find the output.

31 VIDYA JYOTHI INSTITUTE OF TECHNOLOGY, AZIZ NAGAR, HYDERABAD-75


EMBEDDED LAB MANUAL R18 & R20

Ex No 6: VARIABLE RESISTOR ACQUISITION USING VIRTUAL SERIAL PORT


DATE:

Aim: To interface Potentiometer, Light Dependent Resistor, Analog Temperature Sensor


with FRDM XL-25Z and display the results in Virtual serial port
Apparatus used:
FRDM KL25Z with Samtec FFSD IDC cable, Potentiometer , LED, IOT Shield
Interfacing diagram:

Potentiometer IOT SHIELD 3.3v


LDR
3.3 v
A0 A1
Gnd
Gnd
A2
Temperature Sensor 3.3v
GND

Program: FRDM
TERA TERM ON PC
#include "mbed.h"
AnalogIn pot(A0);
AnalogIn ldr(A1);
AnalogIn tmr(A2);
Serial pc(USBTX,USBRX);
int main()
{
float value,value1,value2;
int data,data1,data2;
while(1)
{
value = 3.3*pot.read();
value1 = 3.3*ldr.read();
value2 = 3.3*tmr.read();
data = 100*value;
data1 = 100*value1;
data2 = 100*value2;

//pc.printf("\r\nValue = %.2f \n\r",value);


pc.printf("$%d %d %d;",data,data1,data2);
wait(0.5);
}}

32 VIDYA JYOTHI INSTITUTE OF TECHNOLOGY, AZIZ NAGAR, HYDERABAD-75


EMBEDDED LAB MANUAL R18 & R20
OUTPUT:
Screen Shot

33 VIDYA JYOTHI INSTITUTE OF TECHNOLOGY, AZIZ NAGAR, HYDERABAD-75


EMBEDDED LAB MANUAL R18 & R20
INTERPRETATION OF OUTPUT
The frames of the virtual serial monitor start with special character $. The first value is the
Potentiometer value followed by LDR value and finally the temperature sensor value and
ends with a semicolon.

ANALOG TO DIGITAL CONVERSION CALCULATION:

Result:
Hence Potentiometer, Light Dependent Resistor, Analog Temperature Sensor is interfaced
with FRDM XL-25Z and displayed the results in Virtual serial port application called Tera
term

34 VIDYA JYOTHI INSTITUTE OF TECHNOLOGY, AZIZ NAGAR, HYDERABAD-75


EMBEDDED LAB MANUAL R18 & R20
TSI Module Based Touch Sensing Method:
Capacitive Sensor:

Capacitive sensors work by detecting the change of capacitance introduced by the finger
touching near the electrode. Such change is so small that detecting it unambiguously is
challenging, and has become the primary task for the application design. For the surface
capacitive sensor, the sensor IC measures the capacitance of a sensor port with respect to the
circuit ground. Two conductive plates are required, one connected to the sensor port and the
other one to the circuit ground to form a capacitive transducer. So the ground plane is not just
like a shield in the standard PCB layout design, but it is also an indispensable part of a two-
plate capacitor. Being the front end of the sensor, the electrode’s ability pick up the signal
from the finger has a direct and significant impact on the overall performance. In the classic
parallel plate capacitor, the electric field is so confined in between the plates that the
capacitance could hardly be influenced by the external object. This means that a touch
pad directly above the ground plane is a poor capacitive transducer. When the plates
are shifted apart from overlapping, more electric field will project into the air, and the
capacitance will be more sensitive to the finger’s influence.

35 VIDYA JYOTHI INSTITUTE OF TECHNOLOGY, AZIZ NAGAR, HYDERABAD-75


EMBEDDED LAB MANUAL R18 & R20

36 VIDYA JYOTHI INSTITUTE OF TECHNOLOGY, AZIZ NAGAR, HYDERABAD-75


EMBEDDED LAB MANUAL R18 & R20
GPIO Based Capacitive Touch Sensing Method
To measure the capacitance of an electrode, a Freescale MCU with GPIO and time
measurement capabilities is required

The electrode connected to the MCU acts like a capacitor, and the external pull-up resistor
limits the current to charge the electrode. According to the equation, if the pull-up resistor
remains the same, an increase in the capacitance will increase the circuit charging time. The
MCU measures the charging time and uses this value to determine if the electrode has been
touched or not. By default, the electrode is in output high state. When the measurement starts,
the MCU sets the electrode pin as output low to discharge the capacitor. Then, it sets the
electrode pin as high impedance state, making the capacitor start charging. This depends on
the selected measurement method. For the GPIO method, it is the input state of the GPIO pin.
As the capacitor charges, the MCU enables a counter and counts the time required to reach
the pin threshold value, which is 0.7 VDD. Detection of this state depends on the module
function of the selected measurement method. After the threshold is reached, the counter
stops, stores the value and discharges the electrode.As the electrode is touched, the finger
capacitance is added to the capacitance of the electrode. This increases the circuit
capacitance, which increases the charge time measured by the timer

37 VIDYA JYOTHI INSTITUTE OF TECHNOLOGY, AZIZ NAGAR, HYDERABAD-75


EMBEDDED LAB MANUAL R18 & R20

MMA8451Q 3 axis Accelerometer


The MMA8451Q is a smart, low-power, three-axis, capacitive, micro machined
accelerometer with 14 bits of resolution. This accelerometer is packed with embedded
functions with flexible user programmable options, configurable to two interrupt pins.
Embedded interrupt functions allow for overall power savings relieving the host processor
from continuously polling data. There is access to both low-pass filtered data as well as high-
pass filtered data, which minimizes the data analysis required for jolt detection and faster
transitions. The device can be configured to generate inertial wakeup interrupt signals from
any combination of the configurable embedded functions allowing the MMA8451Q to
monitor events and remain in a low-power mode during periods of inactivity. The
MMA8451Q is available in a 16-pin QFN, 3 mm x 3 mm x 1 mm package.

38 VIDYA JYOTHI INSTITUTE OF TECHNOLOGY, AZIZ NAGAR, HYDERABAD-75


EMBEDDED LAB MANUAL R18 & R20

A Freescale MMA8451Q low-power, three-axis accelerometer is interfaced through an I2C


bus and two GPIO signals as shown in Table 4 below. By default, the I2C address is 0x1D
(SA0 pulled high).

39 VIDYA JYOTHI INSTITUTE OF TECHNOLOGY, AZIZ NAGAR, HYDERABAD-75


EMBEDDED LAB MANUAL R18 & R20

Ex No 7: INTERFACING TOUCH SENSOR AND CONTROL TWO LED


DATE:

Aim: To interface Human Computer Interface (Touch Sensor) with FRDM and to vary the
colour intensity of 3 colour led.
Apparatus used:
FRDM KL25Z with Samtec FFSD IDC cable, 3 colour LED, Capacitive Sensor
Interfacing Diagram:

Note:
Import the following files from the mbed online compiler TSISensor.h compile the
program

Program:
#include "mbed.h"
#include "TSISensor.h"
TSISensor tsi; //The pins are left empty
DigitalOut rled(LED1);
DigitalOut gled(LED2);
Serial pc(USBTX,USBRX);
int main() {
float tsi_value;
rled = 1;
gled = 1;
while(1) {
tsi_value = tsi.readPercentage();//Store a value from 0.0 to 1.0
pc.printf("%.2f \n\r",tsi_value);
if(tsi_value > 0.0 && tsi_value <= 0.5)
{
rled = 0;
gled = 1;

40 VIDYA JYOTHI INSTITUTE OF TECHNOLOGY, AZIZ NAGAR, HYDERABAD-75


EMBEDDED LAB MANUAL R18 & R20
}
else if(tsi_value > 0.5)
{
gled = 0;
rled = 1;
}
else//ti switch off the led when not touching. This is mainly for switching off the led
{
gled = 1;
rled = 1;
}
}}

OUTPUT:

How to write a .h file


Step1: Define #ifndef and call a file named TSISENSOR_H. A Block of data is written
within it. The #ifndef directive is used to insert a block of code only once when called.
Step 2: Define a User defined data type (Class) called TSISensor as public
Step 3: Read Touch Sensor percentage value and distance using read Percentage function and
read distance function.
Step 4: Declare two functions slider read and slider calibration as private function.
Step 5: Step 2 to step 4 is written within #ifndef

How to write a supporting file for .h file

Result:
Hence capacitive sensor is interfaced with FRDM XL-25Z and Led of two different colours
was displayed based on the distance of slide.

41 VIDYA JYOTHI INSTITUTE OF TECHNOLOGY, AZIZ NAGAR, HYDERABAD-75


EMBEDDED LAB MANUAL R18 & R20

Ex No 8: INTERFACING 3 AXIS ACCELEROMETER WITH FRDM


DATE:
Aim: To interface a 3 axis Accelerometer with FRDM and to display the values of three axis
in virtual serial port.
Apparatus used:
FRDM KL25Z with Samtec FFSD IDC cable, Teraterm
Interfacing Diagram:

TERATERM

Program:

#include "mbed.h"
#include "MMA8451Q.h"
#define MMA8451Q_I2C_ADDRESS (0X1d<<1)
MMA8451Q acc(PTE25,PTE24,MMA8451Q_I2C_ADDRESS);
Serial pc(USBTX,USBRX);
int main() {
int16_t x,y,z;
signed int value1,value2,value3;
while(1) {
x = acc.getAccX() + 1;
y = acc.getAccY() + 1;
z = acc.getAccZ() + 1;
value1 = 100*x;
value2 = 100*y;
value3 = 100*z;
pc.printf("$%d %d %d;",value1,value2,value3);
wait(0.1);
}
}

42 VIDYA JYOTHI INSTITUTE OF TECHNOLOGY, AZIZ NAGAR, HYDERABAD-75


EMBEDDED LAB MANUAL R18 & R20
Additional Program:

#include "mbed.h"
#include "MMA8451Q.h"
#define MMA8451Q_I2C_ADDRESS (0X1d<<1)
MMA8451Q acc(PTE25,PTE24,MMA8451Q_I2C_ADDRESS);
Serial pc(USBTX,USBRX);
BusOut RGB(LED1,LED2,LED3);
int main() {
float y;
RGB = 0X07;
while(1) {
y = acc.getAccY();
if(y > -0.2 && y < 0.2) {
RGB = 0x05; //Green
pc.printf("You are on a flat surface\n\r");
}
else if(y > 0.2 && y < 0.8 || y < -0.2 && y > -0.8)
{ RGB = 0x03; //Blue
pc.printf("You are about to fall\n\r"); }
else if(y > 0.8 && y < 1 || y < -0.8 && y > -1)
{ RGB = 0x06; //Red
pc.printf("I am sure you are on ground\n\r"); }
wait(0.5)
}
}

Inferred output:

Result:
Hence an Embedded C++ program to interface 3 axis accelerometer with FRDM was
experimented and results were demonstrated.

43 VIDYA JYOTHI INSTITUTE OF TECHNOLOGY, AZIZ NAGAR, HYDERABAD-75


EMBEDDED LAB MANUAL R18 & R20

nRF24L01

The nRF24L01 is a single chip 2.4GHz transceiver with an embedded baseband protocol
engine (Enhanced ShockBurst™), designed for ultra low power wireless applications. The
nRF24L01 is designed for operation in the world wide ISM frequency band at 2.400 -
2.4835GHz. An MCU (microcontroller) and very few external passive components are
needed to design a radio system with the nRF24L01. The nRF24L01 is configured and
operated through a Serial Peripheral Interface (SPI.) Through this interface the register map is
available. The register map contains all configuration registers in the nRF24L01 and is
accessible in all operation modes of the chip. The embedded baseband protocol engine
(Enhanced ShockBurst™) is based on packet communication and supports various modes
from manual operation to advanced autonomous protocol operation. Internal FIFOs ensure a
smooth data flow between the radio front end and the system’s MCU. Enhanced
ShockBurst™ reduces system cost by handling all the high-speed link layer operations. The
radio front end uses GFSK modulation. It has user configurable parameters like frequency
channel, output power and air data rate. The air data rate supported by the nRF24L01 is
configurable to 2Mbps. The high air data rates combined with two power saving modes
makes the nRF24L01 very suitable for ultra low power designs. Internal voltage regulators
ensure a high Power Supply Rejection Ratio (PSRR) and a wide power supply range.

44 VIDYA JYOTHI INSTITUTE OF TECHNOLOGY, AZIZ NAGAR, HYDERABAD-75


EMBEDDED LAB MANUAL R18 & R20

RX mode

The RX mode is an active mode where the nRF24L01 radio is a receiver. To enter this mode,
the nRF24L01 must have the PWR_UP bit set high, PRIM_RX bit set high and the CE pin
set high. In this mode the receiver demodulates the signals from the RF channel, constantly
presenting the demodulated data to the baseband protocol engine. The baseband protocol
engine constantly searches for a valid packet. If a valid packet is found (by a matching
address and a valid CRC) the payload of the packet is presented in a vacant slot in the RX
FIFO. If the RX FIFO is full, the received packet is discarded. The nRF24L01 remains in RX
mode until the MCU configures it to standby-I mode or power down mode. If the automatic
protocol features (Enhanced ShockBurst™) in the baseband protocol engine are enabled, the
nRF24L01 can enter other modes in order to execute the protocol. In RX mode a carrier
detect signal is avaliable. The carrier detect is a signal that is set high when a RF signal is
detected inside the receiving frequency channel. The signal must be FSK modulated for a
secure detection. Other signals can also be detected. The Carrier Detect (CD) is set high when
an RF signal is detected in RX mode, otherwise CD is low. The internal CD signal is filtered
before presented to CD register. The RF signal must be present for at least 128µs before the
CD is set high.

TX mode

The TX mode is an active mode where the nRF24L01 transmits a packet. To enter this mode,
the nRF24L01 must have the PWR_UP bit set high, PRIM_RX bit set low, a payload in the
TX FIFO and, a high pulse on the CE for more than 10µs. The nRF24L01 stays in TX mode
until it finishes transmitting a current packet. If CE = 0 nRF24L01 returns to standby-I mode.
If CE = 1, the next action is determined by the status of the TX FIFO. If the TX FIFO is not
empty the nRF24L01 remains in TX mode, transmitting the next packet. If the TX FIFO is
empty the nRF24L01 goes into standby-II mode. The nRF24L01 transmitter PLL operates in
open loop when in TX mode. It is important to never keep the nRF24L01 in TX mode for

45 VIDYA JYOTHI INSTITUTE OF TECHNOLOGY, AZIZ NAGAR, HYDERABAD-75


EMBEDDED LAB MANUAL R18 & R20
more than 4ms at a time. If the auto retransmit is enabled, the nRF24L01 is never in TX mode
long enough to disobey this rule.

46 VIDYA JYOTHI INSTITUTE OF TECHNOLOGY, AZIZ NAGAR, HYDERABAD-75


EMBEDDED LAB MANUAL R18 & R20

Ex No 9: INTERFACING nRF24L01P WITH FRDM


DATE:

Aim: To interface nRF24L01p with FRDM to transmit and receive a set of characters at
2.4GHz

Apparatus Required
Computers- 2nos
FRDM - 2Nos
nRF24L01P – 2Nos
USB Cable - 2Nos

Interfacing Diagram:

47 VIDYA JYOTHI INSTITUTE OF TECHNOLOGY, AZIZ NAGAR, HYDERABAD-75


EMBEDDED LAB MANUAL R18 & R20
PROGRAM: (TRANSMITTER)

#include "mbed.h"
#include "nRF24L01P.h"

Serial pc(USBTX,USBRX);
nRF24L01P
my_nrf24l01p(PTD2,PTD3,PTD1,PTD0,PTD5,PTD4);//MOSI,MISO,SCK,CSN,CE,IRQ
DigitalOut rled(LED1);

int main()
{
char count[2];
char TxDataCnt;
char temp;
my_nrf24l01p.powerUp();
my_nrf24l01p.setRfFrequency(2400);//This is taken in MHz
//Display the default setup of the nRF24L10+ chip
pc.printf("nRF24L10+ Frequency : %d MHz \r \n",my_nrf24l01p.getRfFrequency());
pc.printf("nRF24L10+ Output Power : %d dBm \r
\n",my_nrf24l01p.getRfOutputPower());
pc.printf("nRF24L10+ Data Rate : %d kbps \r \n",my_nrf24l01p.getAirDataRate());
pc.printf("nRF24L10+ Tx Address : 0x%010llX\r\n", my_nrf24l01p.getTxAddress());
pc.printf("nRF24L10+ Rx Address : 0x%010llX\r\n", my_nrf24l01p.getRxAddress());

pc.printf("Simple Transmitter (0 - 9 Counter)");


TxDataCnt = 2;
my_nrf24l01p.setTransferSize(TxDataCnt);
my_nrf24l01p.enable();
count[0] = 0x01;
count[1] = 0x01;
while(1)
{
//Send the transmit buffer via the nRF24L01+
temp = my_nrf24l01p.write(NRF24L01P_PIPE_P0,count,TxDataCnt);//Returns the
number of bytes were sent.
pc.printf("Sending %d - %d %d \r \n",temp,count[0],count[1]);

//Togle LED1 (to help debug Host -> nRF24L01+ communication)


rled = !rled;

count[1]++;

wait(1);
}
}

48 VIDYA JYOTHI INSTITUTE OF TECHNOLOGY, AZIZ NAGAR, HYDERABAD-75


EMBEDDED LAB MANUAL R18 & R20

PROGRAM: (RECIEVER)

include "mbed.h"
#include "nRF24L01P.h"

Serial pc(USBTX,USBRX);
nRF24L01P
my_nrf24l01p(PTD2,PTD3,PTD1,PTD0,PTD5,PTD4);//MOSI,MISO,SCK,CSN,CE,IRQ
DigitalOut gled(LED2);
int main()
{
char count[2];
char RxDataCnt;
char temp;
my_nrf24l01p.powerUp();
my_nrf24l01p.setRfFrequency(2400);
//Display the default setup of the nRF24L10+ chip
pc.printf("nRF24L10+ Frequency : %d MHz \r \n",my_nrf24l01p.getRfFrequency());
pc.printf("nRF24L10+ Output Power : %d dBm \r
\n",my_nrf24l01p.getRfOutputPower());
pc.printf("nRF24L10+ Data Rate : %d kbps \r \n",my_nrf24l01p.getAirDataRate());
pc.printf("nRF24L10+ Tx Address : 0x%010llX\r\n", my_nrf24l01p.getTxAddress());
pc.printf("nRF24L10+ Rx Address : 0x%010llX\r\n", my_nrf24l01p.getRxAddress());
pc.printf("Simple 2 Byte Reciever\r\n");

RxDataCnt = 2;
my_nrf24l01p.setTransferSize(RxDataCnt);
my_nrf24l01p.setReceiveMode();
my_nrf24l01p.enable();

count[0] = 0x01;
count[1] = 0x01;

while(1)
{
//If we've recieved anything in the nRF24L01+
if(my_nrf24l01p.readable())
{
//Read data into the recieve buffer
temp = my_nrf24l01p.read(NRF24L01P_PIPE_P0,count,RxDataCnt);
pc.printf("cnt %d = %d %d \r \n",temp,count[0],count[1]);

//Togle LED2 (to help debug nRF24L01+ -> Host communication)


gled = !gled;
wait_ms(10);
}
}
}

49 VIDYA JYOTHI INSTITUTE OF TECHNOLOGY, AZIZ NAGAR, HYDERABAD-75


EMBEDDED LAB MANUAL R18 & R20
Use Device Drivers from the following Link
https://os.mbed.com/users/pabloamr/code/nRF24L01P/

Import and add the files to your project

Steps to Execute the Program:


Step1: Connections are made as per the Interfacing Diagram
Step2: Compile the transmitter program and dump inside FRDM (1) (Transmitter)
Step3: Press switch to invoke the nRF24L01. so that details about the transmitter is seen in
Serial terminal.
Step4: Compile the receiver program and dump inside FRDM (2) (Receiver)
Step5: Press switch to invoke the nRF24L01. so that details about the transmitter is seen in
Serial terminal.
Step 6: We can see the data transmitted is received in second computer

Infer the Result:

Result:
Hence wireless transmission is demonstrated using nRF2401LP and results were verified.

50 VIDYA JYOTHI INSTITUTE OF TECHNOLOGY, AZIZ NAGAR, HYDERABAD-75

You might also like