LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Modbus Exception Code (communication with an Inline bus coupler for Ethernet)

Highlighted
Hi,
 
I have an Inline bus coupler for Ethernet (IL ETH BK DI8 DO4 2TX-PAC: http://select.phoenixcontact.com/phoenix/dwl/dwl13a.jsp?fct=dwl&asid=907909&name=db_en_il_eth_bk_di8... see page 23) and I want to communicate with it via modbus protocol.
 
In the manual, it says that the Modbus register for the local digital inputs is 8000. I use the MB Ethernet Example Master.vi in the Modbus Library in LabVIEW (Function code = Read Holding Register (3), Start address = 8000, Quantity = 2). It works the first time.
 
My problem is when I want to write into a register. In the manual, it says that the modbus register is (8001+X, and X=number of words). So I put these input: Function code = Write Holding Register (16), Start address = 8003, Quantity = 2). When I do that, I have an Exception Code 2, and I think it means that the address is not allowable. I've try several address and several function code and I always get exception code 2, 3 or 4...
 
I don't understand why read works but not write.
 
Can anyone help me please? I try to contact Phoenix Contact but the guy who can help me will be back at his office only next wednesday.
 
Thank you very much
 
Stephanie
0 Kudos
Message 1 of 8
(5,747 Views)
Highlighted
How many bus inputs and bus outputs do you have defined in your system?  I think you may be trying to access a register as an ouput (8003& 8004) but those registers are readonly because you have at least a few of bus inputs at 8001, 8002 and 8003.
 
Do the modules come with any of their own software for configuring the modules?  Perhaps that would tell you how many inputs and outputs you have and tell you what registers are assigned to which which inputs or outputs.
 
Also, try reading only 1 register at a time and keep incrementing the starting address until the error goes away.  That might tell you which register is the first read/write register.
 
In your code, try to replace the stacked sequences with flat sequences.  You really don't even need the outer most sequence structure if everything is wired up properly.  Also remember to connect your error wires together which also helps to enforce the sequence that the subVI's execute.
0 Kudos
Message 2 of 8
(5,745 Views)
Highlighted
Hi,
 
Thank you for your answer,
 
What do you mean by "bus" inputs and "bus" output? I know that I have 4 digital outputs (DO4) and 8 digital inputs (DI8) but I don't know how many bus that I have. I can connect to the module with its IP address, but in the page I don't have much information. This may be interesting:
 
  <IL_STATION>
  <IL_BUS_TERMINAL>
   <TERMINAL_TYPE>IL ETH BK</TERMINAL_TYPE>
   <NAME>IL ETH BK DI8 DO4 2TX-PAC</NAME>
   <IP_ADDRESS>192.168.168.176</IP_ADDRESS>
   <MODULE_NUMBER>2</MODULE_NUMBER>
   <DIAGNOSTIC_STATUS_REGISTER>224</DIAGNOSTIC_STATUS_REGISTER>
   <DIAGNOSTIC_PARAMETER_REGISTER>0</DIAGNOSTIC_PARAMETER_REGISTER>
  </IL_BUS_TERMINAL>
  <IL_BUS>
  <IL_MODULE number="1">
   <MODULE_TYPE>DO</MODULE_TYPE>
   <PD_CHANNELS>4</PD_CHANNELS>
   <PD_WORDS>1</PD_WORDS>
   <PD_OUT word="1">0</PD_OUT>
  </IL_MODULE>
 <IL_MODULE number="2">
   <MODULE_TYPE>DI</MODULE_TYPE>
   <PD_CHANNELS>8</PD_CHANNELS>
   <PD_WORDS>1</PD_WORDS>
   <PD_IN word="1">0</PD_IN>
  </IL_MODULE>
  </IL_BUS>
  </IL_STATION>
 
PD_Channel: Number of process data channels in an Inline terminal.
PD_Words: Number of process data words in an Inline terminal.
 
I just tried to change quantity to 1 (because PD_words = 1), change the data array with one index, change the start address (8000 to 8035), function code to 16 and it says exception code 2 except for address 8001 (exception code 4: slave device failure).
 
Today I did what you suggest (incrementing the starting address (0 to 100 000) and I found some address without the errors... but these address are for the special registers (like modbus connection monitoring timeout, command register, process data watchdog timeout...).
 
I also did what you suggest about changing the stacked sequences to flat sequences and remove the outer sequence. Didn't really solve my problem hehe
 
Thank you for your time
 
Stephanie
0 Kudos
Message 3 of 8
(5,738 Views)
Highlighted


Peachy wrote:
 
What do you mean by "bus" inputs and "bus" output?

What they show on page 23 of the link to the manual you gave.
 
The register addresses are defined based on the values "X" and "Y" where X is the number of bus inputs and Y is the number of bus outputs.  Let's say you have 4 bus inputs (x=4) an 3 bus outputs (Y=3).
Then those registers would be
8000 Local Digital Inputs (read only)
8001 Bus Input 1 (read only)
8002 Bus Input 2 (read only)
8003 Bus Input 3 (read only)
8004 Bus Input 4 (read only)
8005 Local Digital Outputs (read/write)
8006 Bus Output 1 (read/write)
8007 Bus Output 2 (read/write)
8008 Bus Output 3 (read/write)
 
So I figured if you are trying to write to 8002, but you have a few bus inputs, they would be occupying 8001, 8002 ....   and thus you'd get an error.
 
If you have no bus inputs or outputs, then all you'd have is.  So you may want to try writing to 8001 for only 1 register.
8000 Local Digital Inputs (read only)
8001 Local Digital Outputs (read/write)


Message Edited by Ravens Fan on 06-19-2008 03:46 PM
0 Kudos
Message 4 of 8
(5,733 Views)
Highlighted

Thank you Raven for your help,

I called a person from Phoenix Contact and he told me to change some parameters inside the module. Now it's working well.

When I want to read: Function code=3, Address=8000, Quantity=1

When I want to write: Function code=6, Address=8001, Quantity=1

 

Thanx again

Stephanie

0 Kudos
Message 5 of 8
(5,652 Views)
Highlighted
You're welcome.  I'm glad to hear its working for you.Smiley Happy
0 Kudos
Message 6 of 8
(5,646 Views)
Highlighted

To help anyone with same trouble:

 

access to the node configuration p.e. web

set off plug&play option

set 0 Process Data Watchdog Timeout

 

then have a good work

 

bye,

animalunga

 

 

Message 7 of 8
(5,266 Views)
Highlighted

Thank you so much. Its work.

0 Kudos
Message 8 of 8
(867 Views)