Subject: Re: ST timing?

From: Dave Stampe-Psy+Eng <[email-masked]>
Date: Sat, 19 Oct 91 21:04:46 -0400

> From [email-masked] Sat Oct 19 20:21:47 1991
> From: [email-masked] (John D Beutel)
> Subject: ST timing?
> To: [email-masked]
> 
> I'm working on a timer/interrupt driven hi-res interface for the ST,
> to free up the CPU.  I've got the timer/interrupt part working
> (finally...), but the data packet from the glove is sometimes
> out of sync.
> 
> Specifically, it sometimes shifts so that A0 and X are the
> last bytes of the packet, sometimes A0 is the last byte,
> and sometimes A0 is the first byte (like it should be).
> Manfredo's suggestion of quickly making a fist or pressing
> the center button both work to bring A0 back to the first
> byte, but it goes out of whack too frequently (about once
> per minute) to rely on that manual solution.  I suspect
> it's a timing problem, as Greg Alt mentioned when he did
> the PC version, but I tried changing the /7 to a /5 and /6
> in the delay() macro (as he did) and it didn't help.
> 
> Has someone gotten the ST source to give them the packet
> in the proper order?  I know it DOES work for Manfred Krauss,
> and it doesn't work for several other people on this list
> who've tried it on their ST's.  Who else with an ST is
> getting the packets in the right order?  Did you change
> the code?  Did it just work?  Is there some timing difference
> in the hardware between different types of ST's?
> 
> I'll try changing the times of various parts of the protocol,
> (especially reducing the delay times, since Greg's machine
> is faster than mine), but I'd rather not guess.
> 
> --
> J. David Beutel  11011011  [email-masked]  "I am, therefore I am."
> 

Look at the code I posted a few days ago for the IBM PC.  Basically, what you must do is:
1) Read from the glove until a $A0 is received.  Try every 3 or 4 mS, or the 
glove will start trashing data if you interrupt it too often (do this via
an interrupt.)
2) Immediately read 8 bytes, discarding the last 2-- this is the REAL glove
data packet.
3) Return to step 1

If the glove hasn't responded after 500 tries of step 1, reset it into the
hires mode (is crashed or the user changed the program).

The code I posted also contains noise reduction routines.  If you don't use
these, your cursor will jump aruond a lot.

The above procedure is FASTER than the fixed timing reads.  What happens is
that the glove takes longer to finish reading the finger positions when you
make a fist.  Hand open, you get 17 samples/sec, hand closed, you get 12.5
samples/sec.

- Dave Stampe