Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| learn:courses:unit-6-lab6a:start [2017/03/28 21:00] – [8.4. Testing] Martha | learn:courses:unit-6-lab6a:start [2022/10/04 11:38] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Lab 6a: Open-loop Process Control ====== | ====== Lab 6a: Open-loop Process Control ====== | ||
| + | [[{}/ | ||
| === Download This Document === | === Download This Document === | ||
| - | * {{ : | + | {{ : |
| ===== 1. Objectives ===== | ===== 1. Objectives ===== | ||
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| Line 17: | Line 18: | ||
| ===== 2. Basic Knowledge ===== | ===== 2. Basic Knowledge ===== | ||
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| Line 28: | Line 29: | ||
| ===== 3. Equipment List ===== | ===== 3. Equipment List ===== | ||
| ==== 3.1. Hardware ==== | ==== 3.1. Hardware ==== | ||
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| In addition, we suggest the following instruments: | In addition, we suggest the following instruments: | ||
| - | | + | |
| - | | + | |
| ==== 3.2. Software: ==== | ==== 3.2. Software: ==== | ||
| The following programs must be installed on your development workstation: | The following programs must be installed on your development workstation: | ||
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| Line 53: | Line 54: | ||
| ===== 4. Project Takeaways ===== | ===== 4. Project Takeaways ===== | ||
| - | | + | |
| - | | + | |
| - | | + | |
| - | | + | |
| Line 64: | Line 65: | ||
| [[https:// | [[https:// | ||
| - | {{ : | + | {{ : |
| //Figure 5.1. Open-loop motor control block diagram.// | //Figure 5.1. Open-loop motor control block diagram.// | ||
| + | |||
| ---- | ---- | ||
| Line 80: | Line 82: | ||
| The potentiometer labeled the Analog Input Control (R134) on the Basys MX3 trainer board, as shown in Fig. 7.1, will be used as the input for controlling the motor speed. The potentiometer wiper terminal is connected to the PIC32MX370 processor Port B pin 2. Using the PIC32 analog-to-digital converter (ADC) is rather straightforward with the aid of the example code provided by the MPLAB X Help for the XC32 Peripheral Libraries. Listing B.1 in Appendix B shows how to initialize an ADC channel to continuously sample and convert analog data. Listing B.2 is example code to read the most recent ADC conversion and call functions to set the motor direction of rotation and speed. The motor control is discussed in section 7.4 below. | The potentiometer labeled the Analog Input Control (R134) on the Basys MX3 trainer board, as shown in Fig. 7.1, will be used as the input for controlling the motor speed. The potentiometer wiper terminal is connected to the PIC32MX370 processor Port B pin 2. Using the PIC32 analog-to-digital converter (ADC) is rather straightforward with the aid of the example code provided by the MPLAB X Help for the XC32 Peripheral Libraries. Listing B.1 in Appendix B shows how to initialize an ADC channel to continuously sample and convert analog data. Listing B.2 is example code to read the most recent ADC conversion and call functions to set the motor direction of rotation and speed. The motor control is discussed in section 7.4 below. | ||
| - | {{ : | + | {{ : |
| //Figure 7.1. Analog Input Control schematic diagram.// | //Figure 7.1. Analog Input Control schematic diagram.// | ||
| + | |||
| ==== 7.2. Motor Speed Indication ==== | ==== 7.2. Motor Speed Indication ==== | ||
| Line 97: | Line 100: | ||
| In this lab we will be using a [[https:// | In this lab we will be using a [[https:// | ||
| - | {{ : | + | {{ : |
| //Figure 7.2. DC Motor with digital tachometer.// | //Figure 7.2. DC Motor with digital tachometer.// | ||
| Line 103: | Line 106: | ||
| - | {{ : | + | {{ : |
| //Figure 7.3. Basys MX3 Motor driver circuit.// | //Figure 7.3. Basys MX3 Motor driver circuit.// | ||
| + | |||
| **Table 7.1. Motor driver IC7 connection to PIC32 processor.** | **Table 7.1. Motor driver IC7 connection to PIC32 processor.** | ||
| - | ^ Function | + | ^ Function |
| | AIN1 | 10 | RB3 | Motor Supply + | Red | | | AIN1 | 10 | RB3 | Motor Supply + | Red | | ||
| | BIN1 | 8 | RE9 | Not Used - Set to zero | | | | BIN1 | 8 | RE9 | Not Used - Set to zero | | | ||
| Line 133: | Line 137: | ||
| ---- | ---- | ||
| - | ===== Lab 6b ===== | + | ===== 8. Lab 6a ===== |
| ==== 8.1. Requirements ==== | ==== 8.1. Requirements ==== | ||
| - Phase 1: Background Tasks | - Phase 1: Background Tasks | ||
| Line 189: | Line 193: | ||
| - Phase 2 Construction | - Phase 2 Construction | ||
| - Attach the workstation monitor and launch the terminal emulator application. | - Attach the workstation monitor and launch the terminal emulator application. | ||
| - | - Port in the LCD code from [[https:// | + | - Port in the LCD code from [[/ |
| - | - Port the UART code from [[https:// | + | - Port the UART code from [[/ |
| - Modify the background task to update the LCD and UART once each 250 ms. | - Modify the background task to update the LCD and UART once each 250 ms. | ||
| Line 207: | Line 211: | ||
| - Plot the motor speed vs. percent PWM as demonstrated in Fig. 8.3. All motors have different power-speed characteristics. | - Plot the motor speed vs. percent PWM as demonstrated in Fig. 8.3. All motors have different power-speed characteristics. | ||
| - | {{ : | + | {{ : |
| //Figure 8.1. H-Bridge inputs for CW motor rotation for 60% PWM.// | //Figure 8.1. H-Bridge inputs for CW motor rotation for 60% PWM.// | ||
| - | {{ : | + | {{ : |
| //Figure 8.2. H-Bridge inputs for CCW motor rotation for 60% PWM.// | //Figure 8.2. H-Bridge inputs for CCW motor rotation for 60% PWM.// | ||
| + | |||
| {{ : | {{ : | ||
| Line 221: | Line 226: | ||
| ===== 9. Questions ===== | ===== 9. Questions ===== | ||
| 1. After plotting the data in Phase 2 testing part c, describe the resulting curve.\\ | 1. After plotting the data in Phase 2 testing part c, describe the resulting curve.\\ | ||
| - | |||
| - | <color # | ||
| - | The curve demonstrates that the faster the motor is turning; the more input power is required to increase the motor speed.</ | ||
| 2. Explain whether Input Capture, Timer 2, or Timer 3 should be set to the higher interrupt level.\\ | 2. Explain whether Input Capture, Timer 2, or Timer 3 should be set to the higher interrupt level.\\ | ||
| - | |||
| - | <color # | ||
| - | Timer 2 and Timer 3 have no effect on the PWM output operation hence the Input Capture, should have the highest interrupt priority.</ | ||
| 3. If Input Capture, Timer 2, and Timer 3 are set at the same priority level, explain which interrupt should be set to the higher sub interrupt level.\\ | 3. If Input Capture, Timer 2, and Timer 3 are set at the same priority level, explain which interrupt should be set to the higher sub interrupt level.\\ | ||
| - | |||
| - | <color # | ||
| - | The answer is essentially the same as for question 2.</ | ||
| 4. Explain the difference in interrupt operation between question 2 and question 3.\\ | 4. Explain the difference in interrupt operation between question 2 and question 3.\\ | ||
| - | |||
| - | <color # | ||
| - | The interrupt scheme described in question 2 results in nesting interrupts where interrupts can interrupt ISRs. The scheme described in question 3 describes the order of execution when multiple interrupts are simultaneously pending.</ | ||
| 5. Consider the case when the motor draws more current than can be supplied by a single H-Bridge driver and the outputs from A1 must be in parallel with B1 and A2 in parallel with B2. What effect on motor operations does changing the primary output compare registers (OCxR) instead of the secondary output compare registers (OCxRS)?\\ | 5. Consider the case when the motor draws more current than can be supplied by a single H-Bridge driver and the outputs from A1 must be in parallel with B1 and A2 in parallel with B2. What effect on motor operations does changing the primary output compare registers (OCxR) instead of the secondary output compare registers (OCxRS)?\\ | ||
| - | |||
| - | <color # | ||
| - | Setting the OCxR registers result in the PWM duty cycle being changes as soon as the timer matches the OCxR register value. Since the OCxR registers are set with individual code instructions, | ||
| - | |||
| - | Unless the OCxRS is set as well as the OCxR register, the OCxR register will be set to whatever value the OCxRS register is currently set to.\\ | ||
| - | |||
| - | By setting the OCxRS secondary registers, the changes of all PWM outputs are guaranteed to be delayed at least one PWM period. For the specified implementation, | ||
| ---- | ---- | ||
| Line 477: | Line 463: | ||
| } | } | ||
| </ | </ | ||
| + | |||
| + | ---- | ||
| + | |||
| + | [[{}/ | ||
| + | [[{}/ | ||
| + | [[{}/ | ||

