PDA

View Full Version : PSCI sequence



demo
11-26-2006, 07:05 PM
Hi,

I've done a servo sequence with PSCI, can I get that in PBASIC out of the PSCI?

I want to do a standalone project with SoundModule playing music and PSC rotating servos at the same time. Any tips?

Chris Savage
11-27-2006, 02:58 AM
Hello,

While the PSCI software is really designed for a host PC connected to the USB-PSC, it is possible to migrate your sequences to the BASIC Stamp 2. Really all you need to do is note the values used by the PSCI software and put these into DATA statements along with the delay information. Since the data will be sent to the PSC serially, it doesn’t even matter which BASIC Stamp Model you use, the values will always be the same. If you group each frame into a DATA statement with the delay value you can write a routine to read and send these sequences to the PSC.

Basically your DATA statement would contain information for each channel affected followed by the delay. Your subroutine would need to send out all channel information and then PAUSE for the specified period of time before reading the next frame of the sequence. This is really just a kind of verbal flow chart, but it should get you started.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support

demo
11-27-2006, 05:01 AM
Hi Chris,

Thanks for reply.
How about the offset value, can I get that from PSCI too?
Is there any sample/demo where DATA statement is in use, in case like this?

Thanks a lot for your patience.

Chris Savage
11-27-2006, 07:54 AM
Demo,

The offset would have to be added/subtracted from the values unfortunately. The only other way would be to put it in a constant and have that incorporated into the design of the program. I don’t think this has yet been done. But I could be wrong.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support

Bill Chennault
11-27-2006, 10:20 AM
Chris--

While the PSCI software is really designed for a host PC connected to the USB-PSC, it is possible to migrate your sequences to the BASIC Stamp 2.
I just received a PSC. (By the way, I could not but notice that although Parallax is closed, some of you continue to service this forum . . . thank you.)

So (assumptions!), the PSC is "programmed" via the PC host. However, the PSC may be powered by the BOE (my case). I am making a WAG that I can send commands from the BOE to the PSC, as well, since you stated that values stored in DATA statements can be sent to the PSC from the Stamp.

--Bill

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
You are what you write.

Chris Savage
11-27-2006, 12:42 PM
Bill,

You’re welcome! The PSC isn’t programmed but rather receives serial messages. Whether those are being sent by the PC or by a BOE doesn’t matter the messages will be the same. So the trick is to know exactly what and when the PC is sending serial data to the PSC. This should be fairly easy to figure out by the information on each frame of the sequence. The only time I can see it being a real chore programming wise is if you have a lot of servos moving at the same time in a lot of complex patterns. Even then the code for the Hex Crawler serves as a good example of how to do what I am referring to. The patterns for the walking gaits are stored in DATA statements which are sent to the PSC by a BS2. That is probably the best example I can think of and would be worth checking out since there are 12 servos on a Hex Crawler. I hope this helps. Take care.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support

demo
11-28-2006, 02:39 AM
Hi,

Thanks for the tip to Hex Crawler, will look in to those codes.

Now I have troubles to BS2SX (BOE) find the PSC, here's the code I've used:

' {$STAMP BS2sx}
' {$PBASIC 2.5}
Sdat PIN 15 ' Serial Data I/O pin
Baud CON 396 ' Constant for 2400 baud
buff VAR Byte(3) ' temporary variable
FindPSC: ' Find and get the version
DEBUG "Finding PSC", CR ' number of the PSC.
SEROUT Sdat, Baud+$8000, ["!SCVER?",CR]
SERIN Sdat, Baud, 500, FindPSC, [STR buff\3]
DEBUG "PSC ver: ", buff(0), buff(1), buff(2), CR
STOP

It seems to have some sort of connection to PSC, since the green led starts to blink, but it doesn't receive the version. Debug window loops 'Finding PSC'

Chris Savage
11-28-2006, 05:53 AM
Demo,

396 is the baud rate constant for the BS2. For the BS2sx it is 1021. You will find many values on the BS2sx are different than the BS2 for timing-dependant commands. I would recommend going through some of the instructions to get an idea. Some that are affected are SERIN/SEROUT, PULSIN/PULSOUT, FREQOUT…I hope this helps. Take care.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support

demo
11-29-2006, 02:33 AM
Hi Chris,

Thanks a lot for the information!

Demo