rapid fire for video game controller - in a Xilinx CPLD XCR3064XL - Page 1
Forum section: electronics / general

author: grips03
author_rank: Contributor
timestamp: October 06, 2013, 03:46:07 am
content: I have a small logic circuit using Xilinx CPLD that is used for a video game controller. I would like to add rapid fire in the CPLD if that is possible.Logic:Rapid fire button = pulled highRapid fire button pressed (ground)then output pin 6 and 8 would go low, then high Z, then low, then high Z....repeatOutputs are high Z today. I just need something that goes high and low at a certain frequency and then feed it into the OR gates that control the logic.

author: AndyC_772
author_rank: Super Contributor
timestamp: October 06, 2013, 08:10:23 am
content: I don't doubt it's possible unless all the logic cells in the CPLD are already in use - but we'll need to know a bit more about what it is you need before anyone can usefully help.What experience do you have programming CPLDs? Do you already have the Xilinx tool chain installed, experience in VHDL or Verilog, and access to the existing source code? Do you first need to reverse-engineer and replicate the behaviour of the existing device?

author: arkanix38
author_rank: Contributor
timestamp: October 06, 2013, 11:23:51 pm
content: You don't necessarily have to utilise the CPLD to do the job. If you are using PWM on an LED in the controller you can just have a switch running in parallel to the ground of the firing switch. This is a common method in Xbox360 controllers.Alternately you can have a 555 timer (perhaps emulated in the CPLD?) to allow a varying firing rate.

author: grips03
author_rank: Contributor
timestamp: October 07, 2013, 12:46:06 am
content: I can program Altera and Xilinx CPLDs as I have tools and I've used them before - this weekend in fact, but again only for digital logic stuff - not, or, nand, and, etc. Today I use the schematic editor as I don't know Verilog or VHDL. I suppose I could learn if it made the project easier to implement.For this controller I have one spare pin on the cpld. Plan was to use this an input, i.e. press button on this input and it would provide rapid fire. I'm just not certain how to use the internal clock to drive this or how to change the clock frequency. I guess if I had a CPLD designable circuit that could generate and change the clock frequency I could adjust to meet the requirement.

author: NoNRG
author_rank: Newbie
timestamp: October 07, 2013, 04:57:40 am
content: Quote from: grips03 on October 07, 2013, 12:46:06 amThe internal clock can be tied to a process that includes the push button input. Are you trying to decrease or increase the clock rate? Either is possible, but decreasing the clock is easier (simple clock divider).

author: AndyC_772
author_rank: Super Contributor
timestamp: October 07, 2013, 06:27:50 am
content: Using the schematic editor is making life difficult for yourself, you'll find learning VHDL or Verilog will ultimately save you a lot of time and give you much better control over what's going on inside the device. I highly recommend it as a worthwhile exercise.Before you can add features to the CPLD you'll need the current firmware as a starting point. Without this, you'll need to first reverse-engineer everything else it's doing and produce yourself a schematic (or, preferably, HDL source code). Once you have that, adding the extra feature you want will be trivial.

author: grips03
author_rank: Contributor
timestamp: October 07, 2013, 01:22:46 pm
content: I have the current software in Verilog and in schematic form as I made the PCB and designed the current circuit. This is just adding one more feature.I'm going to check out Xilinx website I bet the have an example of using the internal clock.