10-29-2006 09:15 PM
10-30-2006 02:31 PM
10-30-2006 02:59 PM
10-30-2006 03:27 PM
I just spoke with the drive vendor and found that the register is configured to take 32-bit signed number. If that's the case, would NI modbus vis support it? If so, how?
Thanks,
10-30-2006 04:01 PM
In principle, any data structure which can be ‘cast’ to an array of 16-bit words can be transported, and will arrive unchanged on a machine with the same data representation.
The following PLC data types should be noted
984 16-bit Unsigned Integer
Natural meaning: bit 15 - 0 of integer = bit 15 - 0 of register
984 16-bit Signed Integer
Natural meaning: bit 15 - 0 of integer = bit 15 - 0 of register
984 ASCII
Although PLC’s had no text manipulation capabilities as such, the original ladder language editors allowed registers to be displayed as 2 ASCII characters each. The first character displayed was the UPPER byte (bits 15 - 😎 and the second character displayed was the LOWER byte (bits 7- 0). Note in particular that this is the reverse of any use of a character array in C or other high level languages on modern PLC’s.
984 Floating point
Intel single precision real
First register contains bits 15 - 0 of 32-bit number (bits 15 - 0 of significand)
Second register contains bits 31 - 16 of 32-bit number (exponent and bits 23 - 16 of significand)
984 Single precision unsigned decimal
Although the range of values is limited at 0 - 9999, the data representation is the same as a 16-bit unsigned integer
984 Double precision unsigned decimal
This data format is now little-used, except to drive old-style 4-digit decade displays.
The range of values is 0 to 99999999. The first register contains the MOST significant 4 digits, the second register contains the LEAST significant 4 digits, each expressed as binary values in the range 0-9999.
My suggestion would be to download a demo of the Kepware Modbus OPC server program and use portmon to watch the communications on the serial port. Setup a single tag as signed 32 bit integer. Modbus transfer 16 bit values. It is up to the user to convert the values into proper format.
10-31-2006 12:02 AM
Chokro,
If the Slave device supports signed 16-bit numbers then you won't be able to write values higher than 32767. As for writing out negative values, you will again want to check with the device people how they expect the data-byte formatting.
-Khalid
11-01-2006 01:08 PM
11-01-2006 02:19 PM
Two things:
1. You are multiplying the number by 10, so you are really trying to write 140000 (and not 14000).
2. Since the Modbus uses U16s, the 140000 is getting coerced to 8928 (which is what your device should be seeing). Typically, to support 32-bit numbers, the device manufacturers read two adjacent 16-bit numbers and then construct the 32-bit number. See if this is how they do it in your case as well. If yes, then you will need to split your 140000 into two 16-bit numbers and then write to two registers (i.e., setting the Quantity to 2).
Hope this helps.
-Khalid
11-01-2006 05:07 PM
11-02-2006 12:48 AM
A SGL can be used to represent the number. Since Modbus expects U16s (two bytes), we then cast the SGL number to a U32 first, and then use the Split Number function to get the two U16s. These should be written to the two adjacent holding registers. The words may have to be swapped depending on how the device expects them.
Regards,
-Khalid