Announcement

Collapse
No announcement yet.

Help with RS-232 Send Command

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Help with RS-232 Send Command

    Hi,

    I could really do with a wee bit of a pointer, I've been trying to control the volume on a Allen and Heath DR66 via RS-232, by having two buttons on an x10 remote as (VOL+) and (VOL-)

    The problem is that the strings you send to the DR66 have to end in the value you want for the volume (0-127), so there is no incremental (volume up and volume down) command!

    That means I have to store the current volume (0-127) as a varible in script and then pop it into the end of the string with either a + or a - to raise or lower volume.

    This is how I have seen it done in AMX programming for Allen and Heath protocol to raise the volume in +2 steps (where oup1Level is the stored value)

    IF(oup1Level <127)
    {
    oup1Level = oup1Level +2
    SEND_STRING DR66,"$B0,$63,$01,$62,$1B,$06,oup1Level"
    }
    Anyone have any ideas how I could do the same thing using SendToCOMPort?

    Thanks!

    #2
    Here's how I'm getting on so far:

    I have written variables to the startup script for all my volume levels
    hs.SaveINISetting "settings","vol1","75","my_settings.ini"
    hs.SaveINISetting "settings","vol2","75","my_settings.ini"
    hs.SaveINISetting "settings","vol3","75","my_settings.ini"
    hs.SaveINISetting "settings","vol4","75","my_settings.ini"
    hs.SaveINISetting "settings","vol5","75","my_settings.ini"
    hs.SaveINISetting "settings","vol6","75","my_settings.ini"
    This works fine, next I use this script to send the commands to the DR66 (this is Volume Up on CH1)
    sub Main()
    dim volume
    volume = hs.GetINISetting ("settings","vol1","","my_settings.ini")
    volume = volume + 2
    hs.OpenComPort 1,"9600,n,8,1",0," "," "
    hs.SendToComPort 1, CHR(190)
    hs.SendToComPort 1, CHR(239)
    hs.SendToComPort 1, CHR(03)
    hs.SendToComPort 1, CHR(06)
    hs.SendToComPort 1, CHR(00)
    hs.SendToComPort 1, CHR(186)
    hs.SendToComPort 1, volume
    hs.SaveINISetting ("settings","vol1",volume,"my_settings.ini")
    hs.CloseComPort 1
    end sub
    Now, it works ok up until I try to save the "dim volume" back into the INI, then I get the error:

    Error 1044:Cannot use parentheses when calling a sub in line 23

    anyone know who to put this in with the right syntax?

    Thanks!!

    Comment


      #3
      Got it!

      It was the brackets round the SaveINISettings parameters, somehow it liked it at the start but not for the second time round

      Happy days
      Last edited by ; November 29, 2006, 04:59 AM.

      Comment


        #4
        You can save a few lines of code by concatenating this into one string if you want:

        Code:
        hs.SendToComPort 1, CHR(190) & CHR(239) & CHR(03) & CHR(06) & CHR(00) & CHR(186) & volume

        Comment


          #5
          Originally posted by jhisr
          You can save a few lines of code by concatenating this into one string if you want:

          Code:
          hs.SendToComPort 1, CHR(190) & CHR(239) & CHR(03) & CHR(06) & CHR(00) & CHR(186) & volume
          Nice one! thanks for the tip!

          Comment

          Working...
          X