Open navigation menu
Close suggestions
Search
Search
en
Change Language
Upload
Sign in
Sign in
Download free for days
0 ratings
0% found this document useful (0 votes)
69 views
27 pages
Application of 8051 Microcontroller
Done
Uploaded by
Somenath Dutta
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Download
Save
Save Application of 8051 microcontroller For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
0 ratings
0% found this document useful (0 votes)
69 views
27 pages
Application of 8051 Microcontroller
Done
Uploaded by
Somenath Dutta
AI-enhanced title
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content,
claim it here
.
Available Formats
Download as PDF or read online on Scribd
Carousel Previous
Carousel Next
Download
Save
Save Application of 8051 microcontroller For Later
Share
0%
0% found this document useful, undefined
0%
, undefined
Print
Embed
Report
Download
Save Application of 8051 microcontroller For Later
You are on page 1
/ 27
Search
Fullscreen
yeu f E ohfequency Measuremen’ ing 80! » Frequency Measurement Using 8051 { [Frequency Measurement Using 8051 ss °e ° eoooo°o ° Frequency of the given pulse train is equal to the number of pulses per second. Frequency= Number of pulses/Time To find the frequency using the microcontroller, both the Timers TO and T1 of 8051 are used. Normally if T0 is used as a counter, the T1 is used as a Timer. The procedure is, the external pulse train is applied at the PinP3.3 or P3.4. The Timer1 is configured to lapse for a known time say, 1000 micro seconds. During this time the Timer0 is used as a counter and it counts the total number of pulses appeared at the PinP3.3 or P3.4. From this the number of pulses per second is calculated, which is nothing but the frequency of the pulse. ‘To measure the frequency, it is recommended to use a square wave pulses. If exact square wave is not available from a function generator, a Schmitt trigger circuit can be used, which converts a sine wave into a square wave.© The circuit diagram is shown below. Vee xTAL1— xTaL2 <——— eh 8051 Ko) | 2x16 LCD or “ P3.3 ae ials Schmitt Trigger Gnd Fig 1: Schmitt trigger with 8051 © In the procedure the Timer( is configured as a counter and the Timert is configured as a 16 bit timer:In the procedure the Timer() is configured as a counter and the Timert is configured as a 16 bit timer. Timer 1 is pre-loaded with a suitable value so that it will run for time which generates a time lapse of 100 microseconds. During this time the Timer() which is configured as a counter will count the number of pulses. The count value is divided by the time. This give the frequency of the pulse train applied externally at the PinP3.3. The maximum frequency measured by the microcontroller depends on the clock frequency. Normally the 8051 microcontroller can measure accurately those frequencies which do not exceed f/24, where fis clock frequency of the controller. The assembly language program for the measurement of frequency is given below.Assembly Language program START | MOVTCON, #00 | Initialize TCON register vovrcon.eso | sartinerandoumer SETB PSW, 3 Initialize Banks 1 eee Movie 88 | Enable global and. TL MOV RO, #00 Initialize RO Register ve low interrupt MOY R1, #00 Initialize R1 Register JBCOF LOOPL CLR PSW.3 Return Bank 1 Loop2: | sIMPLOOP2 MOV TMOD, #25 | Timer 0 asa counter LOOPI: | MOVR6, TLD Load the count values into : R6&RT registers ‘Timer 1 asa counter MOVR7, THO MOVTLI,#9C | Start TL1 at 9CH UCALL Display | Display subroutine to MOV THO, #00 ‘THA Overflowing 100 docks display the data CLR FLAG SMP START Ready for the next MOVTCON, #50 | Starttimerand counter 4 NeerMeasurement Of Current Using 8051 <4 © Small currents can be measured using the microcontroller, for this a resistor of small value between 0.1 to 1 ohm is connected to the load and Vcc in series as shown in the diagram. © The voltage source must be always a regulated power supply. ° The voltage across the resistor is connected to the inverting terminal for signal conditioning This will make the voltage suitable to apply to one of the inputs of the ADCO809. This ADC will converts this analog voltage into equivalent digital value. This digital value is applied to the port 1 of the microcontroller. The data is processed and displayed on the LCD module. The calculate the current Ohms law, V=IR is used. eooooo°d In the above circuit the sense resistor’s value is 1 ohm and when 1 ampere of current is flowing in the resistor, then 1 Volt will be developed across the sense resistor. So, I= V/R.© By Measuring the voltage using the microcontroller, the Current in the resistor can be found. © Note: © This method is useful to measure small currents only, because with large currents the small resistor will dissipate large heat. So, to measure large currents high wattage wire wound resistors or Toroid must be used. RPS@ Vec 5v Load By 2X16 LCD apc 0809 Resistor P20) lohm po 8051 P27 EA. Gnd Fig 1: Circuit for current measurement using 8051 “aAssembly Language program 9000 | START | SETB P34 Send ALE & SOC high NoP No Operation NoP No Operation CLR P34 ALE & SOC low Loop1 | JNB P3.5, LOOP1 |Is conversion over? Mov APL Read digital data(Voltage) CALL CONV Convert the hex value into Decimal value Mov B,#Resistor|Load the resistor Value value into B resistor DIV AB Divide voltage by resistance CALL DISPLAY [Display subroutine to display current on LCD symp [START Measure the current continuously 4Measurement Of Voltage Using 8051 = ° ° eooo°o Small DC Voltages can be measured using the microcontroller, for this a resistor of small value around 1 ohm is connected to the load and Vcc in series as shown in the diagram. The voltage source must be always a regulated power supply. The voltage across the resistor is connected to the inverting terminal for signal conditioning. This will make the voltage suitable to apply to one of the inputs of the ADC0809. This ADC will convert this analog voltage into equivalent digital value. This digital value is applied to the port 1 of the microcontroller. ‘The data is processed and displayed on the LCD module.RPS@ Vee Load Resistor 1ohm Fig 1: Circuit for Voltage measurement using 8051 OQ Note: © This method is useful to measure small currents only. Because with large currents the small resistor will dissipate large heat. So, to measure large voltages high wattage wire wound resistor or Toroid must be used.Assembly Language program 9000 | START | SETB P34 Send ALE & SOC high Nop No Operation Nop No Operation CLR P34 ALE & SOC low Loop1 | JNB P3.5, LOOP! |Is conversion over? Mov APL Read digital data(Voltage) CALL CONV Convert the hex value into Decimal value CALL DISPLAY Display subroutine to display Voltage on LCD sJMP START Measure the voltage continuously“A 4 » Generation of triangular waveform » Generation of staircase waveformGeneration of square waveform © To generate square wave first we have to output FF and then 00 on Port 1 of 8051. © The Port 1 is connected as an input to the DAC 0808. @ According to frequency requirement delay is provided between the two outputs. Lable Mnemonics Comments MOV SP, #08H Initialize the stack pointer. REPEAT | MOV PI, #0FFH Load all 1's in Port 1 LCALL DELAY Call delay routine Mov P, #00H Load all 0's in Port 1 LCALL DELAY Call delay routine LIMP REPEAT Repeat DELAY MOV RO, #0FFH Load delay count BACK DJNZ RO, BACK Decrement and check whether delay count is zero if not repeat the operationGeneration of triangular waveform Sx ° Qo The method is to increment the data outputted to the DAC, from 0 to FFH. On conversion to analog form, it will give a gradually increasing output from 0 to the maximum output voltage. Then, decrement the number from FFH to 0. This will give the high to low triangular transition. As the clock frequency of the 8051 is reasonably high, the time for incrementing the number 0 to FFH and decrementing from FFH to 0 will be quite small. Thus, the wave- form generated will have a very short duration. To obtain a slower increase and decrease in analog voltage, a good idea will be to have a small delay after each increment or decrement of the digital number. The delay must be small, such that steps are not see n in the increasing or decreasing port ions of the analog voltage. The amount of this small delay can also be used to control the periods of the generated waveforms.Assembly Language program DAC EQU P2 name port 2 as DAC orGo Mov a, #0 start with A= 0 REP. MOV DAC, A move the content of A to the DAC ACALL DELAY call a very small delay INCA increment A CINE A, HOFFH, REP | ifthe value in Al = FFH, repeat cn: | Mov paca if A= FPH, start the downward swing ACALL DELAY call a very small delay DECA decrement A CINE A, #0, AGN, if Al = 0, repeat the cycle SJMP REP if A = 0, start the upward swing petay: | MovR3, #10 sur: | DINZR3, SELF RET ENDGeneration of staircase waveform <4 © To generate a staircase waveform using the DAC chip is given in the figure and the hardware is assumed to be the same. vi ve v5] Fig 3: Staircase wave form © Three levels V 1, V2, and Vs are assumed in the output voltage waveform. © The hexadecimal output to be given to the portis calculated using the formula. © Equivalent value for voltage output Vi= [(2"- 1)/ Maximum output voltage] x Vi © where nis the number of binary bits in the input to the DAC. @ The following program assumes these three values as DATA1, DATA2, and DATA3. © The fixed time delay is used in all the three levels.4 pao} 22 Ing Tou pay}___._ 57 2 +12V 10 = ¢ 8051PPI Ae 1a pales i — # al 3 |®5 pacosoo soit PA4); ————_—= 84 ce 16 1} pas}___7_»Jp3 oy : 3 mq ir, Es 0-12V (sb) PA7y} 5 = 51 at vic|+ WWW Ve => ees) Ve Fig 4: Interfacing DAC 0800 with 8051 2H I-to-V converter network eer ear LM741 Analog cw output 2] 75 tp voltageAssembly Language program START: | MOV P1, #DATAL load the hexadecimal equivalent of Vi in port 1. CALL DELAY call the subroutine DELAY. MOV P1, DATA2 load the hexadecimal equivalent of Vp in port 2. CALL DELAY call the subroutine DELAY. MOV P1, DATA3 load the hexadecimal equivalent of V3 in port 3. CALL DELAY call the subroutine DELAY. SJMP START loop again to get a continuous waveform. DELAY: | MOVRO,#COUNT | load a register with a count value. RPT: DJNZ RO, RPT Decrement it and loop. RET if the value of count become zero. return from subroutine.Bese:PWM control of DC motor Q ° The speed of the DC motor depends on the applied voltage. The DC motor's speed is varied by varying the DC voltage (or current) supplied to it Instead of using a DAC to provide a variable DC voltage, the pulse width modulation (PWM) method can be used to provide variable power/voltage. By changing (modulating) the width of a pulse the average (DC) voltage can be varied. i ae 25% DC Power ‘il a = 50% DC Power 75% DC 3 Power 100% DC full Power Fig 1: Power variation using PWM© When the pulse width is zero, the DC voltage is zero and when the pulse width is 100%, the DC voltage is maximum. © When the pulse width is 50%, the DC voltage is Vinx /2- Q Byvarying the pulse width the DC voltage can be varied. PWM out from MCUL GND Fig 2: PWM output interface circuit -© Thus the speed of the DC motor can be controlled by PWM method. © PWM circuitry is embedded in the microcontroller, only the duty cycle has to be programmed. © Duty cycle, D Ton + Tore Duty cycle | Power o/p | Pulse 0% 0 25% 1/4 Pane 50% HP ee ee (ee (| Ton/Tose 75% 3/4 seta ee (ne 2 100% Pas = ae Table 1: Duty cycleProgram @ Interface a DC motor to an 8051 microcontroller using optoisolator write a ‘C’ program to move the DC motor with 25% duty cycle pulse. © The DC motor interfaced with optocoupler is shown in the below figure 10. +12V9 = 0.1086 | +5V i 1L074 OPTO isolator Al ANN —f 8 8 0 WA d 7 D=Diode P1.0 o M = Motor 5 Di 1 Fig 3: Interfacing of DC motor to an 8051 microcontroller using optocouplerQ Given data Duty cycle = 25%, Ton = 25ms and Torr = 75ms. © Algorithm ® Step 1: Make P1.0 low to ON the motor. © Step 2: Call delay for 25ms (Ton). © Step 3: Make P1.0 high to OFF the motor. © Step 4: Call delay for 25ms (Torr). © Step 5: Repeat from step1.Assembly Language program ORG 00H ‘AGAIN. [CLRPLO Motor ON ACALL DON | Toy Call DON subroutine to ON the motor SETB PLO Motor OFF ACALLDOFF | Torr, Call DON subroutine to ON the motor SIMP AGAIN | Control transfers to AGAIN DON [Mov Ro, #25 | 5% TON Loop2 [MOVRI, #FFH | Load PRH into RE Loop! [DINZ R1,LOOPI] Decrement the contents of RI, ifnon-zero jump to Lori DJNZRO, LOOP2 | Decrement the contents of RO, I non-zero jump to Loor2 DJNZRO, LOOP2 | DJNZ RO, LOOP2 RET Return DOFF | MOVRO, #75 | 75% Torr Loops [MOVRi,#FFH | Load FFH into RI Loops | DjNZ Ri, LooP3| Decrement the contents of 1, ifnon-zero jump to Loops DINZ RO, LOOP4 | Decrement the contents of RO, ifnon-zero jump to oor RET Return END
You might also like
Final Module 3
PDF
No ratings yet
Final Module 3
17 pages
8051
PDF
100% (1)
8051
32 pages
Embedded Systems
PDF
No ratings yet
Embedded Systems
121 pages
Adc and Dac
PDF
No ratings yet
Adc and Dac
5 pages
Module 4 Final
PDF
No ratings yet
Module 4 Final
155 pages
MPMC Unit-5 Material
PDF
No ratings yet
MPMC Unit-5 Material
62 pages
Digital Thermometer Using 8051 PDF
PDF
100% (1)
Digital Thermometer Using 8051 PDF
3 pages
Microcontroller 1 J2 and 3 Module Notes
PDF
No ratings yet
Microcontroller 1 J2 and 3 Module Notes
38 pages
Course On Microcontrollers
PDF
No ratings yet
Course On Microcontrollers
115 pages
MC Lab Manual 2024-25
PDF
No ratings yet
MC Lab Manual 2024-25
18 pages
Voltmeter Using 8051.: Circuit Diagram
PDF
100% (1)
Voltmeter Using 8051.: Circuit Diagram
16 pages
Unit V - Applications (9 Hours)
PDF
No ratings yet
Unit V - Applications (9 Hours)
37 pages
Embedded Lab
PDF
No ratings yet
Embedded Lab
13 pages
8 Bit Addition: Exp No
PDF
No ratings yet
8 Bit Addition: Exp No
4 pages
MC Unit 3
PDF
No ratings yet
MC Unit 3
34 pages
Microcontroller
PDF
No ratings yet
Microcontroller
21 pages
Elektor Electronics 1998-11
PDF
No ratings yet
Elektor Electronics 1998-11
54 pages
MC Manual Ec
PDF
No ratings yet
MC Manual Ec
67 pages
7-Segment Display & ADC Controls With 8051: LABORATORY - Experiment 5
PDF
No ratings yet
7-Segment Display & ADC Controls With 8051: LABORATORY - Experiment 5
12 pages
08.601 MBSD Module 2
PDF
No ratings yet
08.601 MBSD Module 2
86 pages
8051 Micro Controller
PDF
No ratings yet
8051 Micro Controller
116 pages
GPT1
PDF
No ratings yet
GPT1
27 pages
VJ MP2m
PDF
No ratings yet
VJ MP2m
4 pages
BEC405A Module3
PDF
No ratings yet
BEC405A Module3
76 pages
Assignment Test1
PDF
No ratings yet
Assignment Test1
4 pages
MCT With IoT Lab Manaul NEW - 064701
PDF
No ratings yet
MCT With IoT Lab Manaul NEW - 064701
52 pages
Unit 2 Notes
PDF
No ratings yet
Unit 2 Notes
16 pages
Chapter-4 8051 Interfacing Applications
PDF
No ratings yet
Chapter-4 8051 Interfacing Applications
30 pages
Lab IV Lecture 2: Step 1 Review Introduce Step 2 Course Web Page
PDF
No ratings yet
Lab IV Lecture 2: Step 1 Review Introduce Step 2 Course Web Page
38 pages
Co3 Questions and Answer
PDF
No ratings yet
Co3 Questions and Answer
17 pages
Vivekanand Education Society'S: Institute of Technology
PDF
No ratings yet
Vivekanand Education Society'S: Institute of Technology
9 pages
FALLSEM2024-25 BEEE309L TH VL2024250101214 2024-10-05 Reference-Material-I
PDF
No ratings yet
FALLSEM2024-25 BEEE309L TH VL2024250101214 2024-10-05 Reference-Material-I
23 pages
8051 Assembly Language Programmin
PDF
No ratings yet
8051 Assembly Language Programmin
6 pages
MPMC Sougata
PDF
No ratings yet
MPMC Sougata
5 pages
m1 Mca
PDF
No ratings yet
m1 Mca
49 pages
MP - MC Lab BOSE 2024
PDF
No ratings yet
MP - MC Lab BOSE 2024
41 pages
Mca Etc Jdcoem Lab Manual Aki
PDF
No ratings yet
Mca Etc Jdcoem Lab Manual Aki
26 pages
MC Unit-5
PDF
No ratings yet
MC Unit-5
21 pages
22EC502 MICROCONTROLLER-Model Ans Key
PDF
No ratings yet
22EC502 MICROCONTROLLER-Model Ans Key
15 pages
Unit IV
PDF
No ratings yet
Unit IV
26 pages
Experiment 09
PDF
No ratings yet
Experiment 09
8 pages
Objective: Methodology
PDF
No ratings yet
Objective: Methodology
6 pages
Part B Interfacing Expts
PDF
No ratings yet
Part B Interfacing Expts
12 pages
8051 Interface DAC
PDF
No ratings yet
8051 Interface DAC
13 pages
Machine Design
PDF
No ratings yet
Machine Design
9 pages
IA2 - Scheme & Sol MC - by Tauseef
PDF
No ratings yet
IA2 - Scheme & Sol MC - by Tauseef
6 pages
8051 Hardware Tutorials
PDF
No ratings yet
8051 Hardware Tutorials
24 pages
Q. No Sub Q.No Answer: (Autonomous)
PDF
No ratings yet
Q. No Sub Q.No Answer: (Autonomous)
23 pages
MAA Imp
PDF
No ratings yet
MAA Imp
11 pages
The 8051 Microcontroller 222
PDF
No ratings yet
The 8051 Microcontroller 222
2 pages
ON Microcontroller-8051 and Applications: BY G N V Ratna Kishor M.Sc.,M.Tech. Asst. Professor
PDF
No ratings yet
ON Microcontroller-8051 and Applications: BY G N V Ratna Kishor M.Sc.,M.Tech. Asst. Professor
66 pages
Power Supply For 8051 Microcontroller
PDF
No ratings yet
Power Supply For 8051 Microcontroller
5 pages
Adc - Dac
PDF
No ratings yet
Adc - Dac
20 pages
With 8051 Microcontroller: Analog To Digital Convertor Interface
PDF
No ratings yet
With 8051 Microcontroller: Analog To Digital Convertor Interface
37 pages
M4 Micro OneNote
PDF
No ratings yet
M4 Micro OneNote
6 pages
Analog To Digital Conversion
PDF
No ratings yet
Analog To Digital Conversion
4 pages
MC PLC Lab 2013
PDF
No ratings yet
MC PLC Lab 2013
37 pages