03-31-2009 07:51 AM
Solved! Go to Solution.
03-31-2009 09:40 PM
Ouch! Multiple nested stacked sequence structures make it impossible to figure out what is going on. I am attaching a version of your code where the stacked sequences were converted to flat, then the block diagram was cleaned up. You should try to use this and work further to clean up the code.
I only saw one place where it looked like you were writing to holding registers and it seems to be towards the center of the attached VI. You are writing to multiple registers, but you are sending an array of 7 numeric doubles to the data element of the Modbus cluster. This data is being coerced into an U16, and probably only 7 values as well in that array.
What you need to do is figure out what type of data you want to send. Does each value go into 2 consecutive modbus registers? How do you want to convert from a double representation (which is 8 bytes of data) to two registers of U16 (2 bytes + 2 bytes)? If you use the right combination of typecast and split/join numbers, then you should be able to go from 7 doubles (perhaps you really want singles? at 4 bytes per) to 14 U16's.
04-01-2009 03:33 AM
What do you mien with split/join numbers?
04-01-2009 12:46 PM
With split or join numbers located in the numeric / data manipulation palette, you can take two U8's and join them into a single U16 (and vice versa using split). And you can take two U16's and join them into a single U32.
Take a look at the attached subVI I made. It was a wrapper for the Modbus VI functions so that I could use enums to read or write specific registers by name and handle the data manipulation accordingly. It may call for a couple of typedef's I created for my particular application, but that shouldn't keep you from seeing the structure and how I did the data manipulation using the split and join functions.
04-03-2009 03:21 AM