Knowledge Base / Rockwell In-chassis

Coil / Bit Addressing with a ProSoft inRAx Module

Search KB

Kategorien

Users often have trouble getting Coil writes, using FC5, or FC15 to work correctly in a ProSoft inRAx module, or a ProLinx PLX31 or PLX32 gateway.  The following information explains exactly how to address Coils, and includes a few samples of doing so.  In this article, we're going to assume an MVI56E-MNETC, but the same principles apply to every single one of our MVI-based Modbus modules. 

The first thing to remember, is that all of our modules are designed for 16 bit WORD addressing.  With this in mind, if you enter an Internal Address value of "2", then we'd use that exact location for normal Holding/Input register access.  But when using Coils, you must use "1 bit addressing".  So, for example, if you want to write a coil to address 0001, on your Modbus device using FC 0x5, and you store the bit value in MNETC.DATA.WriteData[0], then the correct address would be Write Start Register * 16.  So, if WriteStart was 1000, then the correct value to use as your Internal Address would be 16,000.  This is how our modules figure out the exact bit you're attempting to address, rather than reserving an entire WORD for a single bit.  If you were to use 1000, like you would for a Holding Register command, then that actually will look at MNETC.DATA.ReadData[62].8, or the 9th bit in MNETC.DATA.ReadData[62], assuming your Read Start Register starts at 0.  How did we there from here?  Consider the following:  1000 / 16 = 62.5.  Since we didn't get a whole number, we need to calculate the remainder.  Thus, 1000 MOD 16 (or 16 * .5) = 8 gives us the exact location where the bit would end up...WORD 62, bit 8.  Since our Read Register Start is set to 0, that places the data exactly at MNETC.DATA.ReadData[62].8!  This is true for all of our Modbus modules, including the MCM, MCMR, MNET, MNETC, MNETCR, MBTCP, and MBS units, both gateway, and inRAx modules.

For the gateways. the same mechanism is at work.our PLX31/32 gateways as well.  As a Modbus server, if the master performs a Write Single Coil, to address 0031, then we could expect to find the result of that write in INT_Data[1].14 (or N10:1/14), the 14th bit in the second word of our internal memory database.  Next, lets assume you've added the PLX31/32 into your Logix Project with a module name of "PLX".  As a master, lets assume that you've stored the bit in PLX:O1.Data[0].14; this is the first output word, of the first Class 1 connection.  By default, this connection starts at 2000 in the modules memory.  Therefore, (2000 * 16) + 14 gives us the address of 32014.  As such, we would enter 32014 as our Internal Address for our Modbus FC5 or FC15 command to write to our Modbus device in the field.

 

For more information on Coils, or using coils with Offsets, contact our Technical Support Department, and we can help you get your addressing right.

Note: For information on Coils with the ILX34-MBS485 and ILX34-MBS232, see the article for the PointIO modules, as they are handled slightly differently.