Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
learn:courses:unit-6:start [2017/04/14 17:50] – [Listing 7.1. Configuring I/O pin RG9 for Input Capture] Marthalearn:courses:unit-6:start [2021/10/13 22:30] (current) Arthur Brown
Line 1: Line 1:
- ====== Unit 6: Analog I/O and Process Control ======+====== Unit 6: Analog I/O and Process Control ====== 
 +[[{}/learn/courses/unit-5/start|Back to Unit 5]] 
 === Unit 6 Labs === === Unit 6 Labs ===
-  * [[https://reference.digilentinc.com/learn/courses/unit-6-lab6a/start|Lab 6a]] +  * [[/learn/courses/unit-6-lab6a/start|Lab 6a]] 
-  * [[https://reference.digilentinc.com/learn/courses/unit-6-lab6b/start|Lab 6b]]+  * [[/learn/courses/unit-6-lab6b/start|Lab 6b]]
  
  
 === Download This Document === === Download This Document ===
-  * {{ :learn:courses:unit-6:unit_6.pdf |Unit 6 PDF}}+{{ :learn:courses:unit-6:unit_6.pdf |Unit 6 PDF}}
  
  
Line 15: Line 17:
  
 ===== 2. Objectives ===== ===== 2. Objectives =====
-  Generate PWM outputs to implement variable motor supply voltage. +  Generate PWM outputs to implement variable motor supply voltage. 
-  Implement a tachometer operation using PIC32 Timers. +  Implement a tachometer operation using PIC32 Timers. 
-  Develop MPLAB X projects that implement open-loop and closed-loop motor control. +  Develop MPLAB X projects that implement open-loop and closed-loop motor control. 
-  Develop the C program code to implement a PI controller and a moving average digital filter. +  Develop the C program code to implement a PI controller and a moving average digital filter. 
-  Manage multiple background tasks in an interrupt driven system. +  Manage multiple background tasks in an interrupt driven system. 
-  To monitor and display data from a process running in real-time. +  To monitor and display data from a process running in real-time. 
  
 ---- ----
  
 ===== 3. Basic Knowledge ===== ===== 3. Basic Knowledge =====
-  Suggested reading: [[https://www.elsevier.com/books/embedded-computing-and-mechatronics-with-the-pic32-microcontroller/lynch/978-0-12-420165-1|Embedded Computing and Mechatronics with the PIC32 Microcontroller]]+  Suggested reading: [[https://www.elsevier.com/books/embedded-computing-and-mechatronics-with-the-pic32-microcontroller/lynch/978-0-12-420165-1|Embedded Computing and Mechatronics with the PIC32 Microcontroller]]
     * Basic circuit theory     * Basic circuit theory
     * Fundamentals of programming with C     * Fundamentals of programming with C
-  How to configure I/O pins on a Microchip® PIC32 PPS microprocessor  +  How to configure I/O pins on a Microchip® PIC32 PPS microprocessor  
-  How to implement a real-time system using preemptive foreground – background task control +  How to implement a real-time system using preemptive foreground – background task control 
-  How to generate a PWM output with the PIC32 processor +  How to generate a PWM output with the PIC32 processor 
-  How to configure the Analog Discovery to display logic traces +  How to configure the Analog Discovery to display logic traces 
-  How to implement the design process for embedded processor based systems+  How to implement the design process for embedded processor based systems
  
 ---- ----
Line 38: Line 40:
 ===== 4. Equipment List ===== ===== 4. Equipment List =====
 ==== 4.1. Hardware ==== ==== 4.1. Hardware ====
-  [[http://store.digilentinc.com/basys-mx3-pic32mx-trainer-board-recommended-for-embedded-systems-courses/|Basys MX3 trainer board]] +  [[https://digilent.com/shop/basys-mx3-pic32mx-trainer-board-for-embedded-systems-courses/|Basys MX3 trainer board]] 
-  Workstation computer running Windows 10 or higher, MAC OS, or Linux +  Workstation computer running Windows 10 or higher, MAC OS, or Linux 
-  2 [[http://store.digilentinc.com/usb-a-to-micro-b-cable/|Standard USB A to micro-B cables]] +  2 [[https://digilent.com/shop/usb-a-to-micro-b-cable/|Standard USB A to micro-B cables]] 
-  [[http://store.digilentinc.com/motor-gearbox-1-19-gear-ratio-custom-12v-motor-designed-for-digilent-robot-kits/|V DC motor with tachometer]]+  [[https://digilent.com/shop/dc-motor-gearbox-1-19-gear-ratio-custom-12v-motor-designed-for-digilent-robot-kits/|12 V DC motor with tachometer]] 
 +  - [[https://digilent.com/shop/5v-4a-switching-power-supply/|5V, 4A DC power supply]]
  
 In addition, we suggest the following instruments: In addition, we suggest the following instruments:
-  [[http://store.digilentinc.com/analog-discovery-2-100msps-usb-oscilloscope-logic-analyzer-and-variable-power-supply/|Analog Discovery 2]]+  [[https://digilent.com/shop/analog-discovery-2-100ms-s-usb-oscilloscope-logic-analyzer-and-variable-power-supply/|Analog Discovery 2]]
  
 ==== 4.2. Software ==== ==== 4.2. Software ====
 The following programs must be installed on your development workstation: The following programs must be installed on your development workstation:
-  [[http://www.microchip.com/mplab/mplab-x-ide|Microchip MPLAB X® v3.35 or higher]] +  [[http://www.microchip.com/mplab/mplab-x-ide|Microchip MPLAB X® v3.35 or higher]] 
-  [[http://www.microchip.com/SWLibraryWeb/product.aspx?product=PIC32%20Peripheral%20Library|PLIB Peripheral Library]] +  [[http://www.microchip.com/SWLibraryWeb/product.aspx?product=PIC32%20Peripheral%20Library|PLIB Peripheral Library]] 
-  [[http://www.microchip.com/xcdemo/xcpluspromo.aspx|XC32 Cross Compiler]] +  [[http://www.microchip.com/xcdemo/xcpluspromo.aspx|XC32 Cross Compiler]] 
-  [[http://store.digilentinc.com/waveforms-2015-download-only/|WaveForms 2015]] (if using the Analog Discovery 2) +  [[https://digilent.com/shop/software/digilent-waveforms/|WaveForms]] (if using the Analog Discovery 2) 
-  [[http://www.putty.org/|PuTTY Terminal Emulator]] +  [[http://www.putty.org/|PuTTY Terminal Emulator]] 
-  Spreadsheet application (such as Microsoft Excel)+  Spreadsheet application (such as Microsoft Excel)
  
 ---- ----
  
 ===== 5. Project Takeaways ===== ===== 5. Project Takeaways =====
-  How to read analog voltage with a PIC32 processor. +  How to read analog voltage with a PIC32 processor. 
-  How to use the PIC32 Output Compare to implement a PWM analog output. +  How to use the PIC32 Output Compare to implement a PWM analog output. 
-  How to use the PIC32 Input Capture period measurement to implement a tachometer. +  How to use the PIC32 Input Capture period measurement to implement a tachometer. 
-  The advantages of using period measurements as opposed to frequency measurements and vice versa. +  The advantages of using period measurements as opposed to frequency measurements and vice versa. 
-  Fundamental digital filtering concepts for data smoothing. +  Fundamental digital filtering concepts for data smoothing. 
-  Open-loop and closed-loop process control.+  Open-loop and closed-loop process control.
  
 ---- ----
Line 201: Line 204:
  
 === 7.2.2. Analog Output: Pulse-width Modulation === === 7.2.2. Analog Output: Pulse-width Modulation ===
-In [[https://reference.digilentinc.com/learn/courses/unit-5-lab5a/start|Lab 5]], we used [[https://en.wikipedia.org/wiki/Pulse-width_modulation|pulse-width modulation]] to generate a communications signal of a constant frequency pulse train where the carrier frequency was turned on by setting the PWM output ratio to 9%, and off by setting the output PWM ratio to 100%. The information used to modulate the IR beam is contained in the amplitude modulation of the PWM carrier signal. In Labs 6a and 6b, the information is contained in the duty cycle of the PWM signal, which is a form of frequency modulation. This signal will be demodulated with low pass filtering to generate an analog control signal.+In [[/learn/courses/unit-5-lab5a/start|Lab 5]], we used [[https://en.wikipedia.org/wiki/Pulse-width_modulation|pulse-width modulation]] to generate a communications signal of a constant frequency pulse train where the carrier frequency was turned on by setting the PWM output ratio to 9%, and off by setting the output PWM ratio to 100%. The information used to modulate the IR beam is contained in the amplitude modulation of the PWM carrier signal. In Labs 6a and 6b, the information is contained in the duty cycle of the PWM signal, which is a form of frequency modulation. This signal will be demodulated with low pass filtering to generate an analog control signal.
      
 Lab 5 discussed the details of how to set up a PWM output using the output compare special function of the PIC32 processor. However, Lab 6a and 6b will require that we set up two PWM outputs that all use a common timer if the motor is to be capable of reversing direction. After initializing the timer to be used with the output compare and initializing the two output-compare channels, the PWM duty cycle of each individual channel is easily changed using the instruction //SetDCOCxPWM(DC);// where x denotes the PWM channel and DC is the compare setting. DC is computed by multiplying timer period register by the percent PWM. Provided that the two instructions used to modify the PWM duty cycle are completed within the PWM period, both outputs will simultaneously change their duty cycle at the end of the next PWM period.    Lab 5 discussed the details of how to set up a PWM output using the output compare special function of the PIC32 processor. However, Lab 6a and 6b will require that we set up two PWM outputs that all use a common timer if the motor is to be capable of reversing direction. After initializing the timer to be used with the output compare and initializing the two output-compare channels, the PWM duty cycle of each individual channel is easily changed using the instruction //SetDCOCxPWM(DC);// where x denotes the PWM channel and DC is the compare setting. DC is computed by multiplying timer period register by the percent PWM. Provided that the two instructions used to modify the PWM duty cycle are completed within the PWM period, both outputs will simultaneously change their duty cycle at the end of the next PWM period.   
Line 387: Line 390:
  
  
 +----
 +
 +[[{}/learn/courses/unit-5/start|Back to Unit 5]]
 +[[{}/learn/courses/unit-6-lab6a/start|Go to Lab 6a]]
 +[[{}/learn/courses/unit-6-lab6b/start|Go to Lab 6b]]
 +[[{}/learn/courses/unit-7/start|Go to Unit 7]]
  
 {{tag>reference learn microprocessor courses basys-mx3}} {{tag>reference learn microprocessor courses basys-mx3}}