LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Entering Negative values in MODBUS command


@MogaRaghu wrote:

The part in grey is from PC to  VFD  and so should contain the following :

 

Device address

Function Code

Starting Param Address

Number of registers

Command word

CRC

 

My query was on the absence of the command word from the real time trace - without this how does the VFD know what I intend to tell it to do ? 

 

With regard to the Modbus library I see only the Plasmionique Modbus Master  and the NI Modbus Library in the VIPM browser. Where do you get the one you developed the snippet on ? I have seen this earlier but not sure if its still around ...



I don't know why you call that part "command word".  Can you attach a reference to something that calls it that?

 

That part of the modbus packet is the data.  Your function code of 03 defines the message as Read Holding Registers.  As a result, you aren't sending any data to the device.  You are telling it to send back data.  In the response from the device, the data exists and consist of the the two bytes 01 and C1 which is the hex value of 449.  Again, it is not a "command word".

 

If you were doing a Write Single Register (function code 6) or Write Multiple Registers (function code 16), then there would be data in the message packet you send from the PC to the VFD.  That data might be a "command" if you happen to be writing to a registers that is expecting a particular numeric value that means something like a start command or stop command or reset, or whatever else that specific register might be looking for.

 

Have you taken the time yet to read the technical documentation from Modbus.org?  https://www.modbus.org/specs.php

 

0 Kudos
Message 11 of 19
(2,115 Views)

Function code 0x03 is to read holding register and ox06 is to write data to a function register. Basics.

 

And that exactly is my issue with the ModScan32 trace.  I am not using a function code 0x06  to write the command word aka Register Data ( the image below is direct from Nidec manual ) .  Instead I am entering the value 449 into data field and using the function code 0x03 to read.  And I hence expect to see the 0x06 function code somewhere in the real time trace.  But I dont see it ... so how does the drive get this information and send back the confirmation. ?

 

Nidec_WriteSingleRegister.PNG

Raghunathan
LabVIEW to Automate Hydraulic Test rigs.
0 Kudos
Message 12 of 19
(2,099 Views)

I'm sorry, but your message doesn't make any sense.

 

Correct, your modscan32 trace is not using function code 6,  it is using function code 3 to read that parameters.  That is exactly what your screen shot is showing.

 

Then you say "Instead I am entering the value 449 into data field and using the function code 0x03 to read. And I hence expect to see the 0x06 function code somewhere in the real time trace".   Really?  ou are?  Where?  Modscan32 trace is only reading registers, it doesn't write anything to the registers.

 

I don't know if Modscan32 trace has the ability to set modbus registers somehow.  But the screenshots you show, both in its front panel and its serial port trace shows you are only reading that register.

0 Kudos
Message 13 of 19
(2,096 Views)

I don't know if Modscan32 trace has the ability to set modbus registers somehow. 

 

After seeing the trace I am convinced that Modscan32 is managing to send my command ( data register value ) to the VFD. Otherwise the VFD will NOT work ! 

 

The point is,  I enter a value like "449" into the dialog box which pops up when I double click the value field and to send it to the VFD,  I expect a 06 function code and this value "449"  to be shown in the Write string to VFD.  But as you know we cant see it. 

 

I know it does not make sense anyway but thats whats happening.

Raghunathan
LabVIEW to Automate Hydraulic Test rigs.
0 Kudos
Message 14 of 19
(2,080 Views)

I don't know Modscan.  I can only go by what your screenshot shows.  And it doesn't show any command that writes a value to the VFD.

 

Perhaps you already had that value written to the register from some other time?

 

 

0 Kudos
Message 15 of 19
(2,077 Views)

Ok some good news finally. 

 

Used the Plasmionique Modbus library and got it going. And to monitor the actual Write and Read data traffic, used the Serial Port Monitor tool. Very useful.

 

Attaching the quick and dirty  VI that worked ... not very neat but does the job. In any case this is  not the final one. 

 

Thanks for your support. 

Raghunathan
LabVIEW to Automate Hydraulic Test rigs.
0 Kudos
Message 16 of 19
(2,069 Views)

Glad to hear you got it going.

 

I see you used a Write Single Register.  I've never used Plasmionique, but is it possible that their VI actually does function code 6 to write the data, followed by code 3 to read it back?  Because the strings you get back from it are only showing function code 3, perhaps the 2nd of a write/read that the Plasmionique does when you chose the Write Single Register.

Message 17 of 19
(2,058 Views)

Thanks for your brain storming which helped to think all possible routes and finally land on a Modbus library as suggested by you. 

 

Appreciate the help. 

Raghunathan
LabVIEW to Automate Hydraulic Test rigs.
Message 18 of 19
(2,041 Views)

Did you ever attach the link to the MODBUS stuff you mentioned. I didn't see it in a quick scan from that post to here.

 

Thanks,

 

Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 19 of 19
(2,035 Views)