May 17, 2024, 06:05:21 AM

News:

Got VSA?  Want to use your Prop-SX?  Now you can!  See the VSA section of the Library forum for Prop-SX code that works with VSA.


Using VSA to control the HC-8+

Started by spookylake, September 17, 2013, 02:37:15 PM

Previous topic - Next topic

spookylake

I'm looking to find info on what "settings" within VSA to use for communications with the HC-8+

is there an "add-in" that i need to load into the VSA for communications or am i to use one of the existing?

I use VSA already but i want to edit the show to work with the HC-8+.

I attached my old VSA routine just for giggles.

i like VSA's flexibility and ease of use.  You can also use MonkeyBasic addins with VSA for joystic control of servos and other programs.

Basically i'm just looking for info on the initial setup for communicating with HC-8+.  We'll proceed later from there as needed.

bsnut

You may take a look at this topic that Jon started http://www.efx-tek.com/php/smf/index.php?topic=1905.0 if you haven't done so. It plays back one of your eight VSA shows that you created and stored on your SD card and plays them on the HC-8 outputs by pressing one of the eight TTL inputs.
William Stefan
The Basic Stamp Nut

JonnyMac

September 18, 2013, 02:06:37 PM #2 Last Edit: September 18, 2013, 02:08:32 PM by JonnyMac
What you need is a program for the HC-8+ that can intercept the serial stream from VSA and convert it into servo positions or light levels, depending on channel assignments. In order to simplify our code, we have settled on the MiniSSC protocols (VSA has one called MiniSSC Servo, one called MiniSSC Dimmer, and on called MiniSSC Relay (though that rarely gets used).

The reason for using this is that the protocol is very simple and easy to interpret. Each channel starts with a sync byte $FF, followed by the channel value (0..n), followed by a level (0..254). For servo channels we scale the 0.254 value to 600.2400 before sending to the servo driver.

Here's the core of the protocol interpreter that is in my VSA streamer program

  ' MiniSSC protocol state-machine ensures proper channel updates,
  ' even with comms drop-out errors
 
  state := 0

  repeat
    case state
      0: { sync }
        set_rgled(OFF)
        sync := serial.rx
        if (sync == $FF)                                        ' wait for sync byte
          state := 1
          set_rgled(GRN)                                        ' show start of packet

      1: { channel }
        ch := serial.rxtime(3)
        if (ch < 0)                                             ' timeout?
          state := 0
        elseif (ch == $FF)                                      ' re-sync?
          state := 1
        elseif (ch < CHANNELS)                                  ' valid?
          state := 2                                            ' -- yes
        else
          state := 0                                            ' -- no, back to top

      2: { position / value }
        pos := serial.rxtime(3)                                 ' get position/value
        if (pos < 0)                                            ' timeout?
          state := 0
        elseif (pos == $FF)                                     ' re-sync?
          state := 1                                       
        else
          update_channel(ch, pos)                               ' no, update channel



Note that it calls the update_channel() method; this takes care of servo versus dimmer and local versus remote (via DMX) channels.

pub update_channel(ch, value) | pos, level

  if (ch < 8) { local }                                         ' local channel?
    case ChMode[ch]
      T_SERVO:
        pos := ssc_scale(value, SVO_MIN, SVO_MAX)               ' scale for servo
        svos.set(ch, pos, 0)
     
      T_DIMMER:
        outs.set(ch-SERVOS, ssc_to_dmx(value))                  ' fix for dimmer
     
      T_RELAY:
        if (value => 128)                                       ' at/above half point?
          outs.high(ch-SERVOS)                                  ' -- yes, turn on
        else
          outs.low(ch-SERVOS)                                   ' -- else turn off

  if (USE_DMX) { remote }
    dmx.set(ch+1, ssc_to_dmx(value))                            ' echo to DMX



Let me just say up front: this stuff is not hard once you have a little Propeller programming experience under your belt.

Jon McPhalen
EFX-TEK Hollywood Office

spookylake

the heck with this......is there a program to convert my VSA programs to Vixen?

I love VSA but it's just not flexible enough for what i want to control.

any help is appreciated

bsnut

I don't think there is a program that would convert the VSA into Vixen. What you have to do is do what Jack did and copy the sequences over manually into Vixen.
William Stefan
The Basic Stamp Nut