A few days ago I wrote a post about how to control a stepper motor with an FPGA, using the switches to control the direction and enable signal of the motor.
As excited as I was that I could now control a stepper motor with the Basys 3, controlling it with just switches wasn’t very realistic. Especially for the claw game, which is after all the end goal. Luckily I found a PmodJSTK in my desk. The PmodJSTK is an adorable little joystick module that also has LEDs and buttons.
So I set out to get the PmodJSTK controlling two stepper motors, one for the X direction and one for the Y direction. I lucked out again when I discovered that someone long ago had written an FPGA module for the PmodJSTK. Unfortunately, it was written for the Nexys 3 using Xilinx ISE.
However, I was easily able to change it over to using the Basys 3 with Xilinx Vivado. By change the UCF file to an XDC file. If you’d like to learn more about that process, check out this previous blog post. Sometimes depending on how the module was written it doesn’t always directly transfer over, but this one did!
Now all I needed to do was disable the functionality of the LEDs and buttons on the PmodJSTK since I was only using the JSTK part. I also had to create a decoder to decode the information sent from the PmodJSTK into right, left, up and down signals.
You can see the full code and explanation of what I did in my Instructable, Using the PmodJSTK to Control Stepper Motors on the Basys 3.