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:microprocessor-io-lab-1a:start [2017/03/28 17:22] – [7.1. Control Registers] Talesa Bleythinglearn:courses:microprocessor-io-lab-1a:start [2022/10/04 11:38] (current) – external edit 127.0.0.1
Line 1: Line 1:
 ====== Lab 1a: Microprocessor IO ====== ====== Lab 1a: Microprocessor IO ======
 +[[{}/learn/courses/microprocessor-io-unit-1/start|Back to Unit 1]]
 == Download This Document == == Download This Document ==
-  * {{ :learn:courses:microprocessor-io-lab-1a:lab_1a.pdf |Lab 1a PDF}}+{{ :learn:courses:microprocessor-io-lab-1a:lab_1a.pdf |Lab 1a PDF}} 
  
  
Line 21: Line 22:
 ===== 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]]
  
 ==== 3.2. Software: ==== ==== 3.2. Software: ====
 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/xcdemo/xcpluspromo.aspx|XC32 Cross Compiler]] +  - [[http://www.microchip.com/xcdemo/xcpluspromo.aspx|XC32 Cross Compiler]] 
-  * [[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]]
  
  
Line 50: Line 51:
  
 ===== 6. Problem Statement ===== ===== 6. Problem Statement =====
-In this lab, you will be using specified switches to turn specified RED, BLUE, and GREEN colors of the tri-color LED8 either on or off using SW0, SW1, and SW2, respectively.+In this lab, you will turn the RED, BLUE, and GREEN colors of the tri-color LED8 either on or off using SW0, SW1, and SW2, respectively.
  
 ---- ----
Line 58: Line 59:
 In this lab, we will make use of the TRISx, LATx, and PORTx control registers. TRISx registers simply control the data direction flow through port I/O pins, e.g., whether a PORTx I/O pin is an input or an output. If the data direction bit is a “1,” then the corresponding PORTx I/O pin is an input, and vice versa.  In this lab, we will make use of the TRISx, LATx, and PORTx control registers. TRISx registers simply control the data direction flow through port I/O pins, e.g., whether a PORTx I/O pin is an input or an output. If the data direction bit is a “1,” then the corresponding PORTx I/O pin is an input, and vice versa. 
  
-LATx registers (PORTx data latch) hold data written to port I/O pins. A write to a LATx register latches data to the corresponding port I/O pins and those I/O port pins configured as outputs are updated. A read from a LATx resister reads the data held in the PORTx data latch, not directly from the port I/O pins (this distinction will come into play in [[https://reference.digilentinc.com/learn/courses/microprocessor-io-lab-1b/start|Lab 1b]]). +LATx registers (PORTx data latch) hold data written to port I/O pins. A write to a LATx register latches data to the corresponding port I/O pins and those I/O port pins configured as outputs are updated. A read from a LATx resister reads the data held in the PORTx data latch, not directly from the port I/O pins (this distinction will come into play in [[/learn/courses/microprocessor-io-lab-1b/start|Lab 1b]]). 
  
-PORTx registers are the registers that allow I/O pins to be accessed. A write to a PORTx register writes to the corresponding LATx register (PORTx data latch) and those I/O port pins configured as outputs are updated. This is effectively the same as writing to a LATx register. A read from a PORTx register reads the synchronized signal applied to the post I/O pins. +PORTx registers are the registers that allow I/O pins to be accessed. A write to a PORTx register writes to the corresponding LATx register (PORTx data latch) and those I/O port pins configured as outputs are updated. This is effectively the same as writing to a LATx register. A read from a PORTx register reads the synchronized signal applied to the port I/O pins. 
  
 ==== 7.2. Configuring the PIC32 for Digital Inputs ==== ==== 7.2. Configuring the PIC32 for Digital Inputs ====
Line 67: Line 68:
 ---- ----
  
-==== Listing 7.1. Instructions for Setting Analog Inputs to be Digital Inputs fro SW5 Through SW7 ====+==== Listing 7.1. Instructions for Setting Analog Inputs to be Digital Inputs for SW5 Through SW7 ====
 <code> <code>
     TRISBbits.TRISB9  = 1; // Set Port B bit 9 for input mode (3.3V tolerant only)     TRISBbits.TRISB9  = 1; // Set Port B bit 9 for input mode (3.3V tolerant only)
Line 107: Line 108:
 ===== 8. Lab 1a ===== ===== 8. Lab 1a =====
 ==== 8.1. Requirements ==== ==== 8.1. Requirements ====
-This exercise uses the Basys MX3 switches SW0 through SW2 to control the red, blue, and green LEDs on the tri-colored LED labeled LED8 according to the following rules (referring to the schematic diagrams in Appendix A of this lab for additional details):+This exercise uses the Basys MX3 switches SW0 through SW2 to control the red, blue, and green LEDs on the tri-colored LED labeled LED8 according to the following rules (refer to the schematic diagrams in Appendix A of this lab for additional details):
   - SW0 is to turn the RED color of LED8 on or off.   - SW0 is to turn the RED color of LED8 on or off.
   - SW1 is to turn the BLUE color of LED8 on or off.   - SW1 is to turn the BLUE color of LED8 on or off.
Line 168: Line 169:
  
 ====== Appendix A: Schematic Drawings ====== ====== Appendix A: Schematic Drawings ======
-{{ :learn:courses:microprocessor-io-lab-1a:figure-a-1.png?nolink |Figure A.1. Slide switch schematic diagram.}}+{{ :learn:courses:microprocessor-io-lab-1a:basys_mx3_schematic_switches.png?nolink |Figure A.1. Slide switch schematic diagram.}}
 //Figure A.1. Slide switch schematic diagram.// //Figure A.1. Slide switch schematic diagram.//
  
-{{ :learn:courses:microprocessor-io-lab-1a:figure-a-2.png?nolink |Figure A.2. Schematic of PIC32 interconnection with the Tri-color LED.}}+{{ :learn:courses:microprocessor-io-lab-1a:basys_mx3_schematic_rgbled.png?nolink |Figure A.2. Schematic of PIC32 interconnection with the Tri-color LED.}}
 //Figure A.2. Schematic of PIC32 interconnection with the Tri-color LED.// //Figure A.2. Schematic of PIC32 interconnection with the Tri-color LED.//
  
-{{ :learn:courses:microprocessor-io-lab-1a:figure-a-3.png?nolink |Figure A.3. Basys MX3 LEDs.}}+{{ :learn:courses:microprocessor-io-lab-1a:basys_mx3_schematic_leds.png?nolink |Figure A.3. Basys MX3 LEDs.}}
 //Figure A.3. Basys MX3 LEDs.// //Figure A.3. Basys MX3 LEDs.//
  
Line 192: Line 193:
     - The run section must contain an infinite software loop that, under no condition, must ever end.  Typically this infinite loop is written as for(;;){ … } or while(1){ …}. The embedded application executes from the infinite loop or from interrupts that preempt this loop.     - The run section must contain an infinite software loop that, under no condition, must ever end.  Typically this infinite loop is written as for(;;){ … } or while(1){ …}. The embedded application executes from the infinite loop or from interrupts that preempt this loop.
  
 +----
 +
 +[[{}/learn/courses/microprocessor-io-unit-1/start|Back to Unit 1]]
 +[[{}/learn/courses/microprocessor-io-lab-1b/start|Go to Lab 1b]]