1300 Henley Court Pullman, WA 99163 509.334.6306 www.digilentinc.com PmodJSTK Reference Manual Revised May 24, 2016 This manual applies to the PmodJSTK rev. C Overview The PmodJSTK is designed to be a versatile peripheral module that can be used in a wide variety of projects. It contains a resistive twin axis joystick that includes a center push button along with two additional push buttons. The PmodJSTK also has two programmable LEDs located on the board that can provide additional information to the user. The PmodJSTK is ideally suited for Digilent microcontroller or FPGA based projects that require proportional control from the user, such as robotic applications. Featu res include: 2-axis resistive joystick with central push button Two additional user push buttons Two user indicator LEDs Small PCB size for flexible designs 1.8 1.3 (4.6 cm 3.3 cm) 6-pin Pmod connector with SPI interface Follows Digilent Pmod Interface Specification Type 2 Library and example code available in resource center The PmodJSTK. 1 Functional Descriptions The PmodJSTK uses an Atmel ATtiny24 microcontroller in a MLF20 package to collect information about its peripherals. The twin axis joystick uses two potentiometers to measure the current position in the x and y coordinate directions and stores the information in two 10-bit values ranging from 0 to 1023. 2 Interfacing with the Pmod The PmodJSTK communicates with the host board via the SPI communication protocol in 5 byte chunks. The first four bytes correspond to the two 10-bit values representing the X and Y coordinate directions and the last byte Copyright Digilent, Inc. All rights reserved. DOC : 502-116 Page 1 of 3 Other product and company names mentioned may be trademarks of their respective owners. PmodJSTK Reference Manual indicates the status of the three push buttons. Details on the organization of these bytes are provided a little further down in this document. The PmodJSTK will send its total of 23 bits of information to the system board through 40 clock cycles. The first two bytes received will consist of the 10-bit position of the potentiometer in the x-direction (with the Pmod arranged so that the pin header is facingu). The lower 8 bits of this 10-bit value will arrive MSB in the first byte and the remaining two MSB of the 10-bit value will arrive as the last two bits in the second byte. Similarly, the 10-bit position of the potentiometer in the y-direction (with the Pmod arranged so that the pin header is facingu). The lower 8 bits of this 10-bit value will arrive MSB in the third byte and the remaining two MSB of the 10-bit value will arrive as the last two bits in the fourth byte. The three bits representing the three push buttons arrive as the last three bits in the fifth byte where a 1 indicates that the button is pressed and a 0 indicates that the button is not being pressed. The organization of the button bits (as labeled on the silk screen of the Pmod) are arranged as follows in the fifth byte. The overall order of bytes that will be sent by the PmodJSTK to the system board will be as follows: 1 2 3 4 5 X (low) X (high) Y (low) Y (high) Buttons Table 1. Byte order sent by the PmodJSTK to the system board. As per the SPI protocol, the system board also needs to send five bytes of information to the Pmod. The first byte will contain information indicating if the two on-board LEDs should be turned on or off with the remaining four bytes ignored by the PmodJSTK. The last two bits of the first byte sent indicate the status LED2 and LED1, respectively. A pinout table for the PmodJSTK is provided below: Pin Signal Description 1 ~CS Chip Select (active low) 2 MOSI Master-Out-Slave-In 3 MISO Master-In-Slave-Out 4 SCK Serial Clock 5 GND Power Supply Ground 6 VCC Power Supply (3.3V/5V) Table 2. Pin descriptions for the PmodJSTK. Any external power applied to the PmodJSTK must be within 2.7V and 5.5V however, it is recommended that the Pmod is operated at 3.3V. Copyright Digilent, Inc. All rights reserved. Page 2 of 3 Other product and company names mentioned may be trademarks of their respective owners.