06-02-2010 08:50 AM
Remove the array to cluster function, the cluster to array function, and everything in between including the pretty blue and orange wires.
Your thick blue array wire will go into my subVI, and the output of the subVI will be the thick orange wire that goes to your indicator.
You canrequest all the registers starting at 202 for a quantity of 74 (check my math). Then use index array for the array that comes out of the subVI and pick off indices, 0, 1, 29, 30, 31, and 36. (Again check the math).
The alternative is to read starting at 202 for a quantity of 4, then do a read starting at 260 for a quantity of 16 then use index array to pick off the ones of interest.
You could try both ways to see which is quicker. Since you are looking at 76 registers all at once, (152 bytes + some header and checksum bytes, I'll round up to 160 total) it will all fit in one command and take about 170 msec for the return message. That is probably more than quick enough. Doing it in two messages will save some time in return bytes, but there is an extra read and write and turn around time that I would bet would take longer than the 80-90 msec you might save in raw data bytes.
06-02-2010 09:26 PM
Hi Raven fans, after inserting yr vi and following your instructions, the values i obtained are incorrect. But it does the job of reading the registers correctly i think. I'm not exactly sure what your vi does, but it sure looks better than mine.
06-02-2010 09:33 PM
06-02-2010 09:40 PM
06-02-2010 10:38 PM
J.R wrote:
Oh, it worked after i changed the starting address from 202 to 201 (minus 1) if i wanted to read registers 202,203.
That's because there is a slight disconnect in modbus between the way the register is numbered, and the value you give the drivers to access it.
For instance, the register might be named 30202. The 30,000 gets dropped leaving you with 202, but that is based on 1 being the first register. But the modbus command actual starts with address 0.
It's just one of those things that must be double checked when working with modbus. And it also complicates the calculation from your address number, to the number to feed into the modbus command, to which value you index out of the array once you convert all the register pairs to an array of single precision numbers.
10-19-2012 10:10 AM
RavensFan,
I used your vi (Modified) to conver 2 unsigned 16 bit to floating 32 and it worked great. I am now trying to convert a double precision to 2 float(IEEE 754 floating point format).
THis is to write to the hi and lo registers
an exapmle would be 400 rpm = lo=0
hi=17352
can you help me?
10-19-2012 10:36 AM - edited 10-19-2012 10:36 AM
If you have a value of 400 as a double, then use the conversion bullet to convert it to a single before typecasting it to a U16 array.
10-19-2012 10:49 AM
Where do i get the unsigned array from??
10-19-2012 10:56 AM - edited 10-19-2012 10:56 AM
You create it yourself.
Drop an array container on the the block diagram. Drop a numeric constant. Change the representation to U16. Drag it into the array container.
I would recommend looking at the online LabVIEW tutorials
LabVIEW Introduction Course - Three Hours
LabVIEW Introduction Course - Six Hours