IPAC switch control

20 views
Skip to first unread message

poodull

unread,
Aug 19, 2009, 10:42:14 AM8/19/09
to Homebrew Pinball
Who was it that was using an IPAC for switch controls on this group?
I tried it and I don't think it will work.

I created a program that listens to keystrokes at the root level in c#
and my issues are that some keystrokes from the IPAC repeat, like UP
and Z, but some don't, like LEFT and Q. Also, even if that were
fixed, I still need to know when switches were unpressed, to keep the
state right.

If its event-driven, and not polled, then we need both press and
release events to keep a state array of the switches.

I'm going to try hooking up higher and on keydown and keyup instead.
My fear with this is that windows isn't designed to && that many keys
at once. When I go to inspect the keys pressed argument, I don't know
what to expect. I'll get the max four at a time, but that barely
takes care of the ball trough.

Eli Curtz

unread,
Aug 19, 2009, 10:54:09 AM8/19/09
to homebrew...@googlegroups.com
The IPAC certainly claims to work around the multiple key press limit
(I assume by buffering the extra keys and sending another key event.)

Make sure you're using the USB interface and not the keyboard
interface if your version has both.

You might want to look at the key handling code in MAME or something
as a starting point, but I think you'll be much better off switching
over to listening for the key up and down events than "presses".

kendall...@gmail.com

unread,
Aug 21, 2009, 9:23:15 AM8/21/09
to Homebrew Pinball
I have been using an IPAC with great success using VB. My work around
on the state check for the switches is using a UHID to a control a Fet
that turns on and off the switch when I want it called.

So solution is limited to switches that are lock and trough where a
ball will sit on the switch. I wrote a function that is called when I
need a ball state check on these switches, the function calls the Uhid
to turn on the fet which pulses the switch back to the Ipac, Ipac
picks up the switch hit as a keystroke and then the holder variable is
returned as positive. If there is no keystroke there is no ball and
the variable is returned negative.

Make sense?
> > takes care of the ball trough.- Hide quoted text -
>
> - Show quoted text -

poodull

unread,
Aug 21, 2009, 9:20:35 PM8/21/09
to Homebrew Pinball


On Aug 21, 9:23 am, "kendallvanp...@gmail.com"
<kendallvanp...@gmail.com> wrote:
> I have been using an IPAC with great success using VB.  My work around
> on the state check for the switches is using a UHID to a control a Fet
> that turns on and off the switch when I want it called.
>
> So solution is limited to switches that are lock and trough where a
> ball will sit on the switch.  I wrote a function that is called when I
> need a ball state check on these switches, the function calls the Uhid
> to turn on the fet which pulses the switch back to the Ipac, Ipac
> picks up the switch hit as a keystroke and then the holder variable is
> returned as positive.  If there is no keystroke there is no ball and
> the variable is returned negative.
>
> Make sense?

in a word, not really. Your code listens for the key events from the
IPAC. Your code reacts to a change in state.

Now, here's where I lose it. You mention a UHID, which is a generic
term for a usb human interface device... like a keyboard, or mouse,
or... ipac. So what you mean isn't clear to me there.

Also, sounds like you're making a call to an another external device
(usb?) which in turn does some kind of interaction with the IPAC. At
this point, why wouldn't you just use an arduino with a switch matrix?

clearly i'm confused :)

kendall...@gmail.com

unread,
Aug 24, 2009, 9:07:28 AM8/24/09
to Homebrew Pinball
In VB it only receives keystrokes from the IPac into a text field and
reacts to the keystrokes as they come in. Not real code but you'll
get the idea -

If (Keystroke == F)
Then score = score + 200;
end if


So there really isn't a state change here. Just reacting to
individual keystrokes. They way I worked around the need for state
change on certain switches is by turning them on or off to trigger a
new keystroke if the ball is sitting on the switch (in a lock or in
the trough). So at some point if one needs to check the balls and
where they are sitting I turn on the switch.

The electrical for this is by having an interface device turn on a
Mosfet to then allow the switch current through to the ipac. I use
this UHID -

http://www.ultimarc.com/pacdrive.html

The code then is a function that can get called when needed (again not
real code, but an example)

Function (Check Lock)

Packdrive port1 = True ;(This will open the switch circut through the
Fet)

(Once switch circut is opened the keystroke will register)
If (Keystroke == L)
Then lock1 = True;
end if

Packdrive port1 = False;

Packdrive port2 = True; (This will open the second switch circut
through the Fet)

If (Keystroke == M)
Then lock2 = True;
end if

Packdrive port2 = False

End Function (Check Lock)

So there isn't specifically ongoing state change checking, just a call
for the state when needed. Make sense? Secondarily, a timer is put
on the keystrokes that isn't here. You have to have it time out to
receive a false state. I didn't include that code. It can be a very
short timer. Either it is yes or no.
Reply all
Reply to author
Forward
0 new messages