03-29-2019 08:23 AM
I'm trying to create a Modbus Slave Program to communicate. I followed the following tutorial http://www.ni.com/tutorial/13911/en/ with the exception of setting it up as a Slave and Serial instead of TCP.
The tutorial worked great but i could only bind single Modbus variables to a global variable. I read in the help menu in the "Create Bound Variables" and "Using Modbus I/O Servers (DSC Module or Real-Time Module)", Variables that start with "A- Denotes an array". so i created a simple bound variable to the coil range to start. Then i deployed it and i created a simple Vi, to set the coils but while i was testing it the coils would not update and i verified this by reading the bounded variable and i also used the Distrubted System Manager but i could not read any values.
I'm using Labview 2018 SP1, RT 2018 SP1, basically everything else is version 18.5. I'm using a 8840 controller in a PXI-1044 chassis, running windows 10 32bit
I've attached a couple pictures to hopefully make sense of what i'm trying to do but the unit is stand alone so i had to take them with my phone
04-01-2019 09:30 AM - edited 04-01-2019 09:31 AM
Hi picky,
It is generally better if you can attach your actual LabVIEW code instead of just screenshots. That way, we can actually open the code and see how everything is configured!
From your pictures, it looks like the I/O server bound variable name is A000001L1. The 1 after the L denotes the length of the array. So this variable is configured to write to an array of coils, but the array is only length 1. Instead, you would want to create a bound variable for A000001LX where X is the number of coils that you want to write to.
There is an example called Modbus Datatype Extension.lvproj in the LabVIEW example finder that you should check out. It has an example of how an array of coils (and other datatypes) should be configured in the project.
-Jordan
04-02-2019 11:45 AM - edited 04-02-2019 11:49 AM
I was not able to find the examples you were described. I was able to compile the project into a zip file, i hope i got everything you need.
The machine is stand alone and it does not hook up to the internet or any other systems other then to communicate over RS485.
I was unable to figure out how to make the length of the array longer then 1. i tried using buffers and i tried adding a range of array variables. I also tried initializing the variables but that didn't work.
Note, i initalized the variables in the loop but removing the initalize array from out side the loop had no effect on it.
Any help you can provide is appriciated.
04-02-2019 12:26 PM
A few things jump out at me after looking at your code.
The example I was referring to should be installed with the DSC Module by default. It should be located at:
C:\Program Files (x86)\National Instruments\[your LabVIEW version]\examples\lvdsc\IO Servers\ModbusExtension\Modbus Datatype Extension.lvproj
04-02-2019 01:39 PM
1. They are supposed to be slaves, the master is a PLC, which i'm communicating with the purpose of this is for labview to simulate a piece of equipment.
2. I dont think i understand what you mean by increasing the number after L increases the length of the array. I tried to do it but it didn't work, i've attached my second attempt. if you could upload a working version demonstrating it, i would appriciate it.
3. i could not find the example you were talking about. i attached screen shots of everything in examples and a screen shot of me searching for Modbus in the examples folder.
04-02-2019 01:58 PM
I don't know what those pictures of your Explorer windows are supposed to show.
But your latest VI has a variable bound to My Computer\ArrayTest2.lvlib\ModbusSlave1\A1L00000100 That variable name looks quite a bit different from A000001L1 or A000001Lx listed earlier.
04-02-2019 03:02 PM
The pictures of my explorer are suppose that i dont have the example he keeps refering too. I wanted to demonstrate that i dont have lvdsc folder and i don't know if he has any other suggestions on where it might me located.
I'm unsure how to create the array with the length i need. When i go to "create Bound Variables" i'm given 2 choices, "add" and "add Range". if i click add for coils, then it
i click add i get the second picture, if i click add range and i type in 1000 for the number of items i get 1000 variables that all start with the same thing.
04-02-2019 03:33 PM
i finally figured out how to update the length of the array but renaming the variable from "L1" to "L10" for example. I went to test this over modbus serial and the only thing it returned all zeros even when i was able to set it high and read it high.
I tried to use the "Distriuted System Manager" but it shows up as no value set.
I'm using a PXI 8433/2 RS 485 card connected over a serial cable to each port (connected togeather). I'm currently using Modbus Poll as the master while i'm testing,i know the software i'm using as the master works, i've used it many times in the past.
Anyone one got any idea's?