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
Last revisionBoth sides next revision
learn:courses:microprocessor-io-lab-1b:start [2017/03/30 15:57] – [8.2. Project Requirements] Talesa Bleythinglearn:courses:microprocessor-io-lab-1b:start [2021/10/13 22:24] Arthur Brown
Line 1: Line 1:
-====== Lab 1b: Microprocessor IO ======+====== Lab 1b: Microprocessor I/O ====== 
 +[[{}/learn/courses/microprocessor-io-unit-1/start|Back to Unit 1]] 
 +[[{}/learn/courses/microprocessor-io-lab-1a/start|Back to Lab 1a]]
 == Download This Document == == Download This Document ==
-  * {{ :learn:courses:microprocessor-io-lab-1b:lab_1b.pdf |Lab 1b PDF}}+{{ :learn:courses:microprocessor-io-lab-1b:lab_1b.pdf |Lab 1b PDF}}
  
 ===== 1. Objectives ===== ===== 1. Objectives =====
Line 18: Line 20:
   - How to write a computer program using the [[http://www.tutorialspoint.com/cprogramming/index.htm|C language]].   - How to write a computer program using the [[http://www.tutorialspoint.com/cprogramming/index.htm|C language]].
   - How to launch a [[http://microchip.wikidot.com/tls0101:design-environment|Microchip MPLAB X]] project.   - How to launch a [[http://microchip.wikidot.com/tls0101:design-environment|Microchip MPLAB X]] project.
-  - How to configure the PIC32 I/O pins for digital input and output (See [[https://reference.digilentinc.com/learn/courses/microprocessor-io-lab-1a/start|Lab 1a]]).+  - How to configure the PIC32 I/O pins for digital input and output (See [[/learn/courses/microprocessor-io-lab-1a/start|Lab 1a]]).
  
  
Line 28: Line 30:
 ===== 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]] 
-  [[http://store.digilentinc.com/usb-a-to-micro-b-cable/|Standard USB A to micro-B cable]] +  [[https://digilent.com/shop/usb-a-to-micro-b-cable/|Standard USB A to micro-B cable]] 
-  Workstation computer running Windows 10 or higher, MAC OS, or Linux+  Workstation computer running Windows 10 or higher, MAC OS, or Linux
  
 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 110: Line 112:
 LATDCLR = BIT_7; // Segment F on LATDCLR = BIT_7; // Segment F on
 LATDCLR = BIT_13; // Segment G on LATDCLR = BIT_13; // Segment G on
-LATGSET = BIT_14; // Segment DP off+LATGSET = BIT_14; // Segment DP off
 LATBSET = BIT_12; // Display 0 off LATBSET = BIT_12; // Display 0 off
 LATBSET = BIT_13; // Display 1 off LATBSET = BIT_13; // Display 1 off
Line 125: Line 127:
  
 ==== 7.5. Persistence: Lighting the 7-Segment Display ==== ==== 7.5. Persistence: Lighting the 7-Segment Display ====
-The display in Fig. 8.2 appears to have LED segments in three digits simultaneously displayed. As just discussed, the cathodes of all four of the 7-segment LEDs are connected in parallel and the particular digit is selected by asserting the common anode pin high. In order to make the 4-digit display appear that all four LED digits are simultaneously on, one should make sure each digit is displayed for a minimum of 1 millisecond. Listing 7.2 provides a simple software delay. Since this delay is dependent on the speed of execution, the “ms_cnt” will need to be changed depending on the speed of the core frequency. For the example shown in Listing 7.2, the ms_cnt value of 1000 is set to generate a one ms delay when the core frequency is set to 80 MHz.+The display in Fig. 8.2 appears to have LED segments in three digits simultaneously displayed. As just discussed, the cathodes of all four of the 7-segment LEDs are connected in parallel and the particular digit is selected by asserting the common anode pin high. In order to make the 4-digit display appear that all four LED digits are simultaneously on, one should make sure each digit is displayed for a minimum of 1 millisecond. Listing 7.2 provides a simple software delay. Since this delay is dependent on the speed of execution, the “ms_cnt” will need to be changed depending on the speed of the core frequency. For the example shown in Listing 7.2, the ms_cnt value of 10000 is set to generate a one ms delay when the core frequency is set to 80 MHz.
  
 ---- ----
Line 133: Line 135:
 void sw_delay(int ms) void sw_delay(int ms)
 { {
-unsigned int ms_cnt; // 1 ms counter +unsigned int ms_cnt;        // 1 ms counter 
-    while(ms--) // ms loop counter+    while(ms--)     // ms loop counter
     {     {
-        ms_cnt = 10000; // Reset ms counter +        ms_cnt = 10000;     // Reset ms counter 
-        while(--ms_cnt); // wait for 1 ms+        while(--ms_cnt);    // wait for 1 ms
     }     }
 } }
Line 190: Line 192:
 //Figure 8.2. 4-digit 7-segment display.// //Figure 8.2. 4-digit 7-segment display.//
  
-{{ :learn:courses:microprocessor-io-lab-1b:unit_1_-_photo_4.jpg?nolink&400 |Figure 8.3. Operator assignments to push buttons.}}+{{ :learn:courses:microprocessor-io-lab-1b:unit_1_-_photo_4.1.jpg?nolink&400 |Figure 8.3. Operator assignments to push buttons.}}
 //Figure 8.3. Operator assignments to push buttons.// //Figure 8.3. Operator assignments to push buttons.//
  
Line 242: Line 244:
     - Consider the case when pin RF0 is programmed to be an input and the signal TRIG_1 is a digital output signal from an external device that is either 0 or 3.3V. What effect will pressing the BTNC button have on the processor RF0 pin when TRIG_1 is low and when it is high?     - Consider the case when pin RF0 is programmed to be an input and the signal TRIG_1 is a digital output signal from an external device that is either 0 or 3.3V. What effect will pressing the BTNC button have on the processor RF0 pin when TRIG_1 is low and when it is high?
     - Consider the case when pin RF0 is programmed to be an output and the signal TRIG_1 is a digital input signal to an external device. What effect will pressing the BTNC button have on the TRIG_1 signal when the RF0 output is low and when it is high?     - Consider the case when pin RF0 is programmed to be an output and the signal TRIG_1 is a digital input signal to an external device. What effect will pressing the BTNC button have on the TRIG_1 signal when the RF0 output is low and when it is high?
-  - Measure the loop execution time by toggling Pmod connector JA pin 1 at the start of the loop execution using the instruction LATCINC = 0x04. Connect a logic analyzer or oscilloscope probe to JA pin 1 and the ground or common connector to JA pin 5. The loop time is one half the period of the square wave generated at JA pin 1.  +  - Measure the loop execution time by toggling Pmod connector JA pin 1 at the start of the loop execution using the instruction LATCINV = 0x04. Connect a logic analyzer or oscilloscope probe to JA pin 1 and the ground or common connector to JA pin 5. The loop time is one half the period of the square wave generated at JA pin 1.  
     - What is this time?      - What is this time? 
     - Is this time expected?     - Is this time expected?
Line 256: Line 258:
  
 ====== Appendix A: Schematic Drawings ====== ====== Appendix A: Schematic Drawings ======
-{{ :learn:courses:microprocessor-io-lab-1b:figure-a-1.png?nolink |Figure A.1 Push button schematic diagram.}}+{{ :learn:courses:microprocessor-io-lab-1b:basys_mx3_schematic_buttons.png?nolink |Figure A.1 Push button schematic diagram.}}
 //Figure A.1 Push button schematic diagram.// //Figure A.1 Push button schematic diagram.//
  
-{{ :learn:courses:microprocessor-io-lab-1b:figure-a-2.png?nolink |Figure A.2 Schematic diagram of Basys MX3 slide switches.}}+{{ :learn:courses:microprocessor-io-lab-1b:basys_mx3_schematic_switches.png?nolink |Figure A.2 Schematic diagram of Basys MX3 slide switches.}}
 //Figure A.2 Schematic diagram of Basys MX3 slide switches.// //Figure A.2 Schematic diagram of Basys MX3 slide switches.//
  
-{{ :learn:courses:microprocessor-io-lab-1b:figure-a-3.png?nolink |Figure A.3 Four digit seven segment display schematic.}}+{{ :learn:courses:microprocessor-io-lab-1b:basys_mx3_schematic_ssd.png?nolink |Figure A.3 Four digit seven segment display schematic.}}
 //Figure A.3 Four digit seven segment display schematic.// //Figure A.3 Four digit seven segment display schematic.//
  
 +----
 +
 +[[{}/learn/courses/microprocessor-io-unit-1/start|Back to Unit 1]]
 +[[{}/learn/courses/unit-2/start|Go to Unit 2]]