Re: Spinner Replacement for Omega Race

From: Bill Boucher <boucher_at_mnsi.net>
Date: Thu Jul 31 2008 - 19:32:03 EDT

Thanks Clay, very interesting advice, much appreciated. You have obviously been around the block about 100 times more than me so I do appreciate the information and suggestions. I made the board more as an excuse to start learning VHDL for CPLD's. I've been programming PICmicro's for about 15 years now. I have a couple of friends who own Omega Race machines and both are having spinner pot issues so I thought I'd take a shot at it. I thought of using a PICmicro first. Actually, that would've been painless for me since I know them so well, but I really wanted to do a fun CPLD project so I went with XC9572. The Xilinx components and the very inexpensive CPLD development board with download cable and the free ISE software seemed the best way to get started. Atmel software requires a $65 annual license and albeit inexpensive for what it can do, Xilinx is still free and that's hard to beat. Using a PICmicro or CPLD in SMT packaging would've cut the PCB size down to about half of what it is now but for a first go at it, I thought I'd use a socketed package. Another microcontroller that I considered was the Scenix SX18 & SX28 because you can program the inputs as Schmidt trigger and with internal pull-ups. They have no interrupts and the memory is kinda small so I decided against using those for this application. Some PICmicro's would lend themselves quite well since they have multiple external interrupt sources, lots of memory, and small package sizes. I have used them to decode quadrature many times over the years. It is my experience that Atmel MEGA and Atmel AVR and TinyAVR are at least as good as the comparable PICmicro families but it has been my habit to use PICmicro's for almost everything.

I just bought my first Sega Star Trek so I will be interested in looking over how that works just to see if there's a way to apply my new board (or future version of it). I have a Major Havoc and I've worked on Tempests and those games take the spinner signals directly into the main board so there's no applications available there. I've never been exposed to Golden T or Arcade Legends. I do however own a Tron that needs restoration so once that is working again, I will probably write new code for my board to work with that game also.

Answering your questions:

1/ Apply to G-80 systems?
Based on your description of G-80 systems, my board could be programmed for that quite easily. There's plenty of I/O pins for button inputs, buttons/counter select input, 4-bit code output, and so on.

2/ Will the ship turn 1:1 ?
Yes, the ship will rotate proportionally 1:1 as you turn the knob just like it does with the original pot except that there will be no missing states (angles) and no dead spot and the linearity will be perfect. My board can be programmed as a "universal" quadrature-decoder-counter (hence the PCB name QDC4) meaning that by applying logical inputs or soldering the split-pad jumpers, you can select various bit widths for the output (3 bits wide to 10), and a few division factors. So, if your quadrature encoder outputs 256 ppr and you'd like 64, the board can be set to divide it by 4 in order to give you what you need. By setting the output bit width, you choose the number of counts such as for example 6 bits will count from 0 to 63. If your encoder has 256 ppr and your output is 6 bits, then the output would count from 0 thru 63 four times per 1 full turn of the encoder. If the output was set to 10 bits, then it would require 4 full turns to count from 0 to 1023. In other words, you can configure the board for almost any application by choosing the counting range and the ppr separately. There is also an input for "reset/clear" and one for selecting the output code type as binary or Gray.

For the Omega Race application, the QDC4 chip is hard-coded to produce 6 bit Gray code output where bits 0 thru 4 are inverted and bit 5 is not inverted. The optical encoder that I chose for it is specified as 16 ppr but my board reads every edge of both A & B signals so the output counts 64 ticks per rev. Omega Race was designed for 6 bit Gray. I checked this against the output of an original game A/G converter board and its output is 0 thru 63. I programmed my QDC4 board to match the range and data format.

3/ Use an input buffer?
You've made very interesting comments regarding input conditioning. Using a Schmidt trigger buffer would certainly make operation for reliable. Some micros have such inputs and I think that the Xilinx Coolrunner series does also. Still, the old 74hc14 is dirt cheap and so is a good choice.

4/ Use an MPU?
Ha ha, "power drill"... I've done that too :-) Yes, there's not much beyond the abilities of cheap microcontrollers these days. Debouncing input signals in code is something that I do often in my projects. Generating sync and async serial streams, complex data encoding/decoding, driving displays, monitoring various sensors, logging data, closed loop actuator and motor control, and so on, is all in a days work for me. I'm sure that I could make an 18-pin SOIC or SSOP PIC16F88 or 688 or similar work well with the Omega Race spinner application. Like I was saying, I needed an excuse to learn VHDL and CPLD circuit design. Truth be told, I'm now using the same QDC4 board in a custom prototype 3-phase brushless motor control application. The board reads the rotor position from 3 hall sensors and depending on the requested direction, determines which phase to deliver a 20 kHz PWM signal to via 3-phase H-bridge driver. I'm using a PIC18F series microcontroller to close the loop to regulate the position of a valve driven by the 3-ph BLDC motor but the CPLD is doing the high-speed motor commutation so the PICmicro can concentrate on other important tasks such as PID calculations, interpreting control input signals, driving an LCD and some LED's, reading switches, and stuff like that.

5/ What's the crystal for?
When I was playing with the CPLD development board, I found out pretty quickly that the XC9500 series CPLD's cannot operate with "dual edge" flip-flops. I couldn't code the XC9572 to trigger on both rising and falling edges of the same input signal. At that point, I started writing my code to trigger on a 2 MHz clock input and to process the states of the A & B signals once per clock tick. Once I got my prototype doing everything that I wanted it to do, I routed a small PCB and I included a clock generator circuit with the intention of it being optional. In hindsight, I probably could have routed channels A and B each to two inputs and called them A, A', B, B' and processed all of those whenever any of them changed states. That way, no clock would be needed at all. I could try this on a QDC4 board simply by building one without the clock components and by jumpering the A & B signals to a couple of other unused inputs. Personally, I'd like to see the Omega Race application of my board run without the clock. I'm still a noob so right now it has the clock but I still intend to learn how to eliminate it.

Also related to the clock is a signal that generates a single 1.5 us pulse output for any edge of either A or B input signals. This is basically a 4x ppr output. The clock accumulates an internal counter to terminate the pulse at whatever length I've specified. Other outputs include clocks that are 1x ppr, 2x ppr, and a n-per ppr which is 4x ppr divided down by the ppr-divide value that is logically selected.

Movin' on...

Although it's been done before by several people, I'm probably going to make my own CPLD based Atari AVG for Space Duel/Gravitar/Black Widow/Major Havoc since I have those games to experiment with. Again, just an excuse to learn VHDL .

William Boucher

  ----- Original Message -----
  From: Clay Cowgill
  To: vectorlist@vectorlist.org
  Sent: Thursday, July 31, 2008 5:48 PM
  Subject: RE: VECTOR: Spinner Replacement for Omega Race

> I have created a new compact circuit board that can serve as
> a replacement spinner for Omega Race. It has potential to work
> with other games such as Tron (by replacing the original counter
> board and optionally replacing the original spinner).

  Hey Bill,

  Nice job-- board looks good! A few things to consider...

  1) Might work for Sega G-80 stuff too. I honestly don't remember 100% how they worked... I think it was a four bit counter with a direction bit and some way to choose to read buttons vs. spinner. I made a little replacement for original ones way back when, but likely not in the last ten+ years.

  2) Is the pulse-per-revolution on the encoder proportional to the Omega Race encoder? (ie, does the ship stay in sync with the amount of rotation of the knob?)

  3) I've done a few designs of these over the last few years (the Arcade Legends 2/Ultimate Arcade 2, Golden Tee Clubhouse Edition, etc.) all using CPLDs for quadrature decode and other functions, so based on my experience you might want to stick a 74HC14 on the inputs to the CPLD to clean up the edges. With good quality optical encoders at slow speeds it's usually OK, but with older opto setups (tornado spinners, trackballs, etc.) and higher spin rates there can be edge chatter that'll give you false pulses (or worst case, invert your count direction!). Also if you wanted to support older opto boards you might want to borrow the charge pump/input conditioning circuit from the Centipede schematics... (make it compatible with old 'opto only' boards without logic level conversion). Even new Happ opto boards for their trackballs with the comparitors and logic level outputs will chatter still going straight into a CPLD. (and some places use those to make spinner assemblies) If you want to stick with that one encoder you have, probably no big deal.

  4) A little MCU might be more flexible than the CPLD if you wanted to support more input/output formats. With a ~12MHz AVR I can read four channels of quadrature encoders and still have time to do light gun sensing and other tasks and still get 1000's of times oversampling. Can't outrun it with the shaft connected to a power drill. ;-) You don't need pullup resistors either since the AVR has 'em built in and even the smallest AVR could have multiple programs built in for different input/output formats. Also allows you to get around input noise issues in software too, so you save the 'HC14(s)...

  5) What's the crystal for?

  -Clay

---------------------------------------------------------------------------
** Unsubscribe, subscribe, or view the archives at http://www.vectorlist.org
** Please direct other questions, comments, or problems to chris@westnet.com
Received on Thu Jul 31 19:32:07 2008

This archive was generated by hypermail 2.1.8 : Thu Jul 31 2008 - 19:50:00 EDT