Dsc modbus - Serial communication input/holding registers

Hello,
I am trying to create a labview application to act as a Modbus master and control multiple stepper motors. I have the DSC module in labview and am using a serial communication with an RS-485 converter. I have followed this guide: http://www.ni.com/white-paper/13911/en/  However, the driver I am using does not support coils, it only uses input and holding registers and I have not found a guide or tutorial that shows me how to create a labview application that can read and write to a specific address. For now all I want to do is turn the motor on and off using labview. I have used a modbus simulator to communicate with the driver and can do everything I want to do through the simulator. I can not get labview to do anything for me. I would be very happy if someone could direct me to a tutorial that can help me understand labview dsc module for reading and writing to addresses using modbus. 
Meesh

Ok, so this is really strange. I solved my problem in a round about sort of way. I'm using a modbus simulator (mdbus) to help me communicate with the driver/stepper motor so I know which address to use. But after I use the simulator I get a communication port error when I try to use Labview. It's like the port is locked in with the simulator and I can't end the connection and let Labview use the same communication port. I can't find anyway to fix the problem except going to this NI site: http://www.ni.com/download/labview-run-time-engine-6.1/746/en/  downloading this software and using the "repair" function. Then I can do a system restart and cycle the power on the driver/motor and then Labview with work again through the correct port. But if I need to use the simulator again then I have to go through this whole process again. Does anyone know what the heck is going on? Or if there is a better way to clear the communication port?? 

Similar Messages

  • Modbus - Issues with Reading Holding Registers

    I am trying to read the holding registers on a RS485 2 wire modbus power monitor (Veris Industries E50C2).I am receiving bytes from the device so there appears to be communication. However, the response string is the exact same string as my command string. For instance, I am sending the hexadecimal string 0103 0000 0005 in order to read the first 5 holding registers, but I am receiving this exact same string back via the read VISA read function. I have attached an image of my VI. I would expect to see the response as "0103 (the device ID and command) followed by the number of bytes to follow and the contents of the holding registers.
    The VI is running on a cRIO 9012 with 9111 chassis. I am using the 9871 c-series RS485/RS422 interface module.
    Any ideas what the issue may be?
    Kind Regards
    Adam
    Attachments:
    Modbus VI.png ‏15 KB

    I indeed manage to fix the issue for myself.
    I used the same method you are starting right now, i conencted the NI9871 to the rs485 adapter given by the supplier and tried sending and reading my own signals.
    After much hassle and some changes to your (and my) initial vi setup as shown in your first post, everything worked out fine:
    (see the attached picture)
    1. I used the NI modbus VIs, but it worked as well with the normal visa commands and building the modbus command on your own, but  way easier with the NI VIs.
    2. i added the function to resize the buffer to its maximum size (not sure if thats actually helping with anything, but better be safe then sorry).
    3. Change the wire mode for the 9871 to rs485/wire2-auto with a property node.
    4. remove the large delay between write and read
    5. Last but not least, the one thing that changed the fact that i only received my own echo:
    I changed the connection of the Rx+/Tx+ and Rx-/Tx- around, basically connecting the 2wire sensor the other way around the manufacturer said it should be connected to the master device.
    (6. Recheck the amount of stop bits, all modbus device i use in my lab are using 2 stop bits, but that could be a coincidence)
    Maybe  something of that list helps you
    Attachments:
    Modbustest01.jpg ‏95 KB

  • Serial communication input

    Hello Java Guru's
    I am new to java, and assisting a friend in writing Java POS System. I am trying to hard time figuring out how to receive input from bar code scanner. How do we open a channel to read data send by the bar code scanner? The barcode scanner is attached on a serial port on the computer.
    Sample code to open is highly appreciated. Many thanx for your help.
    Thank you.

    What OS are you using?
    Try using the rxtx library at www.rxtx.com or the javax.comm library from sun. Sun's comes with a little bit of code examples that might help.
    Here is a link to a thread for more information about the rxtx library.
    Hope this helps,
    Brandy

  • Failure of LabVIEW DSC 8.0.1 to yield values of Modbus RTU holding registers

    So, I know what I'm doing--or used to. Have done this before in LV 6 and 7. Previously used Lookout OPC drivers and the "Tag Engine".
    Recently with 8.0.1, I first set up the Industrial Automation OPC servers (AKA Lookout) to communicate with the holding registers (40,001-49,999) of my modbus rtu Watlow 96 and MLS316 temperature controllers. Subsequently, with the Server Explorer all of my 133 parameters on our 2 rs485 serial ports are communicating bidirectionally.
    So now Duh, why can I not bind a shared variable to register, say 40,334, and eliminate the OPC? The data is always reported as bad. Neither can I link shared variables to these addresses through the OPC I/O server.
    Am I missing something? Are there any examples of code available where individual modbus holding registers are communicated with bidirectionally?

    Well, this may seem rather silly but I viewed the video demo that NI has on binding modbus registers to shared variables before I even made my attempt.
    Now, differing from the demo video, I am using modbus RTU on a serial port.  Also differing from the video, when I create my shared variables, they are not placed in the same lvlib as the modbus server just created--LabVIEW prompts for a new library to be created.
    Could the NI product service staff please test with a serial modbus RTU device (a real living creature and not just a simulation please) the bidirectional communications and prove functionality with the Shared Variable Monitor of your product?  I suggest that you attempt communicating with holding registers 40,001 through 49,837.
    By the way, my com is set up correctly for I can view and or change all of the desired modbus RTU registers using the OPC Lookout Protocol Drivers through the Server Explorer.
    Please do not send me any more links to videos that test with simulations.  A real solution is required.
    Lloyd Ploense

  • Modbus tcp read holding registers not returning requested quantity

    Background:  I have a customer using an ELAU motion system - they are recording data to Holding Registers that they want to be able to read on a cRIO to match up with some analog data from FPGA (I have digital handshaking happening for that).
    LabVIEW 2010 SP1
    cRIO 9074
    Using the NI MOdbus.llb VI Library to communicate with the other system.  I can open the TCP communication no problem, and actually get SOME registers, just not ALL of the register data I want to read. 
    What I want to do is read 330 individual holding registers U16 values.  I know how the data is being split to represent various lengths (i.e. most data items are using 2 registers to represent one 32 bit number).  I just want to read all the individual registers and parse the data in another VI to convert it to the other data types.
    I provide the MB Ethernet Master Query (poly).vi with the starting address for the first register and then the quantity of 330.  The polymorphic instance selected the is "Read Holding Registers".  The array returned from this VI via "Holding Registers" is only 74 elements and not 330 requested.  I get no exception codes and no LV errors.  Is there some inherent limit on the number of Holding Registers that can be read?
    I am not using the MBAP Header input (not sure if that is needed).
    Thank you.
    Ryan Vallieu
    Automation System Architect
    Solved!
    Go to Solution.

    Simple solution once I dug into the MODBUS Serial protocol/TCP protocol documentation available out there via Google.
    Serial based modbus history is the limitation that carried over to TCP - the maximum amount of bytes in one data pack can only be 256 bytes.  Thus I was limited to around ~125 registers at once.
    256 bytes = 2048 bits.  Using 16 bit registers that gives 128 registers maximum.  I went with 125 to make keeping track of totals easier.
    Ryan Vallieu
    Automation System Architect

  • Reading Holding Registers Float Modbus RTU

    I'm having an issue with ready any floating point number correctly off of a Shark 100 Power Meter.
    I can sucessifully read a block of registers containing the meter name and serial number as 16 bit characters.
    For example when I read registers 1-16 on the map and flattening them to a string, I get a fully working string returned.
    When I try and read holding registers 1012-1013 (Amps A) I get really funny numbers when I convert to a float.
    Here is my code so far
    With my front pannel settings:
    Expected Value I'm looking to have returned: 11.11 Amps
    but
    When I use an indicator to read the registers: 19265, 0
    Same value when I do a conversion
    When I do a type casting to a float: 1.26484E+7
    I've tried some different combinations such as reading only one register and joining the numbers, both in big-endian and little-endian order, still no luck.
    Please Help!
    Here is the modbus float definition as defined the owners manual:
    Solved!
    Go to Solution.

    The float format you posted is the same as LV uses, so if you put example values (Register 1 = C4E1, Register 2 = 1DB9) in the code below it will give you right result.
    What is the full value of your "Output Registers"? You should have two values in numeric array for this to work.

  • How do I read ModBus counter holding registers in Lookout 5

    We are using Lookout v5 with Zetron M1700 and M1716 RTUs. The M1700 is Modbus1 and the M1716 is Modbus2.
    We need to be able to count the number of times a digital input is turned on and off over a period of time.
    We are using digital input #9 on the M1716 RTU. According to the Zetron literature, the counter holding registers for digital input #9 are 42091-42093 for the value and 42094-42096 for the period.
    I tried to calculate the the value stored in the registers by using this formula which was suggested by Zetron in an expression:
    (((Modbus2.42093*10000)+Modbus2.42092)*10000)+Modbus2.42091
    However, this always returns zero.
    I read through your example on reading the BCD registers and doing calculation
    s on them but it hasn't helped me with my problem.
    Is there some command I need to use or a special type of an object I need to use to read the counter holding registers?
    I know we are communicating with Modbus2 properly because I can see when the digital input is on or off.
    Any help is greatly appreciated.

    Hi,
    Is it possible to share or point us to the Zetron literature explaining this calculation?
    If you just read the registers 42091-42093 individually from Modbus2, what do you get?
    Alternatively, you can maybe count the digital line directly in Lookout. For this, you would create a Counter object and specify the digital input as the "Count=" input. Not sure if this is a feasible option for you.
    Again, if you can share the Zetron documentation, I can take a look at it to see why it may not be working.
    Regards,
    Khalid

  • Modbus RTU - Reading Holding registers problem - Novus myPCLab

    Hello,
    I'm trying for a few days to read Holding registers in Novus myPCLab (it uses Modbus RTU protocol). I used both DSC module and Modbus library with no success (it appears to connect correctly but cant read).
    I need to read the given current.
    Does anyone have any idea about what am I doing wrong? 
    Here are my vi and the modbus address.
    Via DSC
    I used the PLC address at "HR Inicial" and 1 at "numero de registros"
    Via library
    I used the PLC address in "starting address"
    Solved!
    Go to Solution.

    My problem now is that my VI doesn't stops after I stop the while loop, it is necessary for a flat sequence implementation.
    Or my other best option is to read and write without closing the Modbus connection. Is that possible with a global variable? 
    I guess I do have to execute this "Modbus VI" to get my variables at a Main VI if they are in the same project. So, can I make my "Modbus VI" works in the background while the Main VI (who reads and write the addresses from the global variable) works, and when I finish running it, they stop together?
    ModBUS VI

  • Modbus Protocol Communication using RS 485

    Hi all,
    I am facing one problem while communicating with Radix Instrument using Modbus RS 485 Interface.can anybody help me in this,
    The instrument which i am going to communicate is Radix ISOSCAN(16 Channel Temperature Scanner).
    The instrument is having Modbus RS 485 interface facility.
    To that instrument,RS 485 Configuration is there.And I am using RS 485 to RS 232 Converter for communicating with my PC.
    I downloaded Modbus VI Library from NI and I programmed using Modbus VIs.
    I got the instrument Register Addresses also.From this instrument,I want to read 16 channel temperature values.For this,in Modbus terminology we will call as Process Variables(PV).
    For this,I used Read Input Registers(Function Code 04) and I have doubt in configuring Starting Address terminal of "MB Serial Master Query.vi".Because,here if we see the datatype of this terminal,it is U16.But if we see the Instrument register addresses,it is of floating point type.
    Actually first of all I am not getting any out put from "Registers" terminal of "Modbus Master Serial Query.vi"
    Actually as i have to read(Read Only) 16 channel Data from the instrument,and as per the link mentioned in ni "Introduction to Modbus" topic,
    http://zone.ni.com/d...a/tut/p/id/7675
    I selected "Read Input Registers" with Function Code "04".
    As per the link above,If starting address is 40008,we have to give 7,If it is 40009,we have to give 8 ...
    So as per the instrument register addresses,what i got from the instrument design people,Addresses are starting from 40001,
    So I tried in the following ways
    Test 1:
    Following as inputs for "Modbus Master Query.vi",
    1.With Read Input Registers
    2.With Starting address as "0",
    Test 2:
    Following as inputs for "Modbus Master Query.vi",
    1.With Read Holding Registers
    2.With Starting address as 1 also,
    But in both the cases I am not getting any value from the Registers terminal of "Modbus Master Query.vi"
    Also i have gone through the link which is in ni developer zone forums,i.e.
    http://forums.ni.com...uireLogin=False
    Also i observed one thing while running the code anna,
    I am using RS 485 to RS 232 converter for communicating with the instrument.
    From this converter,there are two output terminals(TXD) and (RXD) with boolean indicators(one for the TXD and one for RXD).I think these are send and receive commands for serial communication(RS 232)
    Observation is that,whenever i am running the code,the boolean which correspond to TXD is blinking,
    But there is no indication from boolean of RXD.
    I think,the code which is running in my PC is sending command but because of some reasons there is no reply(as there is no indication from RXD boolean) from the instrument.
    I am thinking that the with the starting address what i am giving in the VI,its not able to search for the registers...,
    Regarding RS 485 to RS 232 Converter,
    In front end,one side, two terminals(D+ and D-) are connected to Instrument D+ and D- Terminals.
    Another side,three terminals(230 VAC,Neutral and Earth) given supply Line,Neutral and Earth Terminals.
    And in front end,9 Pin Female(RS 232) Connector is there and i used one Serial Female to Male cable for connecting my PC to the Converter RS 232 port.
    Can anybody support me so that i can solve this problem...,
    Regards,
    Bujjin
    Attachments:
    Modbus Communication RS 485(8.2).vi ‏31 KB
    RS 485 to 232 Converter Front View.JPG ‏12 KB
    MODBUS-RS485-STD.pdf ‏128 KB

    If you have a 32bit Floating point number (Single Precision) in your register than you must read to U16 number, concanate them by using the "join Numbers.vi and then typecast them into a Single Precisio. See the image Below for more detailed information. 
    I'm not sure if you are still having problems with this if you are please re post and we will be glad to help you 
    thanks 
    Regards,
    CharlesD
    Digital MultimetersSchedule a Free 1 Hour LabVIEW Tutorial with an NI Applications Engineer

  • Modbus Serial Simulator

    Hi All,
    Am new to labview, I want to create modbus slave simulator. I have connected through serial port to the master and treid to read the holding registers, the VI is executed succesfully but it doesnot show the expected register values read. Can you guide me with any of the examples to create Modbus Slave simulator.
    Thanks in advance.
    SS

    Hi All,
    Thanks for your response, Yes I did use some of the VI's from Modbus Library : MB Serial Example Slave VI and MB Serial Example Master VI, but upon modifying registers in slave its not updating on Master. PFA VI's am using. I have cross connected the two ports but still its not updating. Please advice
    Thanks,
    Savi
    Attachments:
    Slave.png ‏65 KB
    MasterVI.png ‏64 KB

  • User-specified DAQ interruptions, instrument control through serial communication

    I'm working on an instrument control program, and I've run into a structural problem that I cannot figure out.
    The instrument in question is effectively a thermostat.
    The program has two functions:
    1.)  Background sampling to record temperature in a log over time.
    2.)  Adjust temperature according to user input
    The issue is that the instrument uses EIA-232 serial communication to talk to the PC.
    This prohibits simultaneous execution.  Attempting to send a command while the program is taking a sample will result in serial blockage errors.
    So the program must interrupt background sampling until the specified command has been completed.
    I can't figure out how to do this.
    My best idea was to create a manual pause control.  If the user wants to adjust the temperature, he hits a switch to pause the sampling, sends the appropriate command, then hits the switch again to reinitiate sampling.  This method will suffice, but is not ideal.
    Beyond that, I really have no idea how to prevent the two functions from running into each other.
    Help structuring this program would be greatly appreciated,
    Thank you

    Look into Semaphores (icons with traffic light glyphs)
    Set up a Semaphore resource to the COM port that is wired to two parallel structures.
    One structure would do the background polling, the other would handle setting changes.
    Prior to background poll, lock the resource, then unlock it after the poll. Likewise for the setting change command.
    When a resource is locked, the other process cannot access it until it is unlocked. Be sure to dispose of the Semaphore when ending the program.
    -AK2DM
    ~~~~~~~~~~~~~~~~~~~~~~~~~~
    "It’s the questions that drive us.”
    ~~~~~~~~~~~~~~~~~~~~~~~~~~
    Attachments:
    SempahoreExample.jpg ‏256 KB

  • Problems with Serial Communication using Labview 6 and Solaris 8

    I am working on a Driver for a Temperature Controller. But I am stuck at the very basics. I am using Labview 6 and the platform is Solaris 8 on a SUN Ultra 60 Workstation. I can not get the Serial communication to work. When I am running raw (uncompiled) code it works (I can read from and write to ttya and ttyb) but once compiled I get error code 37 (device not found). I have tried the following steps to fix this with no luck.
    1) I made sure that the "serpdrv" file is in the same folder with the executable. I also make sure the serpdrv file is added as a support file when building the app.
    2) I changed from using traditional serial VI's to labview 6's new visa functions. With these "new" VI's when
    I try to initiliaze the visa device and wire a control to the "visa reference" input only 1 serial port shows up (ASRL2, missing ASRL1). I am not sure if this is part of same problem or whole new issue.
    3) I reinstalled both visa and labview 6.0.2 update hoping this would help with no luck
    4) I placed the following entry into the ".labviewrc" file
    labview.serialdevices: "/dev/ttya:/dev/ttyb"
    If anybody has had the same problem I would love to hear about it and if you have any solutions
    Jamie Shea

    Hi Jamie,
    1. Do you have NI-VISA driver installed on the machine on which you are running this executable?? If you are trying to run the executable on the same machine on which the development program has ran fine, then you can ignore this point.
    2. If you have done all the changes that are suggested by other discussions related to this topic, then try changing the Port input to Visa Serial Configure.Vi from a control to a constant and try it. In some case, I have seen this to do the trick. I think this point should solve your problem. If it does do tell me. :-))

  • I use LabVIEW 7.1 but I have some problem when, I use LabVEW to read the data from serial communication

    I use LabVIEW 7.1 but I have some problem when, I use LabVEW to read the data from serial communication.
    I use LabVIEW to read the data from serial communication then, i open the example (.vi) from Serial Communication - Advanced Serial Write and Read  from LabVIEW Example. BUT it have some error message that : Error - 1073807202 occured  at property node in visa configure serial port (instr).vi -> advance serial write and read .vi
    this error code is undefined. no one has provide a description for this code, or you might have wired a number that is not an error code to the error code input.
    I don't know why? please help me. thank you.

    When I copy that code into "Explain Error" I get: "VISA:  (Hex 0xBFFF009E) A code library required by VISA could not be located or loaded."
    You may have a bad install of VISA or the wrong version of VISA loaded. Try re-installing VISA. You can get the latest version from the NI support site: http://digital.ni.com/softlib.nsf/webcategories/85256410006C055586256BBB002C0E91?opendocument&node=1....
    Also ensure that you are not pointing the example towards a serial port that does not exist.
    Please let us know what you find and what gets this working for you.
         Rob

  • I can't write holding registers

    hay My program mast visualize some data of a controller. This with an Ethernet connection. I can read everything and I can write coils bet I cant write the holding registers. I hope someone can help? Heir my VI: Rutte
    Solved!
    Go to Solution.
    Attachments:
    Master.zip ‏824 KB

    Thanks for the Flat sequences tip. And for clean up my mess JI think the data must be 16 bit integer because I can read it with 16 bit integer.I also think that the values must fit into 2 consecutive modbus registers. Because when I read it fits. Now I have typecast the data ant I have convert it to I16. bet it didn’t work. What do you mien with split/join numbers?
    Attachments:
    holding registers.doc ‏40 KB

  • How to split one modbus serial output port into two?

    Hi all,
    Current Situation 
    My company has a instrument measuring emission in flue gas. The instrument has only one serial port for "modbus" output. The serial port is being used to sending the data collected by the instrument to our DCS.
    My Question
    I have a separate data acquisition computer which is also able to collect data over serial modbus. Is it possible to split the existing serial modbus output port into two so that both the DCS and my data acqusition computer can collect data from the instrument at the same time? If yes, what software and hardware do I need? One more point, high reliability is required for both data collection processes - to the DCS and to the data acquisition computer.
    Thanks and regards,
    Roger 

    What serial protocol are you using? RS-232 or RS-485?
    If it is 485, then it is a multidrop bus, so you can just hook up both receivers to the transmitter via a RS-485 hub. If it uses the 232 protocol, then this would not work as only one device can receive data at any given time, so you could set one node up to repeat the signal to the second hub or use LabVIEW Shared Variables.
    A Quick Comparison of RS-232, RS-422, and RS-485 Serial Communication Interfaces
    Regards,
    Peter Flores
    Applications Engineer

Maybe you are looking for

  • IPhone 4 not syncing automatically with iTunes

    Hi everyone, my old iPhone (original 2G) was syncing automatically when I opened iTunes. This does not work with my new iPhone 4. I have to hit the Sync button in the lower right manually. Did I miss a setting somewhere? I am not talking about automa

  • Duplicate material codes weeding

    Hi all, How to weed out duplicate material codes based on description. Regards, K.Prem Kumar

  • Serial number profiles differ

    Hello experts, I have one material with serail no profile & other is without serial number profile. we are required to do 309 movement from serialised material to non-serialised material. System is reflecting error as mentioned below. "You want to ca

  • Machine Cost

    Dear all, I have a scenario in product costing like this: For 1 litre Finished Goods, the cost is Rs. 100=(Machine/Labour Cost Rs.20+Raw Material Cost Rs.80) and for 10 litres FG, the cost is Rs.820=(Machine/Labour Cost Rs.20+Raw Material Cost Rs.800

  • Copying pics from iphoto says can't copy, photo is busy????

    Sometimes when I try to copy photos from iphoto to my external hard drive, it comes up with the message 'cannot copy to this location because one or more of the pictures is busy' what does this mean and how can I change it? It happens quite randomly