Help with RS232 Control

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Kevin D
    Ultra Senior Member
    • Oct 2002
    • 4601

    #1

    Help with RS232 Control

    I'm having a hard time trying to figure out RS232 control of a 1055. I'm using a third party control system and this is one of my largest programming jobs so far. Previous systems have been through IR or straight RS232 ASCII strings. Really two questions.

    1: What is the 1055 looking for, hex or binary; and do I need to include the 0x headers with every item.

    2: I'm new to checksums and could use some advice on how to calculate them.

    I guess I need to see a command, the correct format that needs to be sent to the unit, and how you arrived at the checksum. I'm sure it's not that hard to get the rest of the commands once I see how one is done.

    Thanks!

    Kevin D.
  • simonb68
    Senior Member
    • Jan 2003
    • 101

    #2
    Kevin

    I wrote a little VB program a while back to control the 1055 via RS232, source is here http://www.sbarnard.nildram.co.uk. The 1055 takes ASCII strings, have you obtained the RS232 spec from the Rotel web site, this, kind of, explains how its all done.

    Checksums are calculated on the entire message string, excluding the 0xfe header and obviously the checksum field at the end. The method to calculate the checksum is to sum the ASCII values of all the characters in the string then mod 256. This value must then be converted to a string, appended to the message string, and the 0xfe header stuck on the front.


    Example command/message string to Mute the 1055 (excluding header and checksum)

    CHR(3) + CHR(195) + CHR(16) + CHR(30)

    which equates to

    Count (bytes from ID to data, always 3) + Unit Type (fixed for 1055) + Command Type (fixed for a Command message) + The Mute Command (see RS232 spec)

    This is the string that the checksum is then calculated on

    Example Basic code to calculate checksum

    Private Function CreateChecksum(strText As String) As String
    Dim i As Integer
    Dim intCS As Integer

    CreateChecksum = ""
    intCS = 0
    For i = 1 To Len(strText)
    intCS = intCS + Asc(Mid(strText, i, 1))
    Next i
    CreateChecksum = Str(intCS Mod 256)
    End Function


    And then example code to send the entire command, note the command string being wrapped by the header and checksum.

    Public Sub SendCommand(intCommand As Integer)

    Dim strOutTemp As String
    Dim strOutput As String

    strOutTemp = Chr(3) + g_strUnit + Chr(16) + Chr(intCommand)
    strOutput = Chr(254) + strOutTemp + Chr(CreateChecksum(strOutTemp))
    frmDisplay.MSComm1.Output = strOutput

    g_filBufferLogFile.WriteLine ("SendCommand: " & strOutput)

    End Sub

    -----------------

    Please feel free to download and make use of the source code, if you need further help dont hesitate to drop me an email - barnards@nildram.co.uk

    Hope that helps
    Simon

    Comment

    Related Topics

    Collapse

    • mazuly
      Connecting to RSP-1098 through RS232
      by mazuly
      Hi Guys,

      I am really lost at this since I am very much computer illiterate. I am trying to send a simple command to RSP-1098 (power on) from my laptop and it does not work. Can someone tell me what I need to do to send this command using windows hyper terminal? Is it even possible to...
      24 January 2004, 18:09 Saturday
    • roscoe62
      RSP976 RS232 woes
      by roscoe62
      Hi there!

      I am trying to get my HTPC to send RS232 commands to my Rotel RSP976 but I'm not having much luck!

      I purchased a PCI card that adds 2 comm ports to my PC (com3 & 4) and they show correctly in XP. I constructed the cable as outlined on this fine forum and I'm...
      24 November 2003, 16:39 Monday
    • audioqueso
      RS232 and Controlling the volume of an AV Receiver
      by audioqueso
      Does anyone know how to set up a HTPC to control the volume for of a pre-amp/receiver with RS232?

      I have my Harmony remote that controls everything. HTPC to Marantz SR7002 to speakers. I have controlled my HTPC in the past with the Harmony when the OS was Windows XP. The problem is...
      26 April 2011, 02:16 Tuesday
    • madmac
      12 String nightmare !
      by madmac
      You know......I finally got the courage to sit down and re-string my 12 string acoustic. It's quite the project and I usually avoid it as long as possible :M . It's kinda' like working with spaghetti really. The effort pays off in the end with fantastic, clear sound with fantastic overtones...etc....
      07 September 2016, 06:52 Wednesday
    • simonb68
      PC RS232 controller for Rotel gear
      by simonb68
      I have written a simple VB program to control certain Rotel gear via the RS232 interface, available on my highly polished web site here http://www.sbarnard.nildram.co.uk/ :alol:

      Its not quite complete, there are a few buttons missing and the display can get corrupted sometimes. I'm...
      03 March 2003, 17:33 Monday
    • Loading...
    • No more items.
    Working...
      Searching...Please wait.
      An unexpected error was returned: 'Your submission could not be processed because you have logged in since the previous page was loaded.

      Please push the back button and reload the previous window.'
      An unexpected error was returned: 'Your submission could not be processed because the token has expired.

      Please push the back button and reload the previous window.'
      An internal error has occurred and the module cannot be displayed.
      There are no results that meet this criteria.
      Search Result for "|||"