Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| learn:microprocessor:tutorials:pic32-interrupts:start [2017/12/18 20:27] – Martha | learn:microprocessor:tutorials:pic32-interrupts:start [2022/10/04 11:38] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 13: | Line 13: | ||
| ==== Inventory ==== | ==== Inventory ==== | ||
| - | * 1 [[http://store.digilentinc.com/ | + | * 1 [[https://digilent.com/shop/ |
| * [[http:// | * [[http:// | ||
| - | * 1 [[http://store.digilentinc.com/ | + | * 1 [[https://digilent.com/shop/ |
| * 1 Stepper Motor (5V – 12V, 25 Ω, unipolar or bi-polar) | * 1 Stepper Motor (5V – 12V, 25 Ω, unipolar or bi-polar) | ||
| - | * 1 Logic analyzer or oscilloscope (Digilent [[http://store.digilentinc.com/ | + | * 1 Logic analyzer or oscilloscope (Digilent [[https://digilent.com/ |
| ---- | ---- | ||
| Line 26: | Line 26: | ||
| \\ | \\ | ||
| < | < | ||
| - | <a href="https:// | + | <a href="/ |
| </ | </ | ||
| \\ | \\ | ||
| \\ | \\ | ||
| < | < | ||
| - | <a href="https:// | + | <a href="/ |
| </ | </ | ||
| \\ | \\ | ||
| Line 114: | Line 114: | ||
| < | < | ||
| - | <a href="https:// | + | <a href="/ |
| </ | </ | ||
| \\ | \\ | ||
| Line 203: | Line 203: | ||
| This project implements a system that runs entirely using foreground processes. The Timer 1 interrupt is used to generate an interrupt once each millisecond. The PIC32 change notice interrupt generates an interrupt when a button is pressed or released. The project consists of writing a program that meets the specifications listed below: | This project implements a system that runs entirely using foreground processes. The Timer 1 interrupt is used to generate an interrupt once each millisecond. The PIC32 change notice interrupt generates an interrupt when a button is pressed or released. The project consists of writing a program that meets the specifications listed below: | ||
| - | - Functionality for main function. | + | < |
| - | * Calls system_init function (see step 2). | + | <ol type=" |
| - | * Continuously executes the while(1); statement. | + | <li>Functionality for main function.</li> |
| + | < | ||
| + | <li>Calls system_init function (see step 2).</li> | ||
| + | < | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | <ol type=" | ||
| + | < | ||
| + | <ol type=" | ||
| + | < | ||
| + | < | ||
| + | </ | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | <ol type=" | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | <ol type=" | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | <ol type=" | ||
| + | < | ||
| + | < | ||
| + | </ | ||
| + | < | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | <ol type=" | ||
| + | < | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | <ol type=" | ||
| + | < | ||
| + | < | ||
| + | < | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | <ol type=" | ||
| + | < | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | <ol type=" | ||
| + | < | ||
| + | < | ||
| + | </ | ||
| + | </ | ||
| + | |||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Project Testing ===== | ||
| + | There are significant timing requirements for this project: the Timer 1 interrupt rate, the stepper motor step rate, and the button debounce delay. Table 2 is provided below to assist you in determining where to place the instructions to control the instrumentation LEDs. The red tab above shows where to connect an oscilloscope or logic analyzer to the test points for LEDA through LEDC on the PmodSTEP to instrument this project. An example of a logic analyzer screen capture is shown below in Fig. 1. | ||
| + | |||
| + | | LED ^ Operation | ||
| + | | LEDA | Toggle | ||
| + | | LEDB | Toggle | ||
| + | | LEDC | SET (on) | Start of CN ISR | | ||
| + | | LEDC | Cleared (off) | End of CN ISR | | ||
| + | |||
| + | **Table 2. Instrumentation LED Operations.** | ||
| + | |||
| + | {{ : | ||
| + | Figure 1. Screen capture for the instrumentation of Project 5. Screenshot of Digilent WaveForms running on Microsoft Windows 7. | ||
| + | |||
| + | ---- | ||
| + | |||
| + | ===== Test Your Knowledge! ===== | ||
| + | Now that you've completed this project, you should look at the following questions/ | ||
| + | |||
| + | < | ||
| + | <ol type=" | ||
| + | < | ||
| + | </ | ||
| + | <font color=" | ||
| + | </ | ||
| + | </ | ||
| + | {{ : | ||
| + | |||
| + | {{ : | ||
| + | |||
| + | < | ||
| + | <ol start=" | ||
| + | < | ||
| + | </ | ||
| + | <font color=" | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | </ | ||
| + | <font color=" | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | </ | ||
| + | <font color=" | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | </ | ||
| + | <font color=" | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | </ | ||
| + | <font color=" | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | </ | ||
| + | <font color=" | ||
| + | </ | ||
| + | |||
| + | < | ||
| + | </ | ||
| + | <font color=" | ||
| + | </ | ||
| + | </ | ||
| + | </ | ||
| - | - Create a system_init function that implements a fully nested interrupt scheme for Timer 1 and change notice interrupts using the following steps. | + | {{tag> |
| - | - Initialize the processor board using the function chipKit_Pro_MX7_Setup(); | + | |
| - | - Set the I/O PORT B pins for LEDA, LEDB, LEDC, and stepper motor as outputs. | + | |
| - | - Set the I/O PORT G to read the button inputs for BTN1 and BTN2 as inputs. | + | |
| - | - Initialize Timer 1 to generate an interrupt once each ms . Set the group priority for level 2 and the subgroup level for 0. (Refer to Listing 2.) | + | |
| - | - Initialize the PIC32MX7 system for change notice detection. Set change notice interrupts to detect activity on BTN1 and BTN2 only, the group priority level 1 and the subgroup level 0. (Refer to Listing 4.) | + | |
| - | - Set the system for multiple vectored interrupts. (Refer to Listing 1.) | + | |
| - | {{tag> | + | |

