LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Modbus code for Power meter not working

That's great news.  I'm glad it is working for you now and I was able to help.

0 Kudos
Message 51 of 57
(770 Views)

Hello Ravens,

Need your help. My boss wants the output of the typecast ("(type *) &x) data to be segregated and a numeric indicator added to it so as to show what the values are each time the code is run. Do you have a ny suggestion on how to do this? The typecast output has about 11 data Entried. I have attached the earlier code you sent to me and please help edit the code. I appreciate your effort

0 Kudos
Message 52 of 57
(756 Views)

I'm not quite clear on what you are asking for.  The *(type *)& indicator is an array.  It will show you the values of each of those parameters.

If you want them as indivdual numerics, then use index array.

 

If you want something so there is a description associated with each parameter, then you can do some conversion to a cluster.

 

See the attached VI.  In this particular case, it assumes that you are reading 12 registers and thus getting 6 Single precision floating point parameters.

 

Download All
0 Kudos
Message 53 of 57
(752 Views)

Thanks. Did work

0 Kudos
Message 54 of 57
(746 Views)

Hello All,

 I have a 4-20mA current output module (slave address 3) that is connected to a 4-20mA valve. The output of the current module is controlled by a Labview Modbus Write Register poly as shown in the attached.  The Labview Modbus Write Register poly however has MBAP which is used for identifying the Transaction ID/Slave Address of device (address of device = 3). The Labview Modbus Write Register poly also has TCP, address, Register, timeout and error. The question then is what is the difference between the TransactionID/Slave address of MBAP and the address shown on Labview Modbus Write Register poly and what values should be put to each? Also how will I be able to write to the register so as to control the output current from the 4-20mA module; for example if i need 12mA, how do I write to this register so that it will output 12mA to my valve. 

0 Kudos
Message 55 of 57
(718 Views)

Take a look in the Modbus library for a TCP Modbus Master example to show you how these are used.

 

The MBAP terminal seems to have nothing wired to it.  I'm afraid I don't know what that does because all of my Modbus work has been with serial ports.  Though by reading this http://www.simplymodbus.ca/TCP.htm it looks like the Unit ID should be should be your slave address of 3.

 

The TCP input is a refnum that comes from a TCP open connection.

 

The Address is the address of the register you want to write to.  If it is a holding register, it might have a value such as 40012.  In which case you will enter an 11 here.  (Drop the prefix of 4, and subtract 1).  You'll have to read the manual for your device to know what is the address of the register that interests you.

 

The "register" input, I feel is a little bit of a confusing name as it is not actually asking for a register, (or its address), but the data you want to write to that register.  What value you want to write, you'll have read the manual.  It could be 400 perhaps for 4.00 mA and 2000 for 20.00 mA.  Or perhaps it is fully scaled from 0 to a 16 bit integer so 4 mA would be 0 and 20 mA would be 65535.  In which case 12 mA would be 32767.

0 Kudos
Message 56 of 57
(714 Views)

Thanks Raven for the comments. It does clarify my confusion. the write register will be using a scale of 0-100% and unsigned16 bit integer to indicate current output valves needed. (0% = 4mA (=0) and 100% = 24mA (=65535).

0 Kudos
Message 57 of 57
(709 Views)