Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revision | |||
| test-and-measurement:analog-discovery-2:pmod-jstk [2022/09/12 12:19] – changed forum.digilentinc.com to forum.digilent.com fsoares | test-and-measurement:analog-discovery-2:pmod-jstk [2022/10/04 11:38] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== Displaying Joystick Position ====== | ||
| + | |||
| + | {{ reference: | ||
| + | |||
| + | ===== Introduction ===== | ||
| + | |||
| + | This project streams positional data from the Digilent Pmod JSTK2 into a Digilent Test and Measurement device. The data is presented on an X-Y plot, showing the position of the joystick and any button clicks, similar to a joystick calibration dialog. The project demonstrates how SPI transactions can be generated, and how the results can be plotted and interpreted within WaveForms. | ||
| + | |||
| + | ===== Inventory ===== | ||
| + | * A Digilent Test and Measurement device that supports WaveForms' | ||
| + | * [[https:// | ||
| + | * [[https:// | ||
| + | * //An Analog Discovery (Legacy) can also be used.// | ||
| + | * [[https:// | ||
| + | * A Pmod JSTK (Legacy) is pin-compatible and can also be used. | ||
| + | * WaveForms Installation | ||
| + | * [[software: | ||
| + | * {{reference: | ||
| + | * //Includes a WaveForms workspace for displaying positional data captured from the Pmod JSTK2.// | ||
| + | |||
| + | ===== Description ===== | ||
| + | |||
| + | The script included in the workspace download is used to initialize several instruments, | ||
| + | |||
| + | This script utilizes the pattern generator to produce the clock and chip select signals required for SPI communication with the Pmod. The logic analyzer is used to take samples of the data every 5 milliseconds, | ||
| + | |||
| + | The script performs bit-wise operations to convert the data into a usable form. As the [[pmod: | ||
| + | |||
| + | For a better understanding of the what the script is doing, please read the [[pmod: | ||
| + | |||
| + | {{ reference: | ||
| + | |||
| + | < | ||
| + | |||
| + | ===== Setup Instructions ===== | ||
| + | |||
| + | === 1. Hardware Setup === | ||
| + | This script requires that Pmod JSTK2 be connected to the test and measurement device' | ||
| + | |||
| + | //Table 1. Physical Connections// | ||
| + | |< 50% 50% 50% >| | ||
| + | ^ DIO Pin ^ Pmod Pin ^ | ||
| + | | DIO-0 | SS | | ||
| + | | GND | MOSI | | ||
| + | | DIO-1 | CLK | | ||
| + | | DIO-2 | MISO | | ||
| + | | GND | GND | | ||
| + | | V+ | ||
| + | |||
| + | ---- | ||
| + | === 2. Software Setup === | ||
| + | <WRAP group> <WRAP column half> | ||
| + | Start by downloading and extracting the WaveForms workspace from the {{reference: | ||
| + | |||
| + | Once the connections are made, open the extracted workspace (Pmod Joystick.dwf3work) in WaveForms. When selecting the device in the Device Manager dialog, be sure that configuration #4 is selected. | ||
| + | </ | ||
| + | {{ reference: | ||
| + | |||
| + | < | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | === 3. Running the Script === | ||
| + | |||
| + | Once the workspace loads, press the **Run** button in the Script window, or press F5 on the keyboard. The Test and Measurement device will start communicating with the Pmod and streaming the data through the oscilloscope. Moving the joystick will cause the points to move, plotting the position of the control stick. Pressing the left or right buttons or down on the joystick will erase all points on the X-Y plot and display individual points in the top left, right, or middle portion of the plot, respectively. Figures 3 and 4 show the SPI data plotted in the X-Y plot and logic analyzer, respectively. | ||
| + | |||
| + | <WRAP group> <WRAP column half> | ||
| + | {{ reference: | ||
| + | |||
| + | < | ||
| + | </ | ||
| + | {{ reference: | ||
| + | |||
| + | < | ||
| + | </ | ||
| + | |||
| + | ---- | ||
| + | === 4. Stopping the Script === | ||
| + | |||
| + | When finished, press the **Stop** button in the //Script// window, the **Stop** buttons in the //Patterns 1// and //Logic 1// windows, and the **Master Enable is On** button in the // | ||
| + | |||
| + | ---- | ||
| + | ==== Final Notes ==== | ||
| + | |||
| + | For more guides and example projects for your Test and Measurement device, please visit its Resource Center, which can be found through this wiki's [[test-and-measurement: | ||
| + | |||
| + | For more information about how to use the Pmod JSTK2 featured in this demo, please visit its [[pmod: | ||
| + | |||
| + | For technical support, please visit the [[https:// | ||
| + | |||
| + | {{tag> | ||
| + | |||

