Presentation is loading. Please wait.

Presentation is loading. Please wait.

3-11-2015 1 Microprocessoren lesson 6. PWM /motor control/servo.

Similar presentations


Presentation on theme: "3-11-2015 1 Microprocessoren lesson 6. PWM /motor control/servo."— Presentation transcript:

1 3-11-2015 1 Microprocessoren lesson 6. PWM /motor control/servo

2 3-11-20152 PWM Power control: Motor control Light Dimmer Servo control Example applications PWM

3 3-11-20153 PWM 2

4 3-11-20154 PWM 3

5 3-11-2015 5 PWM 4 Equations

6 3-11-20156 Summary registers pwm

7 3-11-20157 PWM 5 setup 1. Configure the PWM pins P1A and P1B (and P1C and P1D, if used) as inputs by setting the corresponding TRISC bits. 2. Set the PWM period by loading the PR2 register. 3. Configure the ECCP module for the desired PWM mode and configuration by loading the CCP1CON register with the appropriate values: Select one of the available output configurations and direction with the P1M bits. Select the polarities of the PWM output signals with the CCP1M bits. 4. Set the PWM duty cycle by loading the CCPR1L register and CCP1CON bits. 5. For Half-bridge Output mode, set the dead band delay by loading PWM1CON with the appropriate value. 6. If auto-shutdown operation is required, load the ECCPAS register: Select the auto-shutdown sources using the ECCPAS bits. Select the shutdown states of the PWM output pins using PSSAC and PSSBD bits. Set the ECCPASE bit (ECCPAS ). Configure the comparators using the CMCON0 register (Register 8-1). Configure the comparator inputs as analog inputs. 7. If auto-restart operation is required, set the PRSEN bit (PWM1CON ). 8. Configure and start TMR2: Clear the TMR2 interrupt flag bit by clearing the TMR2IF bit (PIR1 ). Set the TMR2 prescale value by loading the T2CKPS bits (T2CON ). Enable Timer2 by setting the TMR2ON bit (T2CON ). 9. Enable PWM outputs after a new PWM cycle has started: Wait until TMR2 overflows (TMR2IF bit is set). Enable the CCP1/P1A, P1B, P1C and/or P1Dpin outputs by clearing the respective TRISCBits Clear the ECCPASE bit (ECCPAS ).

8 3-11-20158 Servo

9 3-11-20159 Servo 2 Controlled by sending a pulse of variable width Maximum and minimum pulse width to give the angle (1.5 ms neutral position) Repetition rate (20ms) The pulse must repeated till angle is reached, after that to stay in that position it has to repeated too < 1.5ms counterclockwise > 1.5 ms clockwise Pulse is generally between 1 and 2 ms Turn rate: time it takes from one position to another. This can take seconds.

10 3-11-201510 Servo 3

11 3-11-201511 Servo 4

12 3-11-201512 Servo specifications Control System: +Pulse Width Control 1500usec Neutral Required Pulse: 3-5 Volt Peak to Peak Square Wave Operating Voltage: 4.8-6.0 Volts Operating Temperature Range: -20 to +60 Degree C Operating Speed (4.8V): 0.16sec/60 degrees at no load Operating Speed (6.0V): 0.13sec/60 degrees at no load Stall Torque (4.8V): 76.37 oz/in. (5.5kg.cm) Stall Torque (6.0V): 94.43 oz/in. (6.8kg.cm) Operating Angle: 45 Deg. one side pulse traveling 400usec 360 Modifiable: Yes Direction: Clockwise/Pulse Traveling 1500 to 1900usec Current Drain (4.8V): 8.8mA/idle and 400mA no load operating Current Drain (6.0V): 9.1mA/idle and 500mA no load operating Dead Band Width: 8usec Motor Type: 3 Pole Ferrite Potentiometer Drive: Indirect Drive Bearing Type: Dual Ball Bearing Gear Type: 3 Metal Gears and 1 Resin Metal Gear Connector Wire Length: 11.81" (300mm) Dimensions: 1.59" x 0.77"x 1.48" (40.6 x 19.8 x 37.8mm) Weight: 1.94oz. (55.2g)

13 3-11-201513 Practical lesson 7 Choice 1 or 2 1.Write a program which turns over the analogue value of a pot meter into the speed of an engine using PWM. 2. Write a program which turns over the analogue value of a pot meter into the position of a servo- engine using PWM.. Assignment 6


Download ppt "3-11-2015 1 Microprocessoren lesson 6. PWM /motor control/servo."

Similar presentations


Ads by Google