1 / 16

Chapter 4 Standard Single Purpose Processors: Peripherals

Chapter 4 Standard Single Purpose Processors: Peripherals. Red A. Vd. 1. 16. Vm. White A’. A’. 2. 15. B. Yellow B. A. 3. 14. B’. Black B’. 4. 13. GND. GND. 5. 12. Bias’/Set. 6. 11. Phase A’. Clk. 7. 10. CW’/CCW. O|C. 8. 9.

sagira
Télécharger la présentation

Chapter 4 Standard Single Purpose Processors: Peripherals

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 4 Standard Single Purpose Processors: Peripherals

  2. Red A Vd 1 16 Vm White A’ A’ 2 15 B Yellow B A 3 14 B’ Black B’ 4 13 GND GND 5 12 Bias’/Set 6 11 Phase A’ Clk 7 10 CW’/CCW O|C 8 9 Full’/Half Step MC3479P Stepper motor controller • Stepper motor: rotates fixed number of degrees when given a “step” signal • In contrast, DC motor just rotates when power applied, coasts to stop • Rotation achieved by applying specific voltage sequence to coils • Controller greatly simplifies this

  3. Stepper Motor Operation

  4. MC3479P Stepper Motor Driver 8051 CW’/CCW P1.0 P1.1 10 7 B 15 B’ 14 CLK 2 A’ 3 A Stepper Motor The output pins on the stepper motor driver do not provide enough current to drive the stepper motor. To amplify the current, a buffer is needed. One possible implementation of the buffers is pictured to the left. Q1 is an MJE3055T NPN transistor and Q2 is an MJE2955T PNP transistor. A is connected to the 8051 microcontroller and B is connected to the stepper motor. Stepper motor with controller (driver) void main(void){ */turn the motor forward */ cw=0; /* set direction */ clk=0; /* pulse clock */ delay(); clk=1; /*turn the motor backwards */ cw=1; /* set direction */ clk=0; /* pulse clock */ delay(); clk=1; } /* main.c */ sbit clk=P1^1; sbit cw=P1^0; void delay(void){ int i, j; for (i=0; i<1000; i++) for ( j=0; j<50; j++) i = i + 0; }

  5. 8051 P2.4 P2.3 P2.2 P2.1 P2.0 GND/ +V Stepper Motor +V 1K Q1 +V B 1K A Q2 330 Stepper motor without controller (driver) /*main.c*/ sbit notA=P2^0; sbit isA=P2^1; sbit notB=P2^2; sbit isB=P2^3; sbit dir=P2^4; void delay(){ int a, b; for(a=0; a<5000; a++) for(b=0; b<10000; b++) a=a+0; } void move(int dir, int steps) { int y, z; /* clockwise movement */ if(dir == 1){ for(y=0; y<=steps; y++){ for(z=0; z<=19; z+4){ isA=lookup[z]; isB=lookup[z+1]; notA=lookup[z+2]; notB=lookup[z+3]; delay(); } } } /* counter clockwise movement */ if(dir==0){ for(y=0; y<=step; y++){ for(z=19; z>=0; z - 4){ isA=lookup[z]; isB=lookup[z-1]; notA=lookup[z -2]; notB=lookup[z-3]; delay( ); } } } } void main( ){ int z; int lookup[20] = { 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0 }; while(1){ /*move forward, 15 degrees (2 steps) */ move(1, 2); /* move backwards, 7.5 degrees (1step)*/ move(0, 1); } } A possible way to implement the buffers is located below. The 8051 alone cannot drive the stepper motor, so several transistors were added to increase the current going to the stepper motor. Q1 are MJE3055T NPN transistors and Q3 is an MJE2955T PNP transistor. A is connected to the 8051 microcontroller and B is connected to the stepper motor.

  6. Data conversion Interface circuits 􀂇 Anti-aliasing filter 􀂇 Sample-and-hold (S/H) circuit 􀂇 Analog-to-digital converter (ADC) 􀂇 Digital-to-analog converter (DAC) 􀂇 Reconstruction filter

  7. A/D and D/A transfer curves output Quantization error

  8. Vmax = 7.5V 4 4 1111 7.0V 1110 6.5V 1101 3 3 6.0V 1100 5.5V 1011 2 2 analog input (V) analog output (V) 5.0V 1010 4.5V 1001 1 1 4.0V 1000 3.5V 0111 time time 0110 3.0V t1 t2 t3 t4 t1 t2 t3 t4 2.5V 0101 0100 1000 0110 0101 0100 1000 0110 0101 2.0V 0100 Digital input Digital output 1.5V 0011 1.0V 0010 0.5V 0001 0V 0000 analog to digital digital to analog proportionality A/D and D/A conversion

  9. A/D Data Converters • Sigma Delta • High resolution, low-to-medium speed • Pipelined • Low-to-medium resolution, high speed • Flash • Low resolution, high speed • Successive approximation register (SAR) • Medium resolution, medium speed

  10. SAR A/D Converter VDAC Vref ¾ Vref ½ Vref Vin ¼ Vref 0 time bit 3=0 bit 2=1 bit 1=0 bit 0=1 (MSB) (LSB)

  11. 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 1 0 1 0 0 0 1 0 0 0 0 0 0 0 1 0 1 0 1 0 0 0 1 0 1 0 0 0 0 0 1 0 1 0 1 0 1 A/D conversion using successive approximation Given an analog input signal whose voltage should range from 0 to 15 volts, and an 8-bit digital encoding, calculate the correct encoding for 5 volts. Then trace the successive-approximation approach to find the correct encoding. 5/15 = d/(28-1) d= 85 Encoding: 01010101 Successive-approximation method ½(Vmax – Vmin) = 7.5 volts Vmax = 7.5 volts. ½(5.63 + 4.69) = 5.16 volts Vmax = 5.16 volts. ½(7.5 + 0) = 3.75 volts Vmin = 3.75 volts. ½(5.16 + 4.69) = 4.93 volts Vmin = 4.93 volts. ½(7.5 + 3.75) = 5.63 volts Vmax = 5.63 volts ½(5.16 + 4.93) = 5.05 volts Vmax = 5.05 volts. ½(5.63 + 3.75) = 4.69 volts Vmin = 4.69 volts. ½(5.05 + 4.93) = 4.99 volts

  12. Analog-to-digital converters Example: You have a 12 bit A/D and the range of the A/D is -1V to 1V. If the output of the A/D is: “001010111111” what analog voltage is at the input? We are trying to determine the analog input which is e. e/Vmax = d/(2n – 1) e/(1 – (-1)) = d/(2n – 1); note: the range is shifted by 1V d = “001010111111” = 703; n = 12; 2n = 4096; e/2 = 703/(4096 – 1) = 703/4095 = 0.1716722 e = 0.343345; shifted back e = -1 + 0.343345 = -0.656654

  13. Exercises • You have a 4-bit ADC which has an input range from 2V to 3V. It is sending the value “1110.” What is the analog input? Can you determine the tolerance (ie: accuracy) of you answer? • A 16 bit A/D with a 0 to 5V range has it’s 8 most significant bits connected to an 8 bit D/A with a range of 0 to 5V. If the input to the A/D is 3.700V what is the output of the D/A?

  14. Interface with the microcontroller fs Anti-alias filter Dout mp Vin ADC Sample and hold fs/2 EOC Vr+ Start Vr- Driver I+ IV Din I- mp DAC EOC Vr+ Start

  15. Real-time Clock (RTC) • Much like a digital wristwatch, keeps the time and date • Typically composed of a crystal-controlled oscillator, numerous cascaded counters and a battery backup • The crystal controlled oscillator generates a very consistent high frequency digital pulse that feeds the counters • Operation: • The 1st counter counts up to the oscillator frequency (Example: f = 32.768kHz, first counter counts 32768 or 215, corresponding to 1 sec) • At this point the 1st counter generates a pulse that feeds the 2nd counter that counts up to 59 and generates a pulse that feeds the 3rd counter • The 3rd counter counts up to 59 and so on... • The hour, date, month and year counters work in a similar fashion

  16. Real-time Clock • Provides a time-of-day clock and 100-year calendar with alarm features and battery operation. mp

More Related