Introduction and Aims
In this lab you will command the velocity of a motor. Figure 1 shows the hardware apparatus. which is the same as for Week 1 of Lab 4. You will utilize the potentiometer on your rating board to put the coveted velocity of the motor. and you will command the velocity through the PWM end product of the HCS12. You will mensurate the velocity of the motor utilizing an input gaining control pin. and expose the coveted and existent velocities on the terminus. .
1. The Lab
It is up to you how you design the system to carry through the end of this lab. however. here are some guidelines to help you in guaranting proper operation of the system. 1. Construct the circuit shown in Figure 1. 2. Plan a real-time modus operandi that gets executed every 8ms. Develop a method to verify the timing of that modus operandi. e. g. . increment LEDs. 3. Program the A/D convertor to read the value from the pot either the 1 on the microcontroller board or an external 1. In the modus operandi developed in Part 1. read the A/D convertor ( use 8-bit manner ) . Again develop a method to expose the consequences and verify the operation of the A/D convertor as you change the input electromotive force.
4. Put up the PWM to bring forth a 50 kilohertz PWM signal on one of the four PWM channels. Put it up for high mutual opposition. It will be easiest to put PWPERx to 255. Verify that the PWM plants. In the real-time modus operandi. compose the eight most important spots to the A/D value you read to PWDTYx. The motor velocity should alter as you use the pot to change the electromotive force on the A/D. 5. Measure the velocity of the motor by finding the clip between two falling borders of the optical encoder. In your chief plan show this clip on the LCD show. You can utilize drifting point arithmetic to change over this clip into RPM. Display the RPM value on the LCD show. What is the maximal motor velocity? 6. Measure the velocity for several different responsibility rhythms by changing the electromotive force with the pot. Plot speed vs. responsibility rhythm.
New Mexico Tech
Figure 1: Using a PWM signal to set the velocity of a motor.
7. Implement closed-loop velocity control. The coveted velocity Sd should be Sd = ( 0. 2 + 0. 8· ( AD/ADmax ) ) ·Smax where Smax is the motor velocity at 100 % responsibility rhythm. AD is the A/D convertor reading and ADmax is the maximal A/D convertor reading. In this manner you will be able to change the velocity between 20 % and 100 % of Smax.
New Mexico Tech
To put the motor at the coveted velocity you can utilize a simple equation ( built-in control ) such as: DCnew = DCold + k· ( Sd ? Sm ) where Sm is the mensural velocity. Make this computation inside the real-time modus operandi. and compose the new value to PWDTYx. Try different values of K to see how the motor responds. If K is excessively little. it will take a long clip for the motor to acquire to its steady-state velocity. If K is excessively big. the motor will be arrhythmic as it tries to settle down to its steady-state velocity. It will be much easier to make these computations utilizing drifting point Numberss instead than utilizing whole numbers. 8. Put the power electromotive force to 15V. Measure the motor velocity for assorted values of input electromotive force to the A/D convertor. Take about 10 equally-spaced measurings for input electromotive force between 0 and 5 V. Use the LCD show to demo the natural A/D value and the natural counts between borders on the first line. and demo the coveted and existent velocities on the 2nd line.
9. With the pot set at about mid-range. vary the electromotive force of the electromotive force powering the motor ( say between 8V and 14V ) . With closed-loop control the velocity of the motor should remain the same. Verify that this is the instance. 10. Using the information from Part 8. secret plan the velocity in RPM vs. the input electromotive force from the pot. i. e. . change over the velocity measuring in clip difference between two falling borders to rush in RPM. 11. It is much more effectual if you have the informations from the old portion recorded automatically. this manner you can detect the behaviour of the accountant and how long it takes to do the motor settee at the right velocity. To make that alter the BAUD rate to 115. 200 so one time every 8ms send the input gaining control difference to the consecutive port. Set Hyperterm to utilize 115. 200 baud rate. gaining control the consecutive informations and secret plan in MATLAB. Set the power electromotive force back to 15V.
Rather than changing the PWM based on the pot. put it manually inside your codification for a piece and so alter it to different value. this will make a measure alteration in the coveted set value. and can be used to find the effectivity of the accountant. 12. Another type of accountant that may be used is known as relative accountant. This type of accountant. and unlike the built-in type control. merely uses the current measurings to put the end product instead than roll uping any history. This is accomplished by DCnew = k· ( Sd ? Sm )
New Mexico Tech
Similar to the old measure. roll up the informations due to a measure alteration in the coveted velocity. and secret plan in MATLAB. Compare this relative accountant to the built-in accountant.