Interfacing of 8051 UNIT 4.

Slides:



Advertisements
Similar presentations
Week10 Boolean Instructions on the Boolean Instructions  Boolean (or Bit) addressable capability is unique to the 8051  Enables efficient handling.
Advertisements

Programmable Interval Timer
Lecture 17: Analog to Digital Converters Lecturers: Professor John Devlin Mr Robert Ross.
kashanu.ac.ir Microprocessors 6-1 I/O Devices Switches, LED, LCD Lec note 6.
555 Timer ©Paul Godin Updated February Oscillators ◊We have looked at simple oscillator designs using an inverter, and had a brief look at crystal.
Data Acquisition ET 228 Chapter
Digital to Analog and Analog to Digital Conversion
Analogue to Digital Conversion
Interfacing ADC to 8051.
Engineering 4862 Microprocessors Lecture 26 Cheng Li EN-4012
kashanu.ac.ir Microprocessors 10-1 IO Devices Stepper Motors DAC, ADC, PPI Lec note 10.
ECGR-6185 Advanced Embedded Systems University Of North Carolina at Charlotte A. Srinivas Reddy Stepper/Servo/DC Motors.
1 Stepper Motors. 2 Click once to show video 3 HOW CAN WE INCREASE THE RESOLUTION, OR STEPS, OF A MOTOR? 1.Increase the number of stationary electro.
TIMERS.
Project: sun tracker Idea: –Use two photodiodes to detect where the sun is –Control a motor to turn toward the sun –When sun is “half-way” between PD,
DEEPAK.P MICROPROCESSORS AND APPLICATIONS Mr. DEEPAK P. Associate Professor ECE Department SNGCE 1.
Stepper Motor. Stator Rotor Full Stepping Energizing one coil at a time is known as running the motor in 'full steps'. In a 200 step motor, this.
8051 timer/counter.
1 Chapter 4 Timer Operation (I. Scott MacKenzie).
1LAKSHMI.B.E.. Full step -clock 2LAKSHMI.B.E. Full step –anti clock 3LAKSHMI.B.E.
Analog to Digital Converters (ADC) 1
©2008 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This material is protected under all copyright laws as they currently exist.
1 L Fall 2003 – Introductory Digital Systems Laboratory Motors and Position Determination.
CoE3DJ4 Digital Systems Design Chapter 4: Timer operation.
Digital to Analogue Converter
8086/8088 Hardware Specifications Power supply:  +5V with tolerance of ±10%;  360mA. Input characteristics:  Logic 0 – 0.8V maximum, ±10μA maximum;
January 10, 1999Robotics 1 Copyright Martin P. Aalund, Ph.D. Matrix Order Number of row or columns Rank of Matrix: Order of largest non-zero determinant.
PIT Programming Examples Working with the modes of PIT.
DC MOTOR LAKSHMI.B.E.. DC MOTOR WORKING LAKSHMI.B.E.
Instrumentation & Control Engg. Section Electrical Engineering Department Ahmedabad , Gujarat.
Interfacing Stepper motor to 8051 microcontroller A stepper motor is a special type of electric motor that moves in increments, or steps, rather than turning.
University of Tehran 1 Microprocessor System Design IO Applications Omid Fatemi
Timers /Counters Programming  The 8051 has 2 timers/counters: ○ timer/counter 0 ○ timer/counter 1 They can be used as 1. The timer is used as a time.
Chapter 10 Advanced Programming, PLC Interfacing, and Troubleshooting
8279 KEYBOARD AND DISPLAY INTERFACING
Applications of PPI Stepper Motors- D/A - A/D - Temperature Sensor.
STEPPER MOTORS Name: Mr.R.Anandaraj Designation: Associate. Professor Department: Electrical and Electronics Engineering Subject code :EC 6252 Year: II.
Projects 8051.
8279 KEYBOARD AND DISPLAY INTERFACING
UNIT-IV 8255 PPI Various Modes Of Operation Interfacing To 8086.
Stepper motor. Stepper Motor Interfacing Stepper motor is a widely used device that translates electrical pulses into mechanical movement. Stepper motor.
Interfacing Data Converters. D/A converters Design an O/P port with the address FFh to interface the 1408 D/A converter that is calibrated for 0 to 10V.
MICRO CONTROLLER PROGRAMMING & APPLICATIONS UNIT V Mr. S. VINOD LECTURER EEE DEPARTMENT.
Embedded Systems Design 1 Lecture Set C Interfacing the MCS-51 to: –D/A Converter –A/D Converter.
I/O Devices Switches, LED, LCD
PROJECT TITLE METRO TRAIN PROTOTYPE USING 8051 MICROCONTROLLER By-RAVI MUNDRA.
INTRODUCTION TO ROBOTICS Part 3: Propulsion System Robotics and Automation Copyright © Texas Education Agency, All rights reserved. 1.
DC motor principles Speed control Direction Stepper motor principles
WATER LEVEL INDICATOR AND AUTOMATIC MOTOR SWITCHING SYSTEM
CEng3361 CENG 336 INT. TO EMBEDDED SYSTEMS DEVELOPMENT Spring 2011 Recitation 06.
Electronic Devices and Circuit Theory
One area where in which microprocessor and microcomputers have a major impact is industrial processor control systems. Process control involves first.
Outline Introduction to digital-to-analog converter (DAC)
ARDUINO BASED AUTOMATIC TEMPERATURE BASED FAN SPEED CONTROLLER
Stepper Motor A stepper motor or step motor or stepping motor is a brushless DC electric motor that divides a full rotation into a number of equal steps.
LCD and Keyboard Interfacing
Interfacing of LCD with µP
Microprocessor Systems Design I
ADC Interfacing Source: In under
Microcontroller Bharat Sankhlecha
Parallel Port Interfacing
LCD and Keyboard Interfacing
Engineering 4862 Microprocessors Lecture 25
Created by Luis Chioye Presented by Cynthia Sosa
LCD and Keyboard Interfacing
LCD and Keyboard Interfacing
LCD and Keyboard Sepehr Naimi
LCD and Keyboard Interfacing
8253 – PROGRAMMABLE INTERVAL TIMER (PIT). What is a Timer? Timer is a specialized type of device that is used to measure timing intervals. Timers can.
PROCESSORS & CONTROLLERS
Presentation transcript:

Interfacing of 8051 UNIT 4

Contents Interfacing of 7 segment display, LCD and keyboard. Interfacing of DC motor, stepper motor and relay. Interfacing of ADC, DAC and sensors.

7 segment display

Interfacing of 7 segment display

7 segment code for CC DP G F E D C B A NUMBER 1 2 3

PROGRAM 7 SEGMENT DISPLAY To display ‘1’ MOV A,#06H MOV P1,A SJMP $

LCD Interfacing

Pin No: Name  Function 1 VSS This pin must be connected to the ground 2 VCC  Positive supply voltage pin (5V DC)      3 VEE Contrast adjustment 4 RS Register selection 5 R/W Read or write 6 E  Enable 7 DB0  Data 8 DB1 9 DB2 10 DB3 11 DB4 12 DB5 13 DB6 14 DB7 15 LED+  Back light LED+ 16 LED-  Back light LED- 

4 Decrement cursor (shift cursor to left) 1        Clear display screen 2        Return Home 4        Decrement cursor (shift cursor to left) 5        Increment cursor (shift cursor to right) 6        shift display right 7        shift display left 8        Display off, cursor off A        Display off, cursor on C        Display on, cursor off E        Display on, cursor blinking F        Display on, cursor blinking 10        Shift cursor position to left 14        Shift cursor position to right 18        Shift the entire display to the left 1C        Shift the entire display to the right 80        Force cursor to the beginning of 1st line C0        Force cursor to the beginning of 2nd line 38        2 lines and 5 x 7 matrix

Interface Program MOV A,#38H // Use 2 lines and 5x7 matrix ACALL CMND MOV A,#0FH // LCD ON, cursor ON, cursor blinking ON ACALL CMND MOV A,#01H //Clear screen ACALL CMND MOV A,#06H //Increment cursor ACALL CMND MOV A,#82H //Cursor line one , position 2 ACALL CMND MOV A,#3CH //Activate second line ACALL CMND MOV A,#’W’ ACALL DISP MOV A,#’E’ ACALL DISP MOV A,#’L’ ACALL DISP MOV A,#’C’ ACALL DISP MOV A,#O ACALL DISP MOV A,#’M’ ACALL DISP MOV A,#’E’ ACALL DISP

CMND: MOV P1,A CLR P3.5 CLR P3.4 SETB P3.3 CLR P3.3 ACALL DELY RET; DISP:MOV P1,A SETB P3.5 CLR P3.4 SETB P3.3 CLR P3.3 ACALL DELY RET;

DELY: MOV R0,#0FFH HERE: DJNZ R0, HERE RET; Subroutine CMND sets the logic of the RS, R/W, E pins of the LCD module so that the module recognizes the input data ( given to DB0 to DB7) as a command. Subroutine DISP sets the logic of the RS, R/W, E pins of the module so that the module recognizes the input data as a data to be displayed .

8051 & dc motor interface

ORG 00H // initial starting address MAIN: MOV P1,#00000001B // motor runs clockwise ACALL DELAY // calls the 1S DELAY MOV P1,#00000010B // motor runs anti clockwise ACALL DELAY // calls the 1S DELAY SJMP MAIN // jumps to label MAIN for repeating the cycle DELAY: MOV R4,#0FH WAIT1: MOV R3,#0FFH WAIT2: MOV R2,#0FFH WAIT3: DJNZ R2,WAIT3 DJNZ R3,WAIT2 DJNZ R4,WAIT1 RET END

Stepper Motor Interfacing What is stepper motor? Stepper motors consist of a permanent magnetic rotating shaft, called the rotor, and electromagnets on the stationary portion that surrounds the motor, called the stator. a motor with a resolution of 5 degrees would move its rotor 5 degrees per step, thereby requiring 72 pulses (steps) to complete a full 360 degree rotation.

Stepper motor operation

At position 1, we can see that the rotor is beginning at the upper electromagnet, which is currently active (has voltage applied to it). To move the rotor clockwise (CW), the upper electromagnet is deactivated and the right electromagnet is activated, causing the rotor to move 90 degrees CW, aligning itself with the active magnet. This process is repeated in the same manner at the south and west electromagnets until we once again reach the starting position.

In the above example, we used a motor with a resolution of 90 degrees or demonstration purposes. In reality, this would not be a very practical motor for most applications. The average stepper motor's resolution -- the amount of degrees rotated per pulse is much higher than this. You may double the resolution of some motors by a process known as "half-stepping".

Instead of switching the next electromagnet in the rotation on one at a time, with half stepping you turn on both electromagnets, causing an equal attraction between, thereby doubling the resolution. Both the top and right electromagnets are active, causing the rotor to position itself between the two active poles

Sequence Polarity Name Description 0001 0010 0100 1000 ---+ --+- -+-- +--- Wave Drive, One-Phase Consumes the least power. Only one phase is energized at a time. Assures positional accuracy regardless of any winding imbalance in the motor. 0011 0110 1100 1001 --++ -++- ++-- +--+ Hi-Torque, Two-Phase Hi Torque - This sequence energizes two adjacent phases, which offers an improved torque-speed product and greater holding torque.

---+ --++ --+- -++- -+-- ++-- +--- +--+ 0001 0011 0010 0110 0100 1100 1000 1001 ---+ --++ --+- -++- -+-- ++-- +--- +--+ Half-Step Half Step - Effectively doubles the stepping resolution of the motor, but the torque is not uniform for each step.  (Since we are effectively switching between Wave Drive and Hi-Torque with each step, torque alternates each step.)  This sequence reduces motor resonance which can sometimes cause a motor to stall at a particular resonant frequency.  Note that this sequence is 8 steps.

Stepper motor programming org 0H stepper equ P3 main: mov stepper, #0CH acall delay mov stepper, #06H acall delay mov stepper, #03H acall delay mov stepper, #09H acall delay sjmp main delay: mov r7,#4 wait2: mov r6,#0FFH wait1: mov r5,#0FFH wait: djnz r5,wait djnz r6,wait1 djnz r7,wait2 ret

Analog to Digital Converter Commonly used ADC device – ADC804 Pin out of ADC CS – Chip Select , active low RD – Read Digital data from ADC, H-L edge triggered WR -- Start conversion, L-H pulse edge triggered INTR -- end of conversion, Goes low to indicate conversion done Data bits -- D0-D7  CLK IN & CLK R –  CLK IN is an input pin connected to an external clock source when an external clock is used for timing. However, ADC804 has an internal clock generator. To use the internal clock generator of the ADC804, the CLK IN and CLK R pins are connected to a capacitor and a resistor. In that case, the  clock frequency is determined by the equation.    f = 1/1.1RC    R=10K and C=150pF f=606Hz    the conversion time is 110us. 

Input Voltage range of ADC Vref/2 (Volts) Vin Step size (mV) Open (2.5) 0 to 5 5/256 = 19.53 2.56 0 to 5.12 5.12/256 =20 1.28 0 to 2.56 2.56/256 = 10 0.5 0 to 1 1/256=3.90

Default 0-5V. Can be changed by setting different value for Vref/2 pin Default 0-5V. Can be changed by setting different value for Vref/2 pin.    Vin=Vin(+) – Vin (-) Range = 0 to 2x Vref/2.     for Vin = 2x Vref/2. we get 256 as a digital output on D0-D7 Step Size a Smallest change – (2 x Vref/2)/ 256 for ADC804 for eg for  step size 10mv ,digital output on D0-D7 changes by one count for every 10mv change of  the input analog voltage.

Algorithm • Make CS=0 and send a low-to-high to pin WR to start the conversion. • Keep monitoring INTR – If INTR =0, the conversion is finished and we can go to the next step. – If INTR=1, keep polling until it goes low. • After INTR=0, we make CS=0 and send a high-to-low pulse to RD to get the data out of the ADC804 chip.

ADC Interfacing

ADC_IO: mov P1, #0xff ; To configure as input setb p3.4 clr p3.7 ;Chip select AGAIN setb P3.6 ;RD=1 clr P3.5 ;WR=0 setb P3.5 ;WR=1- low to high transition WAIT:  jb P3.4, WAIT ;wait for INTR clr P3.6 ;RD=0 -High to low transition mov A, P1 ;read digital o/p sjmp AGAIN

DAC Interfacing

Iout= Iref (D7/2+D6/4+D5/8+D4/16+D3/32+D2/64+D1/128+D0/256) Vout=Iout x R

Interfacing of Relay with 8051

Interfacing LDR with 8051