Send ASCII String as Command to Modbus Ethernet Device

Hello Precious Developers,
How do we send the following string command from a PC to a Modbus Ethernet device at starting address 411000 using LVDSC:
"<ID 0><CLR><WIN 0 0 287 31><POS 0 0><LJ><BL N><CS 2><RED><T>H</T>""$0D""$0A"
(Function code 16 - Write multiple Holding registers)
Any pointers / suggestions / example code shall be deeply appreciated.
Solved!
Go to Solution.

hi,
I implemented your solution but when there is an odd number of character, the last character is not included in the  u16 array. Is my implemented correct?
Regards,
Cedric
Attachments:
string_transfert_MODBUS.vi ‏7 KB

Similar Messages

  • How can I send multiple string commands into a VISA write?

    Hi Fellow LabVIEW users
    I am very new to LabVIEW (2.5 months) so please forgive me if my lingo is not up to par.
    How can I send multiple string commands to a VISA write. For example each string command looks like this
    1) 3A00 0000 0000 FFFF FFFF FFFF 0000 0000 FF00 0000 0000 0000 0000 0033 (Scenario 1)
    2) 3A01 0000 0000 FFFF FFFF FFFF 0000 0000 FF00 0000 0000 0000 0000 0034 (Scenario 2)
    3) 3A01 0000 0000 33FF FFFF FFFF 0000 0000 FF00 0000 0000 0000 0000 0067 (Scenario 3).
    and so on and so forth. And there are a number of scenarios.
    Each String scenario will give a different string output which will be interpreted differently in the front panel.
    Right now I have to manually change the string commands on the front panel to give me the desired output. How can I do this without manually changing the commands i.e. hard coding each scenario into the block diagram?
    Thanks, any feedback will help.
    mhaque

    Please stick to your original post.

  • Modbus ethernet driver not sending complete packet

    Hello,
    I have a modbus ethernet driver sending out Floating point data (F0002-F0026) once per machine cycle for spc collection.  The problem is that the last float32 is getting cut in half and the data is not coming across.  To remedy this, I have set up an additional register (F0028).
    Attached is a screenshot of my advanced modbus settings and the ini file.  Would any of these settings contribute to the problem?
    Thanks,
    Steven
    Attachments:
    Modbus Ethernet.zip ‏119 KB

    Hi Pratik,
    Are you using bufmod module for buffering the data? If so, then you must be using SBIOCCHUNK ioctl to increase the streams watermarks? problem with this is that bufmod can only increase the watermarks to 64K, which may not always be sufficient for all the DLPI applications.
    There is a way to increase the system-wide streams watermarks using adb if you don't want to write a module to use M_SETOPTS. Please provide your email address if you need more information.
    Regards,
    Sun/DTS

  • Sending a string over ethernet at 1 Hz.

    I am trying to send a string file at 10 Hz over ethnet to another PC. It is a motion file.  I am enclosing a snippet of the file below.
    START_TIME,24-OCT-2004 16:44:54,0 00:02:21
    00:00:00,INIT_POS,v1_m1,33.7487,-118.035,16.97
    AR
    RU
    00:00:00,mot,v1_m1,-2495192.9594000001,-4685876.5558000002,3523316.4575999998,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
    00:00:00.100,mot,v1_m1,-2495192.9594000001,-4685876.5558000002,3523316.4575999998,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
    00:00:00.200,mot,v1_m1,-2495192.9594000001,-4685876.5558000002,3523316.4575999998,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
    00:00:00.300,mot,v1_m1,-2495192.9594000001,-4685876.5558000002,3523316.4575999998,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
    00:00:00.400,EN,0,0

    Do you have a question related to this?

  • Modbus Ethernet U16 vs I16 Data type

    Hi,
       I'm re-writting a piece of code that communicates Modbus Ethernet to the downstream device.   I'm using the Labview Modbus Library VIs.
    The machine variables that I am trying to write are I16 (ie. I'm trying to write the value -22) but the Labview MBE library writes the values as U16.  
    The U16 value that it generates is 65514 (from a I16 input of -22) 
    anyone have an idea how I should fix this?   Would it be worth it to rewrite the Library files to output I16 instead of U16... I'm nervous this might cause other problems? 

    Either typecast it or use the To U16 bullet to convert the number.
    Or have you just tried wiring it up to see if it works?
    The VISA functions just send it out as bytes in a string.  So your device will just interpret the bytes how it sees fit.
    Attachments:
    Example_VI.png ‏5 KB

  • Set Digital Output for Modicon 340 through Modbus Ethernet

    Hello,
    I used modbus Ethernet example vi and am able to read input coil status of quantity 512
    If starting address is changed above 511, VI returns 6002 error.
    As per below concept, how can I write  to output coil
    Output Coils are assigned the block 1-9999
    Input Coils are assigned the block 10001-19999
    Input Coils are assigned the block 10001-19999
    Input Register are assigned the block 30001-39999
    Output Register are assigned the block 40001-49999
    I also tried sending command directly to TCP IP write like 05 00 AC FF 00 to set a coil. Still its not working.
    Can anyone inform how to proceed. Any example or command structure is highly helpful
    Thank you

    I don't see a "jacks" button on my console, therefore I can't reconfigure the jack to digital.
    Is this not available on the Go! unit?

  • How to read data from a GPIB when sending a function generator command

    I'm using Visual C++ with the ComponentWork ActiveX and I'm tring to plot a
    CWGraph using the data coming from a GPIB device. When I write command such
    as "*IDN?" to the GPIB device, everythings if fine and I can read what the
    GPIB device return me. But when I send a command like "SOUR:FUNC SIN;SENS
    DATA?", the writing seems to be okay, but when I try to read the data, I
    alway get a "Timeout expired before operation completed" error message. I
    have tried with the CWGPIB and with the CWVISA but the result are the same
    with both.
    My reading code looks like this:
    COleVariant vReadBuffer;
    vReadBuffer = m_VISA.Read( COleVariant( (short) 2000 ) );
    and it work fi
    ne for "*IDN?" or for multimeters command.
    I want to know how I must read the data for function generator commands.
    Thank alot

    It sounds like your device is not accepting that command string as valid. The string you listed above is probably missing a colon between SENS and DATA. "SOUR:FUNC SIN;SENSATA" Try sending this string in Measurement & Automation Explorer to the instrument first to make sure it is working.
    Best Regards,
    Chris Matthews
    Measurement Studio Support Manager

  • How can i write the floats value in Unitronics vision230 plc using modbus Ethernet

           How can i write the Float value in unitronics Vision230 PLC usinsg modbus ethernet (MB Ethernet Master Query.vi) I  read and write  the 32 bit register,  for e.g i want to write the 23.45 value on 2nd add. of MF. And MF register is 32 bit register. I  read and write  the 32 bit register.
    Narendra.
    Solved!
    Go to Solution.

     Thanks Amit for your solution but i can not use the string to write the value because  MB Ethernet master Query.vi only accepet the integer value its not take string values or any other i.e floats values etc.....otherwise i have  no problem to write or read the 32 bit register values , only problem is that the MB Ethernet master Query.vi only accept the integer value there4 how can write the float value.
    Narendra
    Message Edited by Artemistech on 01-30-2009 11:06 PM

  • Convers ascii string to hex string

    I need to send a hex string such as 5051525354A5A6A7A8A9 to a DSP across a serial port.  The string is read in from a file.
    When I send this string to the DSP, it does not recognize the correct hex values.
    If I enter the hex value, 5051525354A5A6A7A8A9, in to a string control that is set to hex display and then change the control to normal display, I get PQRST¥¦§¨©.  When I send this string,  PQRST¥¦§¨©, to the DSP, it recognizes the correct hex values. 
    How can I change the hex string read from the text file to this type of ASCII character conversion?  I've used type cast and the other functions available in LabVIEW with no success.
    This is only one of many strings I need to send so I don't want to hard code PQRST¥¦§¨© or some such string for each message.

    Here's a slightly simpler way.
    Message Edited by altenbach on 08-23-2007 12:17 PM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    HexStringtoBinaryString.png ‏10 KB
    HexStringtoBinaryString.vi ‏11 KB

  • Modbus Ethernet Slave coils and discrete inputs

    Hi,
    I'm having serious problems in the comunication of more than 16 bits for coils or discrete inputs.
    In this forum i've read some few post about this matter, tried the possible solution but got nothing working.
    Guess that there is some kind of limitation or error in the ModBus modules available at the NI Labview webpages.
    The idea is very simple:
    I want to be able to sent 32 bits of coils from the ModBus Ethernet Master to the slave and sent 64 bits of discret inputs from the ModBus Ethernet Slave to the Master.
    Can someone please give me a push? Im' kind of newbie with the Labview and would apreciate if someone that had this problem resolved could guit me a hint.
    My best regards, Jorge
    Solved!
    Go to Solution.

    Hi Jorgelopes,
    thank's for posting  on National Instruments forum.
    Can you tell me if you want to communicate with an automate or a computer.
    If you do not tried between two computer I suggestion to make the test.
    Can you send the VI with which you encounter this trouble?
    Best regards,
    Flo
    Open Diagram First

  • Button hangup with modbus + and modbus ethernet protocol using lookout 6.0.2

    I have lookout 6.0.2 HMI software connected to a network of modicon 984 compact PLC's using modbus + protocol, Control techniques Uni-Drives using modbus ethernet protocol, and Direct logic plc's using their ECOM protocol. I have all of the control objects built in the client process and all of the drivers are in the server process. I use a static symbolic link to connect all of the objects to the drivers in the server. My problem is every once in a while, one of the buttons will hang up and hold true until the button is pressed again.  I also noticed this only happens with objects that have a modbus + or modbus ethernet protocol. I've never experienced this problem with objects connected to direct logic plc's. I saw a posting related to this a while back but saw no solution to the problem.  Can anyone help?
    Haj

    I have never met this problem before. I tried for a while but failed to reproduce. I think it relates to how the button works. Lookout pushbutton sends out true value when you press it, not like the button of windows which takes effect when released. Could you try the CWButton, instead of pushbutton. Maybe it makes a difference.
    Ryan Shi
    National Instruments

  • How can I convert an ASCII string of variable length to a HEX number?

    Hello,
    I read data from the serial port 5 times in a second (while loop) and the number of bytes read varies every time.
    The data comes in as ASCII string, and I can see the HEX representation if I connect a HEX string indicator, but I need to permanently convert data to a HEX number. 
    How can that be done?

    Like This.
    Ton
    Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
    Nederlandse LabVIEW user groep www.lvug.nl
    My LabVIEW Ideas
    LabVIEW, programming like it should be!

  • How to implement Modbus Ethernet communicat​ion in Lookout, if we want to simulate the PC as PLC ?

    Problem Description :
    Dear Sir,
    We are doing a project where we are using Lookout with
    Front end Modicon PLC. The communication is by
    Ethernet, using Modbus.
    Since the installation is at a distant place, we wanted
    to use another PC (running Lookout) to simulate the
    PLC. For this, we tried to communicate
    a: the server Lookout PC running Modbus Ethernet mode of
    Modbus object as Master
    b: with another PC (for simulating the PLC) running
    Modbus Slave
    We did not get any communication. (we have given the
    details of what we have done, at the end of this email)
    We also tried connecting the above 2 PC's as
    a: the server Lookout PC running Modbus Serial mode of
    Modbus object as Master
    b: with another PC (for simulating the PLC) running
    Modbus Slave object
    Again we did not get any communication.
    If instead of PC (b) we connect the Modbus simulator to
    PC (a), there is no problem in communicating
    Please let us know how to go about establishing the
    communication between 2 PC's using Modbus serial,
    and Modbus Ethernet. A detailed step by step procedure
    would help us a lot.
    Thanking you
    Warm Regards
    Raja Mahbubani
    Procedure of our trial with ethernet.
    This is what we have done in detail.
    On PC A:
    We created an object (Pot) and connected it to
    the modbus data member of the modbus object say 40001. In the
    properties of the modbus object we selected modbus ethernet mode
    of communication and in the IP address field we wrote the IP
    address of the machine B to which we are trying to communicate
    i.e. 152.63.50.2.
    On PC B: we tried the following two methods
    Trial 1 : We created a modbus slave object and
    inserted an expression for the same data memeber to which the
    object was connected hoping to get the value of the pot of machine
    A on machine B.
    Trial 2 : We created a modbus object on machine B and we wrote
    the IP address of machine A and inserted an expression for the
    same datamemeber to which the object was connected hoping to get
    the value of the pot of machine A on machine B.
    NI Software : Lookout
    Version : 4.0.1 or 4.5
    OS : Windows 98
    NI Hardware : N/A
    Drivers : N/A
    Other Hardware/Instruments : N/A
    CPU : Pentium
    RAM : 64
    Vendor : S-Tech
    Customer Information :
    Raja Mahbubani
    Theta Controls
    IN
    [email protected]
    Ph: (+91) 20 4222556/7

    The ModbusSlave which comes with Lookout currently supports only Serial communication. So, you cannot use Ethernet between your two PCs. At least not with Modbus Master-Slave setup (if you must speak Ethernet between the two PCs, IPASCII object lets you do that, but then you'll need to implement your own protocol).
    Since all you want to do is simulate a Modbus PLC on a PC, you can use the Serial mode of communication for now. And later on just modify the Object in your Server Lookout to use the Ethernet mode.
    For setting up a Serial Modbus Slave, use a null-modem cable between the two PCs (lines 2 and 3 are swapped). On your PC 'B,' create the Modbus Slave object with the right COM port for that PC. And on your PC 'A' create the regular Modbus Object as if you w
    ere connecting to the Modbus Simulator box. The only difference here is the cable. The simulator box uses a straight-through cable whereas the Slave needs a null-modem cable.
    Hope this helps.
    Rgds,
    Khalid

  • How to send a String to a Servlet using a HTTP POST

    Well, I have designed a servlet that receives a HTTP POST, I was testing it using an HTML form to send (using POST) information, now, I have coded a Java App to send it a string, I don't know how to make the servlet recognize that info so it can make its work, I am posting both codes (Servlet & API) so anyone can guide me and tell me how and where to modify them
    Servlet:
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import java.sql.*;
    public class xmlwriter extends HttpServlet
    public void service(HttpServletRequest req, HttpServletResponse res)
    throws ServletException, IOException
    ServletOutputStream salida = res.getOutputStream();
    res.setContentType("text/HTML");
    String cadena = req.getParameter("cadena");
    File f1 = new File ("c:/salida.xml");
    FileWriter out = new FileWriter(f1);
    f1.createNewFile();
    out.write(cadena);
    out.close();
    salida.println("OK");
    Now, the JAVA API is:
    import java.io.*;
    import java.net.*;
    public class HTTPSender {
    public static void main(String[] args) throws Exception {
    URL url1 = new URL
    ("http://localhost:8080/XMLSender/xmlwriter");//internal site
    URLConnection UrlConnObj1 = url1.openConnection();
    HttpURLConnection huc1 = (HttpURLConnection)UrlConnObj1;
    huc1.setRequestMethod("POST");
    huc1.setDoOutput(true);
    huc1.setDoInput(true);
    huc1.setUseCaches(false);
    huc1.setDefaultUseCaches(false);
    String cadena = ""
    + "<root>\n"
    + "<tlf>$TLF$</tlf>\n"
    + "<op>$OP$</op>\n"
    + "<sc>$SC$</sc>\n"
    + "<body>$BODY$</body>\n"
    + "</root>";
         PrintWriter out = new PrintWriter(huc1.getOutputStream());
    System.out.println("string="+cadena);
    out.write(cadena);
    out.close();
    I'm a JAVA newbie, so, maybe I'm getting a bad idea of what I need to do, anyway, every (detailed) help is welcome. What my servlet should do (and it doesn't when I send the message through the API) is to write a file with the info received.

    I'm not trying to send a string from a WEB Page, I'm tryring to send it using a JAVA program, I mean, using a HTTPSender, in fact, I already have made the code to do that:
    import java.io.*;
    import java.net.*;
    public class HTTPSender {
    public static void main(String[] args) throws Exception {
    try {
    String cadena = "Message to be written";
    // Send data
    URL url = new URL("http://localhost:8080/XMLSender/xmlwriter");
    URLConnection conn = url.openConnection();
    conn.setDoOutput(true);
    OutputStreamWriter wr = new OutputStreamWriter(conn.getOutputStream());
    wr.write(cadena);
    wr.flush();
    // Get the response
    BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
    String line;
    while ((line = rd.readLine()) != null) {
    // Process line...
    wr.close();
    rd.close();
    } catch (Exception e) {
    And modified my servlet so it can receive anything:
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import java.sql.*;
    public class xmlwriter extends HttpServlet
    public void service(HttpServletRequest req, HttpServletResponse res)
    throws ServletException, IOException
    ServletOutputStream salida = res.getOutputStream();
    res.setContentType("text/HTML");
    String cadena = req.toString();
    File f1 = new File ("c:/salida.xml");
    FileWriter out = new FileWriter(f1);
    f1.createNewFile();
    out.write(cadena);
    out.close();
    salida.println("OK");
    Now the problem is that, the servlet in fact DOES create the file, but....the file is empty, that means that no info is arriving to the servlet, why?, how should I send it then? I repeat FORGET about a Web Page Form, that is in the past and I don't need that.

  • How to send a string from sender to receiver side using java

    I am doing a project on Digital Signature.I have already done with the GUI using java swing.
    Now i want to send a string from the sender side to the receiver side on the click of a button using socket programming.
    Please can anybody provide me with the code as early as possible.

    http://catb.org/~esr/faqs/smart-questions.html

Maybe you are looking for

  • Ipad does not appear as device on macbook

    Can't see my ipad as a device on my macbook. Managed to synch properly when Ipad was new. Just installed snow lepoard mac beeps when USB is connected but never shows up in Itunes

  • SQL Adapter Crashes with large XML set returned by SQL stored procedure

    Hello everyone. I'm running BizTalk Server 2009 32 bit on Windows Server 2008 R2 with 8 GB of memory. I have a Receive Port with the Transport Type being SQL and the Receive Pipeline being XML Receive. I have a Send Port which processes the XML from

  • Canon 8400F Scanner possible fix for Leopard

    The fix described by DickVH here definitely works for me with a Canon 8400F... http://discussions.apple.com/thread.jspa?threadID=1199504&start=100&tstart=0 I am using MacOSX 10.5.1, Canoscan Toolbox X (cstbosx4934ej4 install) and the current driver (

  • How do I deauthorize a device I've already sold?

    I currently have 4 devices authorized to my Apple ID: My MacBook, my iPhone, my iPod touch and my iPad. The problem is, I've copmletely wiped and logged out of all accounts on my iPad, and sold it. I'm not sure if it's still authorized to my Apple ID

  • User exit for ML81N after SAVE

    I need a User exit for Service Entry Sheet change after the user has Saved the release. I need to update a customized "Z" table when a Service Entry is released from ML81N. I need to ensure the Service Entry is saved with release status. The user-exi