Open the serial port & send data out

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • philton
    Forum Member
    • Jul 2005
    • 5

    Open the serial port & send data out

    Dose anyone know how to open the serial ( comm port ) & send data Out?
    any help would be a great help....
  • Worm
    Indigo Rose Customer
    • Jul 2002
    • 3971

    #2
    Here's a dll that will do as you ask...

    BTW, you'd probably do better by posting in the AMS forums rather than General Chat
    Attached Files
    Last edited by Worm; 07-28-2005, 12:30 PM.

    Comment

    • Corey
      Indigo Rose Staff Alumni
      • Aug 2002
      • 9745

      #3
      [teleport]BOINK![/teleport] :yes

      Comment

      • Worm
        Indigo Rose Customer
        • Jul 2002
        • 3971

        #4
        sResult = ComSend("COM3", 9600, 8, 0, 1, [["01@""test.mpg""SE"]].."\r\n")

        Comment

        • philton
          Forum Member
          • Jul 2005
          • 5

          #5
          Originally posted by Worm
          Here's a dll that will do as you ask...

          BTW, you'd probably do better by posting in the AMS forums rather than General Chat
          Thanks for your help...

          I cant see anything when i open your app & when i compile it ams crashes?

          Can you help...

          Comment

          • Worm
            Indigo Rose Customer
            • Jul 2002
            • 3971

            #6
            What version of AMS are you running?

            Comment

            • philton
              Forum Member
              • Jul 2005
              • 5

              #7
              Originally posted by Worm
              What version of AMS are you running?
              Running Version 5

              Comment

              • Worm
                Indigo Rose Customer
                • Jul 2002
                • 3971

                #8
                Standard or Professional?

                and is it 5.0.3.0?

                Comment

                • philton
                  Forum Member
                  • Jul 2005
                  • 5

                  #9
                  Originally posted by Worm
                  Standard or Professional?

                  and is it 5.0.3.0?
                  Professional 5.0.0.4

                  Comment

                  • Worm
                    Indigo Rose Customer
                    • Jul 2002
                    • 3971

                    #10
                    Update your AMS, and try again.

                    Open up AMS and press F9



                    Originally posted by philton
                    Professional 5.0.0.4

                    Comment

                    • columbo
                      Forum Member
                      • May 2007
                      • 9

                      #11
                      Hello all !

                      i use this code
                      function ComSend(sPort, nBaud, nDatabits, nParity, nStopBits, sOutput)
                      return DLL.CallFunction("AutoPlay\\Docs\\wComSend.dll", "ComSend", "\""..sPort.."\","..nBaud..","..nDatabits..","..nP arity..","..nStopBits..",\""..sOutput .."\"", DLL_RETURN_TYPE_STRING, DLL_CALL_STDCALL)
                      end
                      sResult = ComSend("COM2", 115200, 8, 0, 1, "AA")
                      Dialog.Message("Result", sResult)
                      The problem is the data sent is not AA but AA..
                      and the two caracters .. at the end is very problematic for me.
                      Other thing, is it possible with this ddl to send data in hex mode ?

                      If someone have a idea please.. Thanx

                      Comment

                      • Stobe
                        Forum Member
                        • Jan 2004
                        • 51

                        #12
                        Hello,

                        I'm trying out this dll, and I just need to send 4 bytes to a device. The manufacturer of the device supplies a crude software that does just that, but Indigo Rose has me constantly thinking that I can build a better mousetrap.

                        The software that works, shows the data sent as "H01 H81 H81 H81" (4 hex bytes) and it does what its supposed to.

                        I've tried the comSend.dll with the following entries to the "sOutput" call to the dll, with no luck yet:

                        "H01 H81 H81 H81"
                        "01818181"
                        01818181
                        "0000000000000001000010000000000100001000000000010 000100000000001"
                        00000000000000010000100000000001000010000000000100 00100000000001
                        (those last two being the decimal equivalent of the hex above)

                        What am I missing? How should I format the data being sent?

                        Also, is there any dll that will read back the response from the device (being received as the same formatted serial traffic)? I noticed the examples calls for a dialog box after the command is sent.

                        Thanks for any help, as always!
                        -Stobe

                        Comment

                        • Worm
                          Indigo Rose Customer
                          • Jul 2002
                          • 3971

                          #13
                          81 HEX = 129 Decimal,

                          Maybe try

                          "1 129 129 129"

                          Comment

                          • Ulrich
                            Indigo Rose Staff Member
                            • Apr 2005
                            • 5130

                            #14
                            Originally posted by Stobe View Post
                            I'm trying out this dll, and I just need to send 4 bytes to a device.

                            The software that works, shows the data sent as "H01 H81 H81 H81" (4 hex bytes) and it does what its supposed to.
                            I would try to convert these four bytes into a string and send them out. Hexa 81 equals to 129 decimal.

                            Code:
                            output = string.format("%c%c%c%c", 1, 129, 129, 129);
                            sResult = ComSend("COM2", 115200, 8, 0, 1, output);
                            I have never used that dll, so I can't be sure if this works. Maybe the string has to be zero-terminated to work properly, in this case you should do this:

                            Code:
                            output = string.format("%c%c%c%c%c", 1, 129, 129, 129, 0);
                            sResult = ComSend("COM2", 115200, 8, 0, 1, output);
                            Hope this helps.

                            Ulrich

                            Comment

                            • Stobe
                              Forum Member
                              • Jan 2004
                              • 51

                              #15
                              Thanks. I tried the decimal equivalent with no success.

                              I'm using a serial port monitor now that shows everything getting sent. Here is what the product's software sends:

                              Port opened by process "Protocol-2000.exe" (PID: 628)

                              01 81 81 81 .

                              Port closed


                              (the symbols on the right side show up as rectangles on the screen before I copy/paste them)

                              And here is what my program is sending, when I send a single digit 1 (and also the same for "1" in quotes)

                              Port opened by process "autorun.exe" (PID: 3332)

                              00 0D 0A 31 0D 0A ...1..

                              Port closed

                              Comment

                              Working...
                              X