Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

how to write a specific bit of a register using MODBUS?

I have written a VI usingNIMODBUS.llb to communicate with a VFD drive.

Now, I want to write in particularbits of a register of slave device (VFD).

See Attached table:

 Now I'm using "MB SerialMaster Query Write Single Register (poly).vi" (See attached file), I set"Address" to 5 and I think i have to set "Holding register"for different bits.

When I set the "Holdingregister" to "0", it works fine.

But when I set the "holdingregisters" to 1 or 2.. I don't have the correct output!!!

 

Download All
0 Kudos
Message 1 of 2
(3,323 Views)

Hi,

 

I notice 2 things.

 

1. When the motor stop boolean is true, I assume that you want to stop the motor.  Shouldn't you put 1 into the register to set bit 0 in order to stop the motor? However, instead of putting 1, you put 0.  Is there a reason for that?

 

2. You are doing a lot of VISA close inside a loop, while you initialized the VISA session outside the loop.  After the first iteration of the loop, your VISA session is closed, so you can't do read/write again after the first iteration.

 

Yik

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 2 of 2
(3,251 Views)