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-4-lab4b:start [2017/03/22 16:48] – [2. Basis Knowledge] Marthalearn:courses:unit-4-lab4b:start [2022/10/04 11:38] (current) – external edit 127.0.0.1
Line 1: Line 1:
 ====== Lab 4b: Application of Asynchronous Serial Communications Protocol for Real-time Control ====== ====== Lab 4b: Application of Asynchronous Serial Communications Protocol for Real-time Control ======
 +[[{}/learn/courses/unit-4-1/start|Back to Unit 4 Part 1]]
 +[[{}/learn/courses/unit-4-2/start|Back to Unit 4 Part 2]]
 +[[{}/learn/courses/unit-4-lab4a/start|Back to Lab 4a]]
  
 === Download This Document === === Download This Document ===
-  * {{ :learn:courses:unit-4-lab4b:lab_4b.pdf |Lab 4b PDF}}+{{ :learn:courses:unit-4-lab4b:lab_4b.pdf |Lab 4b PDF}}
  
 ===== 1. Objectives ===== ===== 1. Objectives =====
-  * To control and monitor the operations of a stepper motor using serial communications between a PIC32 microprocessor and a computer terminal. +  - To control and monitor the operations of a stepper motor using serial communications between a PIC32 microprocessor and a computer terminal. 
-  * To implement real-time control using a preemptive foreground-background task scheduling scheme. +  - To implement real-time control using a preemptive foreground-background task scheduling scheme. 
-  * Simulate an environment that provides both local and remote control of a real-time system.+  - Simulate an environment that provides both local and remote control of a real-time system.
  
  
Line 13: Line 16:
  
 ===== 2. Basic Knowledge ===== ===== 2. Basic Knowledge =====
-  * Elements of [[https://en.wikipedia.org/wiki/ASCII|ASCII text encoding]]. +  - Elements of [[https://en.wikipedia.org/wiki/ASCII|ASCII text encoding]]. 
-  * [[http://ww1.microchip.com/downloads/en/DeviceDoc/39711b.pdf|I/O configuration for PPS Processors]]. +  - [[http://ww1.microchip.com/downloads/en/DeviceDoc/39711b.pdf|I/O configuration for PPS Processors]]. 
-  * [[http://www.microchip.com/SWLibraryWeb/product.aspx?product=PIC32%20Peripheral%20Library|How to initialize special function using the PLIB functions]]. +  - [[http://www.microchip.com/SWLibraryWeb/product.aspx?product=PIC32%20Peripheral%20Library|How to initialize special function using the PLIB functions]]. 
-  * How to program the PIC32 processor to both generate and receive and decode serial text data.+  - How to program the PIC32 processor to both generate and receive and decode serial text data.
  
  
Line 23: Line 26:
 ===== 3. Equipment List ===== ===== 3. Equipment List =====
 ==== 3.1. Hardware ==== ==== 3.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]] 
-  * 4-wire stepper motor +  - [[https://digilent.com/shop/stepper-motor/|4-wire stepper motor]] 
-  * [[http://store.digilentinc.com/5v-2-5a-switching-power-supply/|5V, 2.5A DC power supply]]+  - [[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://www.digilentinc.com/Products/Detail.cfm?NavPath=2,842,1018&Prod=ANALOG-DISCOVERY|Digilent Analog Discovery 2]]+  - [[http://www.digilentinc.com/Products/Detail.cfm?NavPath=2,842,1018&Prod=ANALOG-DISCOVERY|Digilent Analog Discovery 2]]
  
  
Line 36: Line 39:
 The following programs must be installed on your development work station: The following programs must be installed on your development work station:
  
-  * [[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]]  +  - [[https://digilent.com/shop/software/digilent-waveforms/|WaveForms]]  
-  * [[http://www.putty.org/|PuTTY Terminal Emulation]]+  - [[http://www.putty.org/|PuTTY Terminal Emulation]]
  
 ---- ----
  
 ===== 4. Project Takeaways ===== ===== 4. Project Takeaways =====
-  * Knowledge of a PC terminal emulation program. +  - Knowledge of a PC terminal emulation program. 
-  * How to develop a library of PIC32 software to provide bi-directional communications of single characters and strings of characters. +  - How to develop a library of PIC32 software to provide bi-directional communications of single characters and strings of characters. 
-  * How to generate and decode ASCII text strings. +  - How to generate and decode ASCII text strings. 
-  * How to implement a [[https://www.techopedia.com/definition/12829/human-machine-interface-hmi|human-machine interface]] (HMI) using [[https://en.wikipedia.org/wiki/Point-to-point_(telecommunications)|point-to-point]] serial communications.+  - How to implement a [[https://www.techopedia.com/definition/12829/human-machine-interface-hmi|human-machine interface]] (HMI) using [[https://en.wikipedia.org/wiki/Point-to-point_(telecommunications)|point-to-point]] serial communications.
  
  
Line 64: Line 67:
  
 ===== 7. Background Information ===== ===== 7. Background Information =====
-[[https://reference.digilentinc.com/learn/courses/unit-4-lab4a/start|Lab 4a]] introduced the basic concepts of UARTs and asynchronous serial communications. Lab 4b extends that knowledge by specifying a system that is capable of two independent control and monitoring locations which is common to many industrial applications, such as gantry cranes and processing plants. In this lab, the switches and push buttons on the Basys MX3, as used in lab 2b, will perform the local control functions. The Basys MX3 LCD will be used as the local display. The UART serial connection will provide the basic control and display functionality using a workstation terminal emulator program. +[[/learn/courses/unit-4-lab4a/start|Lab 4a]] introduced the basic concepts of UARTs and asynchronous serial communications. Lab 4b extends that knowledge by specifying a system that is capable of two independent control and monitoring locations which is common to many industrial applications, such as gantry cranes and processing plants. In this lab, the switches and push buttons on the Basys MX3, as used in lab 2b, will perform the local control functions. The Basys MX3 LCD will be used as the local display. The UART serial connection will provide the basic control and display functionality using a workstation terminal emulator program. 
  
 ---- ----
Line 112: Line 115:
  
 ===== 9. Questions ===== ===== 9. Questions =====
-1. Why is it appropriate that the UART getstrU1 function be a background process?\\ +1. Why is it appropriate that the UART getstrU4 function be a background process?\\
- +
-<color #ed1c24>ANSWER: The data rate is 19200 (with parity), so the maximum speed that a new character can be received is 1745 characters per second, or once every 0.57ms. However, the characters are sent at the speed of the person typing on the terminal keyboard. A professional typist is capable of up to 60 words per minute. Using a conversion factor of five characters per word, the effective data rate is 50 bits per second or a byte of new data each 20ms.  The delay in the button de-bounce function is 20ms.  Hence it would be possible for data byes to be missed for fast terminal operators. This does not include other tasks that the processor must complete in response to the serial data and periodic interrupts.\\ +
-\\ +
-If the communications is being generated automatically and can be sent at the maximum speed, getstrU1 should be modified to generate an interrupt whenever a new byte of data is received. A flag will still be needed to indicate when the text string is completely received and is ready for processing. +
-</color>\\+
  
 2. What are the advantages of using serial communications to link to processors?\\ 2. What are the advantages of using serial communications to link to processors?\\
- 
-<color #ed1c24>ANSWER: \\ 
-1. Simultaneous (full duplex) communications\\ 
-2. Requires less I/O pins and three wires - (Tx, Rx and the common electrical reference)\\ 
-3. Handshaking handled in hardware\\ 
-4. Common protocol\\ 
-5. Supported in most modern processors\\ 
-6. Longer distance communications\\ 
-</color>\\ 
  
 3. What are the disadvantages of using serial communications to link to processors?\\ 3. What are the disadvantages of using serial communications to link to processors?\\
  
-<color #ed1c24>ANSWER:\\  
-1. Slower speed\\ 
-2. Additional processor hardware\\ 
-</color>\\ 
  
 ---- ----
Line 149: Line 134:
  
 ===== Appendix A: Basys MX3 Schematic Drawings ===== ===== Appendix A: Basys MX3 Schematic Drawings =====
-{{ :learn:courses:unit-4-lab4a:fig-a-1.png?nolink&700 |Figure A.1. PIC32MX370 to FT232RQR IC schematic diagram.}}+{{ :learn:courses:unit-4-lab4b:lab_4b_fig_a_1.jpg?nolink&900 |Figure A.1. PIC32MX370 to FT232RQR IC schematic diagram.}}
 //Figure A.1. PIC32MX370 to FT232RQR IC schematic diagram.// //Figure A.1. PIC32MX370 to FT232RQR IC schematic diagram.//
  
Line 169: Line 154:
 {{ :learn:courses:unit-4-lab4a:fig-b-1.png?nolink&700 |Figure B.1. Allocating Heap size.}} {{ :learn:courses:unit-4-lab4a:fig-b-1.png?nolink&700 |Figure B.1. Allocating Heap size.}}
 //Figure B.1. Allocating Heap size.// //Figure B.1. Allocating Heap size.//
 +
 +----
 +
 +[[{}/learn/courses/unit-4-1/start|Back to Unit 4 Part 1]]
 +[[{}/learn/courses/unit-4-2/start|Back to Unit 4 Part 2]]
 +[[{}/learn/courses/unit-4-lab4a/start|Back to Lab 4a]]
 +[[{}/learn/courses/unit-4-lab4c/start|Go to Lab 4c]]
 +[[{}/learn/courses/unit-4-lab4d/start|Go to Lab 4d]]
 +[[{}/learn/courses/unit-5/start|Go to Unit 5]]