S
T
A
M
P
A
P
P
L
I
C
A
T
I
O
N
S
and read the RC port. Just one caveat: the SX uses 0 to indicate an output bit, and 1 to indicate an input bit — this is
exactly opposite of what we do in the BASIC Stamp (DIRS
register). Knowing this, we will send BASIC Stamp style
data to the PlayStation Helper module and invert the
bits before assigning the configuration value to the TRIS
register. Here’s the code for handling the extra I/O port:
Config_IoPort:
char = RX_BYTE
PlpIO = char
char = ~char
TrisIO = char
GOTO Main
Write_IoPort:
IoPort = RX_BYTE
GOTO Main
Read_IoPort:
WAIT_MS 1
TX_OUT ~IoPort
GOTO Main
One of the things that you’ll notice about the
Config_IoPort section is that the SX pull-ups are activated
on any pin that is made an input. Now this means that
inputs will be active-low, so we’ll invert the bits sent back
to the BASIC Stamp to make them look active-high — just
as we did with the controller button bits.
WHAT ABOUT FORCE FEEDBACK?
To be honest, I was really hoping to conquer the force
feedback motor control before using the SX with the
PlayStation controller; sadly, every one of my attempts has
failed. I have scoured the Internet for information and
while there is some information out there, it is usually
incomplete and not documented. What I’m going to be
forced to do, I think, is rent or borrow a console and connect a logic analyzer to the PsxAttn, PsxClock, PsxCmd, and
■ FIGURE 4. PSX helper test output
PsxData lines to see
exactly what happens when the motors are activated.
Unfortunately, my friend Jim doesn’t have a multi-channel
logic analyzer and couldn’t do that for me — and it’s not
something that can be done with a two-channel scope; one
needs to know what the console and controller are doing
and in relation to each other.
I tell you what ... if you have a console and are able to
do that analysis for me, I will send you a shiny new Parallax
Professional Development Board. Here’s the offer: the first
person that sends me working code, or enough information
that I can add working code (that is, independent motor
control through the seria link) to this project wins the PDB.
Until next time — Happy Stamping! NV
The PSX Helper Schematic can be viewed at the
Nuts & Volts website at www.nutsvolts.com
January 2006 23