This document discusses various applications of embedded systems including temperature measurement using thermistors and linear temperature sensors like the LM35. It describes how to interface the LM35 temperature sensor with an 8-bit ADC0809 and microcontroller port for temperature readings. It also discusses controlling a stepper motor and interfacing it to port pins of a microcontroller. Finally, it explains interfacing a 2x16 LCD display and keyboard matrix to a microcontroller for input/output applications.
final Year Projects, Final Year Projects in Chennai, Software Projects, Embedded Projects, Microcontrollers Projects, DSP Projects, VLSI Projects, Matlab Projects, Java Projects, .NET Projects, IEEE Projects, IEEE 2009 Projects, IEEE 2009 Projects, Software, IEEE 2009 Projects, Embedded, Software IEEE 2009 Projects, Embedded IEEE 2009 Projects, Final Year Project Titles, Final Year Project Reports, Final Year Project Review, Robotics Projects, Mechanical Projects, Electrical Projects, Power Electronics Projects, Power System Projects, Model Projects, Java Projects, J2EE Projects, Engineering Projects, Student Projects, Engineering College Projects, MCA Projects, BE Projects, BTech Projects, ME Projects, MTech Projects, Wireless Networks Projects, Network Security Projects, Networking Projects, final year projects, ieee projects, student projects, college projects, ieee projects in chennai, java projects, software ieee projects, embedded ieee projects, "ieee2009projects", "final year projects", "ieee projects", "Engineering Projects", "Final Year Projects in Chennai", "Final year Projects at Chennai", Java Projects, ASP.NET Projects, VB.NET Projects, C# Projects, Visual C++ Projects, Matlab Projects, NS2 Projects, C Projects, Microcontroller Projects, ATMEL Projects, PIC Projects, ARM Projects, DSP Projects, VLSI Projects, FPGA Projects, CPLD Projects, Power Electronics Projects, Electrical Projects, Robotics Projects, Solor Projects, MEMS Projects, J2EE Projects, J2ME Projects, AJAX Projects, Structs Projects, EJB Projects, Real Time Projects, Live Projects, Student Projects, Engineering Projects, MCA Projects, MBA Projects, College Projects, BE Projects, BTech Projects, ME Projects, MTech Projects, M.Sc Projects, Final Year Java Projects, Final Year ASP.NET Projects, Final Year VB.NET Projects, Final Year C# Projects, Final Year Visual C++ Projects, Final Year Matlab Projects, Final Year NS2 Projects, Final Year C Projects, Final Year Microcontroller Projects, Final Year ATMEL Projects, Final Year PIC Projects, Final Year ARM Projects, Final Year DSP Projects, Final Year VLSI Projects, Final Year FPGA Projects, Final Year CPLD Projects, Final Year Power Electronics Projects, Final Year Electrical Projects, Final Year Robotics Projects, Final Year Solor Projects, Final Year MEMS Projects, Final Year J2EE Projects, Final Year J2ME Projects, Final Year AJAX Projects, Final Year Structs Projects, Final Year EJB Projects, Final Year Real Time Projects, Final Year Live Projects, Final Year Student Projects, Final Year Engineering Projects, Final Year MCA Projects, Final Year MBA Projects, Final Year College Projects, Final Year BE Projects, Final Year BTech Projects, Final Year ME Projects, Final Year MTech Projects, Final Year M.Sc Projects, IEEE Java Projects, ASP.NET Projects, VB.NET Projects, C# Projects, Visual C++ Projects, Matlab Projects, NS2 Projects, C Projects, Microcontroller Projects, ATMEL Projects, PIC Projects, ARM Projects, DSP Projects, VLSI Projects, FPGA Projects, CPLD Projects, Power Electronics Projects, Electrical Projects, Robotics Projects, Solor Projects, MEMS Projects, J2EE Projects, J2ME Projects, AJAX Projects, Structs Projects, EJB Projects, Real Time Projects, Live Projects, Student Projects, Engineering Projects, MCA Projects, MBA Projects, College Projects, BE Projects, BTech Projects, ME Projects, MTech Projects, M.Sc Projects, IEEE 2009 Java Projects, IEEE 2009 ASP.NET Projects, IEEE 2009 VB.NET Projects, IEEE 2009 C# Projects, IEEE 2009 Visual C++ Projects, IEEE 2009 Matlab Projects, IEEE 2009 NS2 Projects, IEEE 2009 C Projects, IEEE 2009 Microcontroller Projects, IEEE 2009 ATMEL Projects, IEEE 2009 PIC Projects, IEEE 2009 ARM Projects, IEEE 2009 DSP Projects, IEEE 2009 VLSI Projects, IEEE 2009 FPGA Projects, IEEE 2009 CPLD Projects, IEEE 2009 Power Electronics Projects, IEEE 2009 Electrical Projects, IEEE 2009 Robotics Projects, IEEE 2009 Solor Projects, IEEE 2009 MEMS Projects, IEEE 2009 J2EE P
An analog-to-digital converter (ADC, A/D, or A to D) is a device that converts a continuous physical quantity (usually voltage) to a digital number that represents the quantity's amplitude.
The conversion involves quantization of the input, so it necessarily introduces a small amount of error. Instead of doing a single conversion, an ADC often performs the conversions ("samples" the input) periodically. The result is a sequence of digital values that have been converted from a continuous-time and continuous-amplitude analog signal to a discrete-time and discrete-amplitude digital signal.
Biological screening of herbal drugs: Introduction and Need for
Phyto-Pharmacological Screening, New Strategies for evaluating
Natural Products, In vitro evaluation techniques for Antioxidants, Antimicrobial and Anticancer drugs. In vivo evaluation techniques
for Anti-inflammatory, Antiulcer, Anticancer, Wound healing, Antidiabetic, Hepatoprotective, Cardio protective, Diuretics and
Antifertility, Toxicity studies as per OECD guidelines
Unit 8 - Information and Communication Technology (Paper I).pdfThiyagu K
This slides describes the basic concepts of ICT, basics of Email, Emerging Technology and Digital Initiatives in Education. This presentations aligns with the UGC Paper I syllabus.
Welcome to TechSoup New Member Orientation and Q&A (May 2024).pdfTechSoup
In this webinar you will learn how your organization can access TechSoup's wide variety of product discount and donation programs. From hardware to software, we'll give you a tour of the tools available to help your nonprofit with productivity, collaboration, financial management, donor tracking, security, and more.
Palestine last event orientationfvgnh .pptxRaedMohamed3
An EFL lesson about the current events in Palestine. It is intended to be for intermediate students who wish to increase their listening skills through a short lesson in power point.
Embracing GenAI - A Strategic ImperativePeter Windle
Artificial Intelligence (AI) technologies such as Generative AI, Image Generators and Large Language Models have had a dramatic impact on teaching, learning and assessment over the past 18 months. The most immediate threat AI posed was to Academic Integrity with Higher Education Institutes (HEIs) focusing their efforts on combating the use of GenAI in assessment. Guidelines were developed for staff and students, policies put in place too. Innovative educators have forged paths in the use of Generative AI for teaching, learning and assessments leading to pockets of transformation springing up across HEIs, often with little or no top-down guidance, support or direction.
This Gasta posits a strategic approach to integrating AI into HEIs to prepare staff, students and the curriculum for an evolving world and workplace. We will highlight the advantages of working with these technologies beyond the realm of teaching, learning and assessment by considering prompt engineering skills, industry impact, curriculum changes, and the need for staff upskilling. In contrast, not engaging strategically with Generative AI poses risks, including falling behind peers, missed opportunities and failing to ensure our graduates remain employable. The rapid evolution of AI technologies necessitates a proactive and strategic approach if we are to remain relevant.
Introduction to AI for Nonprofits with Tapp NetworkTechSoup
Dive into the world of AI! Experts Jon Hill and Tareq Monaur will guide you through AI's role in enhancing nonprofit websites and basic marketing strategies, making it easy to understand and apply.
Macroeconomics- Movie Location
This will be used as part of your Personal Professional Portfolio once graded.
Objective:
Prepare a presentation or a paper using research, basic comparative analysis, data organization and application of economic information. You will make an informed assessment of an economic climate outside of the United States to accomplish an entertainment industry objective.
2024.06.01 Introducing a competency framework for languag learning materials ...Sandy Millin
http://sandymillin.wordpress.com/iateflwebinar2024
Published classroom materials form the basis of syllabuses, drive teacher professional development, and have a potentially huge influence on learners, teachers and education systems. All teachers also create their own materials, whether a few sentences on a blackboard, a highly-structured fully-realised online course, or anything in between. Despite this, the knowledge and skills needed to create effective language learning materials are rarely part of teacher training, and are mostly learnt by trial and error.
Knowledge and skills frameworks, generally called competency frameworks, for ELT teachers, trainers and managers have existed for a few years now. However, until I created one for my MA dissertation, there wasn’t one drawing together what we need to know and do to be able to effectively produce language learning materials.
This webinar will introduce you to my framework, highlighting the key competencies I identified from my research. It will also show how anybody involved in language teaching (any language, not just English!), teacher training, managing schools or developing language learning materials can benefit from using the framework.
Read| The latest issue of The Challenger is here! We are thrilled to announce that our school paper has qualified for the NATIONAL SCHOOLS PRESS CONFERENCE (NSPC) 2024. Thank you for your unwavering support and trust. Dive into the stories that made us stand out!
How to Make a Field invisible in Odoo 17Celine George
It is possible to hide or invisible some fields in odoo. Commonly using “invisible” attribute in the field definition to invisible the fields. This slide will show how to make a field invisible in odoo 17.
1. Dr. C. SARITHA
DEPT. OF ELECTRONICS
UNIT IV
Applications of Embedded Systems
Temperature Measurement :
Transducers convert physical data such as temperature, light intensity, flow and speed
to electrical signals. Depending on the transducer, the output produced is in the form of voltage,
current, resistance or capacitance. For example, temperature is converted to electrical signals using
a transducer called a thermistor. A thermisor responds to temperature change by changing
resistance, but its response is not linear. So, writing the software for such nonlinear devices is
difficult. To overcome this difficultly many manufacturers released linear temperature sensors
include LM34 and LM35 series from National Semiconductors.
LM35 Sensor :
The LM series sensors are precision integrated circuit temperature sensors whose output
voltage is linearly proportional to the Celsius (centigrade) temperature. The LM35 requires no
external calibration since it is inherently calibrated. It outputs 10mV for each degree of centigrade
temperature. Its temperature range is -55C to +150C.
Signal Conditioning and Interfacing the LM35 to 8051:
Signal conditioning is widely used term in the world of data acquisition. The most
common transducers produce an output in the form of voltage, current, charge, capacitance, and
resistance. However, we need to convert these signals to voltage in order to send input to an A to
D converter. This conversion is commonly called signal conditioning. Signal conditioning can be a
current to voltage conversion or a signal amplification. For example, the thermistor changes
resistance with temperature. The change of resistance must be translated into voltages in order to
use to an ADC. Now, consider the case of connecting an LM35 to an ADC 0809. Since, ADC0809
has 8-bit resolution with a maximum of 256 (28
) steps and the LM35 produces 10mV for every
degree of temperature change, we need to set Vref(+) = 2.56V of the ADC 0809 to produce a Vout
of 2560mV (2.56V).
1
2. Dr. C. SARITHA
DEPT. OF ELECTRONICS
Interfacing diagram of LM35 with 8051:
As shown in the diagram Port 1 of 8051 microcontroller is connected to the data lines of
ADC0809. The address lines C, B, and A are grounded. So, Channel 0 is selected to apply the
analog input. To deactivate the remaining channels, they are grounded. Here, Vref (+) is supplied
with 2.56V, to get a 10mV step size. Vcc and OE are connected to +5V. Vref (-) and GND pins
are connected to ground. CLK must be applied to the 10th
pin of ADC by using a clock source.
SOC line is used to start the conversion and ALE line is used to latch the address. To start the
conversion and latch the address make these lines high through the microcontroller. Then
conversion begins. After some time EOC line becomes high, to indicate the conversion is
completed and the equivalent digital word is at Port 1. The timing diagram shows the entire
procedure of analog to digital conversion.
Fig(i): Timing diagram for ADC 0809
2
3. Dr. C. SARITHA
DEPT. OF ELECTRONICS
Program:
START: SETB P3.4 ; Set SOC = 1, ALE = 1
ACALL DELAY ; Call for the delay
CLR P3.4 ; Clear SOC and ALE
HERE: JNB P3.5, HERE ; Check, for EOC = 1
MOV A, P1 ; Move the data from Port 1 to A
SJMP START ; Continue the same
Result :
Temperature in o
C Vin (mV) Digital output in Hex
0
1
2
3
10
30
0
10
20
30
100
300
00
01
02
03
0A
1E
Displaying of Information on LCD:
In LCD, liquid crystal solution is sandwiched by two sheets for polarizing material. LCD is
used to display the status information or to display prompts to the user. The display can be as
small as 1 line with 8 characters. Other displays used in embedded systems can be of 6.4 inch
or 8.4 inch etc. The diagonal distance is indicated as display size. .
Advantages :
• Less cost
• Small size
• Ability to display numbers, characters and graphics
• Incorporation of a refreshing controller into the LCD, reduces the work of CPU
• Ease of programming for characters and graphics
3
4. Dr. C. SARITHA
DEPT. OF ELECTRONICS
LCD pin descriptions :
Pin
Numbe
r
Symbol Description
1 VSS Ground
2 VCC +5V power supply
3 VEE Power supply to control contrast
4 RS RS=0 to select command register
RS=1 to select data register
5 R/W R/W=0 for write, R/W=1 for read
6 EN Enable
7 D0 8-bit data bus
8 D1 8-bit data bus
9 D2 8-bit data bus
10 D3 8-bit data bus
11 D4 8-bit data bus
12 D5 8-bit data bus
13 D6 8-bit data bus
14 D7 8-bit data bus
RS (Register Select):
There are two very important registers inside the LCD. If RS=0, the command register is
selected, allowing the user to send a command. If RS=1, the data register is selected, allowing the
user to send a data to be displayed on the LCD.
R/W (Read/Write) :
R/W input allows the user to write information to the LCD or read information from it.
R/W =1 when reading, R/W=0 when writing.
EN (Enable) :
The enable pin is used by the LCD to latch information presented to its data pins. To
latch the data from the data pins, a high to low pulse must be applied to this pin.
D0-D7 (Data pins):
The 8 bit data pins, D0-D7, are used to send information to the LCD or read the contents of
the LCD’s internal registers. To display letters and numbers, we send ASCII codes for the letters
4
5. Dr. C. SARITHA
DEPT. OF ELECTRONICS
A – Z, a – z, and numbers 0 – 9 to these pins while making RS=1. There are also commands that
can be sent to the LCD to clear the display or force the cursor to the home position or blink the
cursor when RS=0.
LCD Commands :
Code in Hex Command to LCD
01 Clear display
02 Return home
04 Decrement cursor
06 Increment cursor
05 Shift display right
07 Shift display left
0E Display on, Cursor blinking
80 Force cursor to beginning of 1st
line
C0 Force cursor to beginning of 2nd
line
38 Initialize the LCD display
Interfacing the LCD display to 8051:
In the above circuit diagram a 2x16 line LCD display is connected to the 8051
microcontroller. First, Port 1 lines of 8051 are connected to the D0-D7 lines of the LCD. Then,
three lines of Port 2 i.e., P2.0, P2.1 and P2.2 are connected to RS, R/W and EN pins of the LCD
respectively. The Vcc line is supplied with +5V and Vss is connected to ground. The VEE line is
used to adjust the contrast of the LCD by connecting a +5V supply through a 10KΩ Potentiometer.
Program to display a message on LCD :
MOV A, #38H ; Initialize the LCD display
ACALL CMDWRT ; Call command subroutine
5
6. Dr. C. SARITHA
DEPT. OF ELECTRONICS
ACALL DELAY ; Call delay
MOV A, #0EH ; display on, cursor on
ACALL CMDWRT ; Call command subroutine
ACALL DELAY ; Call delay
MOV A, #01H ; Clear LCD
ACALL CMDWRT ; Call command subroutine
ACALL DELAY ; Call delay
MOV A, #06H ; Shift cursor right
ACALL CMDWRT ; Call command subroutine
ACALL DELAY ; Call delay
MOV A, #80H ; Cursor at line1
ACALL CMDWRT ; Call command subroutine
ACALL DELAY ; Call delay
MOV A, #’L’ ; Display letter L
ACALL DATWRT ; Call data subroutine
ACALL DELAY ; Call delay
MOV A, #’C’ ; Display letter C
ACALL DATWRT ; Call data subroutine
ACALL DELAY ; Call delay
MOV A, #’D’ ; Display letter D
ACALL DATWRT ; Call data subroutine
AGAIN: SJMP AGAIN ; Stay here
CMDWRT: ; Send command to LCD
MOV P1, A ; Copy the contents of register A to Port 1
CLR P2.0 ; RS=0 for command register
CLR P2.1 ; R/W=0 for write operation
SETB P2.2 ; E=1 for high pulse
CLR P2.2 ; E=0 for H-to-L pulse
RET ; Return to main program
DATWRT: ; Send data to LCD
MOV P1, A ; Copy the contents of register A to Port 1
SETB P2.0 ; RS=1 for data register
CLR P2.1 ; R/W=0 for write operation
SETB P2.2 ; E=1 for high pulse
6
7. Dr. C. SARITHA
DEPT. OF ELECTRONICS
CLR P2.2 ; E=0 for H-to-L pulse
RET ; Return to main program
DELAY: MOV R3, #50H ; Set R3=50H
LOOP: MOV R4, #0FFH ; Set R4=0FFH
LOOP1: DJNZ R4, LOOP ; Decrement R4, till it becomes zero
DJNZ R3, LOOP1 ; Decrement R3, till it becomes zero
RET ; Return to main program
Control of Stepper motor :
A stepper motor is a widely used device that translates electrical pulses into mechanical
movement. In applications such as disk drives, dot matrix printers and robotics, the stepper motor
is used for position control. Every stepper motor has a permanent magnet rotor (also called the
shaft) surrounded by a stator. The most common stepper motors have four stator windings that are
paired with a center-tapped common as shown in fig (a).
Fig (a): Stator windings configuration
This type of stepper motor is commonly referred to as a four phase stepper motor. The center tap
allows a change of current direction in each of two coils when a winding is grounded, thereby
resulting in a polarity change of the stator. Notice that while a conventional motor shaft runs
freely, the stepper motor shaft moves in a fixed repeatable increment which allows one to move it
to a precise position. This repeatable fixed movement is possible as a result of basic magnetic
theory where poles of the same polarity repel and opposite poles attract. The direction of the
rotation is dictated by the stator poles. The stator poles are determined by the current sent through
the wire coils. As the direction of the current is changed, the polarity is also changed causing the
reverse motion of the rotor.
The stepper used here has a total of 6 leads : 4 leads representing the four stator
winding and 2 commons for the center tapped leads. As the sequence of power is applied to each
stator winding, the rotor will rotate. There are several widely used sequences where each has a
different degree of precision. Table 1 shows the normal 4 step sequence.
Table 1 : Normal 4-step sequence
7
8. Dr. C. SARITHA
DEPT. OF ELECTRONICS
Clockwise Step Winding A Winding B Winding C Winding D Counter
clockwise1 1 0 0 1
2 1 1 0 0
3 0 1 1 0
4 0 0 1 1
It must be noted that although we can start with any of the sequences, once we start we
must continue in the proper order.
Step angle : The step angle is the minimum degree of rotation associated with a single step.
Various motors have different step angles
Steps per revolution : This is the total number of steps needed to rotate one complete rotation or
3600
(Ex: 1.8 degrees x 200 steps = 360 degrees).
Motor speed : The motor speed is measured in steps per second, is a function of the switching
rate. We know that Steps per second = (RPM x Steps per revolution)/60. Notice that, by changing
the length of the time delay, we can get various rotation speeds.
Interfacing diagram for Stepper motor :
In the above diagram, the four leads of the stator winding are connected to the four bits
of the 8051 port i.e., P1.0, P1.1, P1.2 and P1.3 respectively. These four bits will control the motor.
However, since the 8051 lacks sufficient current to drive the stepper motor windings, we must use a
driver such as the ULN2003 to energize the stator. The common wires are connected the positive
side of the motors power supply. In many motors +5V is sufficient. By applying proper sequence
to the stator windings, we can rotate the motor in both clockwise and anti-clockwise directions.
8
9. Dr. C. SARITHA
DEPT. OF ELECTRONICS
Program to rotate a stepper motor in clock wise direction:
MOV A, #66H ; Load step sequence
BACK: MOV P1, A ; Issue sequence to motor through Port 1
RR A ; Rotate right, clockwise by one step
ACALL DELAY ; wait
SJMP BACK ; Repeat the same
DELAY: MOV R3, #50H ; Set R3=50H
LOOP: MOV R4, #0FFH ; Set R4=0FFH
LOOP1: DJNZ R4, LOOP ; Decrement R4, till it becomes zero
DJNZ R3, LOOP1 ; Decrement R3, till it becomes zero
RET ; Return to main program
Program to rotate a stepper motor in anti-clock wise direction:
MOV A, #66H ; Load step sequence
BACK: MOV P1, A ; Issue sequence to motor through Port 1
RL A ; Rotate left, anti-clockwise by one step
ACALL DELAY ; wait
SJMP BACK ; Repeat the same
DELAY: MOV R3, #50H ; Set R3=50H
LOOP: MOV R4, #0FFH ; Set R4=0FFH
LOOP1: DJNZ R4, LOOP ; Decrement R4, till it becomes zero
DJNZ R3, LOOP1 ; Decrement R3, till it becomes zero
RET ; Return to main program
Note : To increase the speed of the motor, keep R3 value less or to decrease the speed of the motor
keep R3 value high.
Keyboard Interfacing to the 8051:
Keyboards are the most widely used input device. These keyboards are organized in a
matrix of rows and columns through ports, therefore, with two 8-bit ports, an 8x8 matrix of keys
can be connected to a microcontroller. When a key is pressed, a row and a column make a contact,
otherwise, there is no connection between rows and columns.
Fig (a) shows a 4x4 matrix connected to two ports. The rows are connected to an
output port and the columns are connected to an input port. If no key has been pressed, reading the
9
10. Dr. C. SARITHA
DEPT. OF ELECTRONICS
input port will yield 1s for all columns since they are all connected to high (Vcc). If all the rows are
grounded and a key is pressed, one of the columns will have 0 since the key pressed provides the
path to ground. It is the function of the microcontroller to scan the keyboard continuously to detect
and identify the key pressed.
Fig (a) : Matrix keyboard connection to ports
Grounding rows and reading columns :
To detect a pressed key, the microcontroller grounds all rows by providing 0 to the
output latch, then it reads the columns. If the data read from the columns is D3-D0 = 1111, no key
has been pressed and the process continues until a key press is detected. However, if one of the
column bits has a zero, this means that a key press has occurred. For example, if D3-D0 = 1101,
this means that a key in the D1 column has been pressed. After a key press is detected, the
microcontroller will go through the process of identifying the key. Starting with the top row, the
microcontroller grounds it by providing a low to row D0 only, then it reads the columns. If the data
read is all 1s, no key in that row is activated and the process is moved to the next row. It grounds
the next row, reads the columns, and checks for any zero. This process continues until the row is
identified. After identification of the row in which the key has been pressed, the next task is to find
out which column the pressed key belongs to. This should be easy since the microcontroller knows
at any time which row and column are being accessed.
Program:
This program sends the ASCII code for pressed key to Port 0
MOV P2, #0FFH ; Make P2 an input port
K1: MOV P1, #00H ; Ground all rows at once
MOV A, P2 ; Read all columns
10
11. Dr. C. SARITHA
DEPT. OF ELECTRONICS
ANL A, #00001111B ; Mask unused bits
CJNE A, #00001111B, K1 ; Check till all keys released
K2: ACALL DELAY ; Call 20 msec delay
MOV A, P2 ; See if any key is pressed
ANL A, #00001111B ; Mask unused bits
CJNE A, #00001111B, OVER ; Key pressed, await closure
SJMP K2 ; Check if key is pressed
OVER: ACALL DELAY ; Wait 20 msec debounce time
MOV A, P2 ; Check key closure
ANL A, #00001111B ; Mask unused bits
CJNE A, #00001111B, OVER1 ; Key pressed, find row
SJMP K2 ; If none, keep polling
OVER1: MOV P1, #11111110B ; Ground row 0
MOV A, P2 ; Read all columns
ANL A, #00001111B ; Mask unused bits
CJNE A, #00001111B, ROW_0 ; Key pressed in row 0, find the column
MOV P1, #11111101B ; Ground row 1
MOV A, P2 ; Read all columns
ANL A, #00001111B ; Mask unused bits
CJNE A, #00001111B, ROW_1 ; Key pressed in row 1, find the column
MOV P1, #11111011B ; Ground row 2
MOV A, P2 ; Read all columns
ANL A, #00001111B ; Mask unused bits
CJNE A, #00001111B, ROW_2 ; Key pressed in row 2, find the column
MOV P1, #11110111B ; Ground row 3
MOV A, P2 ; Read all columns
ANL A, #00001111B ; Mask unused bits
CJNE A, #00001111B, ROW_3 ; Key pressed in row 3, find the column
LJMP K2 ; If none, false input, repeat
ROW_0: MOV DPTR, #KCODE0 ; Set DPTR=start of row 0
SJMP FIND ; Find column key belongs to
ROW_1: MOV DPTR, #KCODE1 ; Set DPTR=start of row 1
SJMP FIND ; Find column key belongs to
ROW_2: MOV DPTR, #KCODE2 ; Set DPTR=start of row 2
11
12. Dr. C. SARITHA
DEPT. OF ELECTRONICS
SJMP FIND ; Find column key belongs to
ROW_3: MOV DPTR, #KCODE3 ; Set DPTR=start of row 3
SJMP FIND ; Find column key belongs to
FIND: RRC A ; See if any carry bit low
JNC MATCH ; If zero, get the ASCII code
INC DPTR ; Point to next column address
SJMP FIND ; Keep searching
MATCH: CLR A ; Set A=0 (Match is found)
MOVC A, @A+DPTR ; Get ASCII code from table
MOV P0, A ; Display pressed key
LJMP K1 ; Repeat the same for next key press
KCODE0: DB ‘0’,’1’,’2’,’3’ ; ROW 0
KCODE1: DB ‘4’,’5’,’6’,’7’ ; ROW 1
KCODE2: DB ‘8’,’9’,’A’,’B’ ; ROW 2
KCODE3: DB ‘C’,’D’,’E’,’F’ ; ROW 3
Waveform generation using DAC0800 :
Digital to analog converters are used to convert digital quantity to analog quantity. D/A
converter produces an output proportional to the digital quantity (binary word) applied to its input.
A most widely used DAC chip is DAC 0800. This chip is also used to generate different
waveforms.
Features of DAC0800:
• It is an 8-bit DAC
• It has fast settling time : 100ns
• The conversion technique used is R-2R ladder network method
• It operates at +4.5V to +18V supply
• Low cost
• Full scale error: ±1 LSB
• Low power consumption
Interfacing diagram of DAC with 8051:
12
13. Dr. C. SARITHA
DEPT. OF ELECTRONICS
As shown in the diagram Port 1of 8051 microcontroller is connected to the data lines of
DAC. The supply V+
is connected to the +5V or +12V. V-
is connected to the -12V. The DAC
0800 is a current output device. So, an op-amp is used, to convert the output of DAC i.e., current to
voltage. One of the applications of an op amp is as a current to voltage converter. The output of
the op amp is connected to a CRO, in which the corresponding wave form will appear, depending
the assembly language program.
Program to generate Square wave:
HERE: MOV A, #0FFH ; Load A=0FFH
MOV P1, A ; Sent FFH to Port 1
LACLL DELAY ; Call delay subroutine
MOV A, #00H ; Load A=00H
MOV P1, A ; Sent 00H to Port 1
LCALL DELAY ; Call delay subroutine
SJMP HERE ; Go to label HERE
DELAY: MOV R3, #0FFH ; Load R3 with FFH
LOOP: DJNZ R3, LOOP ; Decrement R3 by1 and if R3≠0 go to label LOOP
RET ; Return to main program
Program to generate Rectangular wave:
13
14. Dr. C. SARITHA
DEPT. OF ELECTRONICS
HERE: MOV A, #0FFH ; Load A=FFH
MOV P1, A ; Sent FFH to Port 1
LACLL DELAY1 ; Call larger delay subroutine
MOV A, #00H ; Load A=00H
MOV P1, A ; Sent 00H to Port 1
LCALL DELAY2 ; Call smaller delay subroutine
SJMP HERE ; Go to label HERE
DELAY1: MOV R5, #0FF ; Load R5 with FFh
LOOP: MOV R6, #0FF ; Load R6 with FFh
HERE: DJNZ R6, HERE ; Decrement R6 by1 and if R6≠0 go to label HERE
DJNZ R5, LOOP ; Decrement R5 by1 and if R5≠0 go to label LOOP
RET ; Return to main program
DELAY2: MOV R3, #0FF ; Load R3 with FFh
LOOP: DJNZ R3, LOOP ; Decrement R3 by1 and if R3≠0 go to label LOOP
RET ; Return to main program
Program to generate sawtooth wave:
MOV A, #00H ; Load A=00h
BACK: MOV P1, A ; Sent the value of A to Port1
INC A ; Increment the value of A by 1
SJMP BACK ; Repeat the same
Program to generate Triangular wave:
BACK: MOV A, #00H ; Load A=00h
14
15. Dr. C. SARITHA
DEPT. OF ELECTRONICS
INCR: MOV P1, A ; Sent the value of A to Port1
INC A ; Increment the value of A by 1
CJNE A, #0FF, INCR ; Compare if A=0FFH, if not, goto label INCR
DECR: MOV P1,A ; Sent the value of A to Port1
DEC A ; Decrement the value of A by 1
CJNE A, #00, DECR ; Compare if A=00H, if not, goto label DECR
SJMP BACK ; Repeat the same
Program to generate Step wave:
BACK: MOV A, #00H ; Load A=00h
MOV P1, A ; Sent the value of A to Port1
ACALL DELAY ; Call delay subroutine
LOOP: ADD A, #33H ; Add the data 33H to the contents of A
MOV P1, A ; Sent the value of A to Port 1
ACALL DELAY ; Call delay subroutine
CJNE A, #0FFH, LOOP ; Compare if A=0FFH, if not, goto label LOOP
SJMP BACK ; Repeat the same
Program to generate Sine wave:
AGAIN: MOV DPTR, #TABLE ; Load DPTR with the address of TABLE
MOV R2, #COUNT ; Load R2 with count
BACK: CLR A ; Clear Accumulator i.e., A=00
MOVC A,@A+DPTR ; Go to the look up table for getting the value
MOV P1, A ; Move the lookup table value to Port 1
15
16. Dr. C. SARITHA
DEPT. OF ELECTRONICS
INC DPTR ; Increment DPTR by 1
DJNZ R2, BACK ; Decrement R2 by1 and if R2≠0 go to label LOOP
SJMP AGAIN ; Repeat the same
TABLE: DB 128, 192, 238, 255, 238, 192 ; Sine wave for 300
DB 128, 64, 17, 0, 17, 64, 128
16
ALL THE
BEST