November 21, 2024, 11:03:05 PM

News:

Be sure to checkout our Vixen interfaces in the Library forum -- if you want PC automation at near zero cost, EFX-TEK and Vixen is a great combination of tools.


Vex Transmitter to Prop-SX to Servos + PC (via Serial)

Started by JonnyMac, May 27, 2008, 07:24:22 PM

Previous topic - Next topic

davisgraveyard

Technically no.  I have 3 Vex transmitters.  2 I borrowed from a friend.  The third I got from RMG with the intention of giving back the others to my friend.  But when I did the testing since the RMG one didn't come with a charged battery and my friend had a couple of charged battery packs I used his.   I am pretty sure that the other one will work fine though.

Jeff

davisgraveyard

Jon, I never did get anywhere on capturing data out the serial port.  All I seem to get is garbage.  Could you test it on your end and make sure you are just seeing groups of 5 bytes?  I will do more testing on my end if you confirm that it is working as it should.   I am setting my COM port to 57600 baud 8-n-1 no flow control.   It doesn't even look right in hyperterm.  Still seeing random noise.



Jeff

JonnyMac

Sure.  I'm in Arizona this week as a guest at the University of Advancing Technology, and I don't have my VEX package with me.  While I'm here I'll see if I can whip up a VB program to receive the data and report any packet errors.
Jon McPhalen
EFX-TEK Hollywood Office

davisgraveyard

You don't even need to write a VB Program just use hyperterm to connect to the RS-232 port on the board.   You can capture the data to a file.   You should see a 5 byte character pattern if you just let the servos idle.  The first byte should always be the same (FF).  I'm not seeing this.  In my case the data is just noise with little or no pattern.


davisgraveyard

I was wondering.  In the code you posted at the begining of this thread is there a way to smooth out the servo movement a bit?   I am looking at the code and am not sure what would need to change to do this?    Is this even possible?

Jeff

JonnyMac

You could take multiple samples and then average them, but then you would lose your change resolution.  If, however, you just wanted to record servo positions every 100 ms, you could take samples and average them -- this would smooth the movement within that period.
Jon McPhalen
EFX-TEK Hollywood Office

JonnyMac

Jeff,

I'm going to blame the "garbage" you captured as something on your end -- probably HyperTerminal.  I pumped data into HT but used another program, Free Serial Port Monitor, to capture the data.  Here's the dump (note that I added a text header at the beginning because HT doesn't like non-ASCII characters):

Port opened by process "hypertrm.exe" (PID: 540)

56 45 58 20 4D 6F 6E 69 74 6F 72 0D 0A FF A9 B1   VEX Monitor..ÿ©±
9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B   ›šÿ©±›šÿ©±›šÿ©±›
9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A   šÿ©±›šÿ©±›šÿ©±›š
FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF   ÿ©±›šÿ©±›šÿ©±›šÿ
A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9   ©±›šÿ©±›šÿ©±›šÿ©
B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1   ±›šÿ©±›šÿ©±›šÿ©±
9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B   ›šÿ©±›šÿ©±›šÿ©±›
9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A   šÿ©±›šÿ©±›šÿ©±›š
FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF   ÿ©±›šÿ©±›šÿ©±›šÿ
A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9   ©±›šÿ©±›šÿ©±›šÿ©
B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1   ±›šÿ©±›šÿ©±›šÿ©±
9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B   ›šÿ©±›šÿ©±›šÿ©±›
9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A   šÿ©±›šÿ©±›šÿ©±›š
FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF   ÿ©±›šÿ©±›šÿ©±›šÿ
A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9   ©±›šÿ©±›šÿ©±›šÿ©
B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1   ±›šÿ©±›šÿ©±›šÿ©±
9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B   ›šÿ©±›šÿ©±›šÿ©±›
9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A   šÿ©±›šÿ©±›šÿ©±›š
FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF   ÿ©±›šÿ©±›šÿ©±›šÿ
A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9   ©±›šÿ©±›šÿ©±›šÿ©
B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1   ±›šÿ©±›šÿ©±›šÿ©±
9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B   ›šÿ©±›šÿ©±›šÿ©±›
9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A   šÿ©±›šÿ©±›šÿ©±›š
FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF   ÿ©±›šÿ©±›šÿ©±›šÿ
A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9   ©±›šÿ©±›šÿ©±›šÿ©
B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1   ±›šÿ©±›šÿ©±›šÿ©±
9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B   ›šÿ©±›šÿ©±›šÿ©±›
9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A   šÿ©±›šÿ©±›šÿ©±›š
FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF   ÿ©±›šÿ©±›šÿ©±›šÿ
A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9   ©±›šÿ©±›šÿ©±›šÿ©
B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1   ±›šÿ©±›šÿ©±›šÿ©±
9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B   ›šÿ©±›šÿ©±›šÿ©±›
9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A   šÿ©±›šÿ©±›šÿ©±›š
FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF   ÿ©±›šÿ©±›šÿ©±›šÿ
A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9   ©±›šÿ©±›šÿ©±›šÿ©
B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1   ±›šÿ©±›šÿ©±›šÿ©±
9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B   ›šÿ©±›šÿ©±›šÿ©±›
9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A   šÿ©±›šÿ©±›šÿ©±›š
FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF   ÿ©±›šÿ©±›šÿ©±›šÿ
A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9   ©±›šÿ©±›šÿ©±›šÿ©
B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1   ±›šÿ©±›šÿ©±›šÿ©±
9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B   ›šÿ©±›šÿ©±›šÿ©±›
9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A   šÿ©±›šÿ©±›šÿ©±›š
FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF   ÿ©±›šÿ©±›šÿ©±›šÿ
A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9   ©±›šÿ©±›šÿ©±›šÿ©
B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1   ±›šÿ©±›šÿ©±›šÿ©±
9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B   ›šÿ©±›šÿ©±›šÿ©±›
9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A   šÿ©±›šÿ©±›šÿ©±›š
FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF   ÿ©±›šÿ©±›šÿ©±›šÿ
A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9   ©±›šÿ©±›šÿ©±›šÿ©
B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1   ±›šÿ©±›šÿ©±›šÿ©±
9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B   ›šÿ©±›šÿ©±›šÿ©±›
9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A   šÿ©±›šÿ©±›šÿ©±›š
FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF   ÿ©±›šÿ©±›šÿ©±›šÿ
A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9   ©±›šÿ©±›šÿ©±›šÿ©
B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1   ±›šÿ©±›šÿ©±›šÿ©±
9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B   ›šÿ©±›šÿ©±›šÿ©±›
9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A   šÿ©±›šÿ©±›šÿ©±›š
FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF   ÿ©±›šÿ©±›šÿ©±›šÿ
A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9   ©±›šÿ©±›šÿ©±›šÿ©
B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1   ±›šÿ©±›šÿ©±›šÿ©±
9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B   ›šÿ©±›šÿ©±›šÿ©±›
9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A   šÿ©±›šÿ©±›šÿ©±›š
FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF   ÿ©±›šÿ©±›šÿ©±›šÿ
A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9   ©±›šÿ©±›šÿ©±›šÿ©
B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1   ±›šÿ©±›šÿ©±›šÿ©±
9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B   ›šÿ©±›šÿ©±›šÿ©±›
9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A   šÿ©±›šÿ©±›šÿ©±›š
FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF   ÿ©±›šÿ©±›šÿ©±›šÿ
A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9   ©±›šÿ©±›šÿ©±›šÿ©
B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1   ±›šÿ©±›šÿ©±›šÿ©±
9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B   ›šÿ©±›šÿ©±›šÿ©±›
9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A   šÿ©±›šÿ©±›šÿ©±›š
FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF   ÿ©±›šÿ©±›šÿ©±›šÿ
A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9   ©±›šÿ©±›šÿ©±›šÿ©
B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1   ±›šÿ©±›šÿ©±›šÿ©±
9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B   ›šÿ©±›šÿ©±›šÿ©±›
9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A   šÿ©±›šÿ©±›šÿ©±›š
FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF   ÿ©±›šÿ©±›šÿ©±›šÿ
A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9   ©±›šÿ©±›šÿ©±›šÿ©
B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1   ±›šÿ©±›šÿ©±›šÿ©±
9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B   ›šÿ©±›šÿ©±›šÿ©±›
9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A   šÿ©±›šÿ©±›šÿ©±›š
FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF   ÿ©±›šÿ©±›šÿ©±›šÿ
A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9   ©±›šÿ©±›šÿ©±›šÿ©
B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1   ±›šÿ©±›šÿ©±›šÿ©±
9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B   ›šÿ©±›šÿ©±›šÿ©±›
9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A   šÿ©±›šÿ©±›šÿ©±›š
FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF   ÿ©±›šÿ©±›šÿ©±›šÿ
A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9   ©±›šÿ©±›šÿ©±›šÿ©
B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1   ±›šÿ©±›šÿ©±›šÿ©±
9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B   ›šÿ©±›šÿ©±›šÿ©±›
9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A   šÿ©±›šÿ©±›šÿ©±›š
FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF   ÿ©±›šÿ©±›šÿ©±›šÿ
A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9   ©±›šÿ©±›šÿ©±›šÿ©
B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1   ±›šÿ©±›šÿ©±›šÿ©±
9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B   ›šÿ©±›šÿ©±›šÿ©±›
9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A   šÿ©±›šÿ©±›šÿ©±›š
FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF   ÿ©±›šÿ©±›šÿ©±›šÿ
A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9   ©±›šÿ©±›šÿ©±›šÿ©
B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1   ±›šÿ©±›šÿ©±›šÿ©±
9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B   ›šÿ©±›šÿ©±›šÿ©±›
9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A   šÿ©±›šÿ©±›šÿ©±›š
FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF   ÿ©±›šÿ©±›šÿ©±›šÿ
A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9   ©±›šÿ©±›šÿ©±›šÿ©
B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1   ±›šÿ©±›šÿ©±›šÿ©±
9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B   ›šÿ©±›šÿ©±›šÿ©±›
9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A   šÿ©±›šÿ©±›šÿ©±›š
FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF   ÿ©±›šÿ©±›šÿ©±›šÿ
A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9   ©±›šÿ©±›šÿ©±›šÿ©
B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1   ±›šÿ©±›šÿ©±›šÿ©±
9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B   ›šÿ©±›šÿ©±›šÿ©±›
9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A   šÿ©±›šÿ©±›šÿ©±›š
FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF   ÿ©±›šÿ©±›šÿ©±›šÿ
A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9   ©±›šÿ©±›šÿ©±›šÿ©
B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1   ±›šÿ©±›šÿ©±›šÿ©±
9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B   ›šÿ©±›šÿ©±›šÿ©±›
9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A   šÿ©±›šÿ©±›šÿ©±›š
FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF   ÿ©±›šÿ©±›šÿ©±›šÿ
A9 B1 9B 9A FF A9 B1 9B 9A FF A9 B1 9B 9A FF A9   ©±›šÿ©±›šÿ©±›šÿ©
B1 9B 9A                                          ±›š


After a few minutes I just turned off the Prop-SX.  If you look closely, from the first FF until the last packet, everything is correct.  Don't worry about the values -- I was tweaking the adjustments on the VEX transmitter.

Now that I'm satisfied I'll see if I can come up with a VB capture program.  No promises, though, I'm better at the SX than with VB.
Jon McPhalen
EFX-TEK Hollywood Office

davisgraveyard

OK I guess you proved that it works.   I have a guess what it might be on my end.   I am using the Parallax USB to serial adaptor to test this with?   My development computer and my laptop don't have 9 pin serial ports just USB ports.  If this isn't the problem then I would guess that my serial port config for capturing must be setup wrong.    I am using 57600 baud 8 data bits no parity and 1 stop bit  (8N1).   I set the port to no flow control. 

Here is the little VB program I am using.  I use the MS Comm control for serial IO.  It is currently set to COM3.   It captures serial data to a file c:\data.dat and then can process the data to a file c:\data.txt .

http://www.davisgraveyard.com/PropSX-Vex.zip

Let me know if it is working for you.  If so then it MUST be my USB connection?

JonnyMac

I'm certain that it's NOT the USB connection.  I also tested at 57600 with no problems.  Yes, I did modify the program a little bit, but only to improve the accuracy of pulse timing; nothing to do with serial comms (update posted in top of this thread).

I'm on my way out for a few hours; will look at your VB program when I return.
Jon McPhalen
EFX-TEK Hollywood Office

davisgraveyard

Just tried the new version of the program.  The serial capture is working fine now.  Hum.....you SURE you didn't change any of ther serial stuff?

One thing I am noticing though.  The program haulting is happening more often.  It seems to happen whenever the servo has any strain or has trouble holding its position.  Like the jaw movement (weight of jaw)  or my tilt which binds a bit when in the extream settings.  Doesn't seem that noticable when running.

The controller just stops and I have to push reset to get it going again?

Jeff


JonnyMac

You may be causing the board to brownout with servos drawing a ton of current when stalled -- servos can get rough this way.  Change BOR42 in the DEVICE line to BOR26, this will reduce the brownout threshold and may help out.  If possible, don't let the servos stall or bind because they can draw a lot of current when this happens.  In the worst case condition you may have to power the servos from a separate supply.
Jon McPhalen
EFX-TEK Hollywood Office

davisgraveyard

Thanks that did seem to help a little.  I still saw a couple of halts but after a while things seem to be moving smoothly.  I am not seeing much strain on the servos they seem to be moving freely.  But I guess that was it?

I wanted to clarify where we are going with this serial interface to the PC and the captured data.   Our goal, if I understand it, is to create statements like this

DATA   150, 150, 150, 150, 0

The idea being that we can eliminated the duplicate values and combine them into 1 statement with a timing value for each 20ms duplicate right?

so each 4 values represents a 20ms setting for the servos.    Do we only use a value of 0 for the timing on the last entry or am I not understanding how the 0 value works?

Jeff

JonnyMac

June 26, 2008, 12:11:15 PM #27 Last Edit: June 26, 2008, 12:15:18 PM by JonnyMac
I'm not going any particular direction with this stuff; I've done it purely as a service to our customers that have asked for the ability to record the servo data provided by the VEX interface.

Now... if one can capture the data then the easiest way to conserve space in the SX is to use some sort of compression.  I do this by using the fifth element of that DATA line as a count for the number of servo periods (typically, 20ms) at the positions stated by the first four elements.  In the SX I would use a zero timing value as the end-of-sequence indicator.

In code a servo engine might look like this (assuming background servo processing in place):

Run_Servos:
  addr = Show_Label
  DO
    READINC addr, pos0, pos1, pos2, pos3, timing
    IF timing = 0 THEN EXIT
    DO WHILE timing > 0
      DELAY_MS 20
      DEC timing
    LOOP
  LOOP


In this example pos0 - pos3 are the registers used by the background servo processor.  
Jon McPhalen
EFX-TEK Hollywood Office

davisgraveyard

Just roughly, how many DATA lines do you think would be a reasonable limit given enough space for code?


davisgraveyard

I have cleaned up my Vex Data capture program.    www.davisgraveyard.com/PropSX-Vex.zip

This will capture data from the Vex to a file.  It will process the file and create a text file that contains all unique DATA statements.

I'm wasn't quite sure on the timing value count.   If there is only one of the 4 values is the timing value 0?  If there are 2 sets of the same values is the timing value 1 or 2?  Also are we getting VEX data sent to us faster than 20ms or is each 4 value block a 20ms setting?

Here is a zip of the capture file and the processed text file.   www.davisgraveyard.com/capture.zip


Jeff