NI Field Point responding only with Illegal data address

Asked by Todd Denniston

I have a National Instruments cFP-1804 (with up to date modbus capable firmware) with a cFP-DI-304 which I am trying to work with.

Configured in TCP mode.

running test-modbus configured for my IP set.

Any clues?

All responses are in the form:
Connecting to 192.168.2.245

[00][01][00][00][00][06][01][05][00][64][00][00]
Waiting for response (12)...
<00><01><00><00><00><03><01><85><02>

ERROR Illegal data address

Connecting to 192.168.2.245
ERROR force_single_coil (-2)
Slave = 1, address = 100, value = 0

[00][02][00][00][00][08][01][0F][00][64][00][01][01][00]
Waiting for response (12)...
<00><02><00><00><00><03><01><8F><02>

ERROR Illegal data address

Question information

Language:
English Edit question
Status:
Solved
For:
libmodbus Edit question
Assignee:
No assignee Edit question
Solved by:
Stéphane Raimbault
Solved:
Last query:
Last reply:
Revision history for this message
Best Stéphane Raimbault (sra) said :
#1

Adresses to use depend on your device?
Are you sure that you can adress the coil #100?

Revision history for this message
Todd Denniston (todd-denniston) said :
#2

I was running test-modbus in the hopes it would find SOMETHING.

After finding the appropriate NI documentation... I am still a little confused about the addresses.

the DI-304 is a digital input board with 32 inputs.
it is in the first slot of the field point.
I assume I want to read either what they call "Raw I/O data" or "Attributes", I don't think I need to send commands or "Scaled 32-bit data".
Raw I/O data, I think would indicate I want to read addresses:
01000 to 01032
And as it looks like NI works in decimal, the above addresses are decimal even though they start with 0.

Attributes, I think would indicate I want to read addresses:
11000 to 11032

Also I a bit confused as to what digital inputs should be called in Modbus, one place [on the web] that I read indicated to call them coils.

comparing the "int function =" lines in modbus.c and the function codes NI indicates that the Field point supports, [Assuming NI is using decimal in their documentation] your function names and NI's definitions match with the following exceptions:
function = 0x11 (report_slave_id) [is this basically Diagnostic:Echo ? if so NI uses different functions codes]
function = ?? (no function) [Mask write register]
function = ?? (no function) [Read _and_ write Multiple registers]

I think I have made progress by writing this.
setting #define ADDR_MIN 1000 and #define ADDR_MAX 1032 #define FIELDS 32
_AND_ replacing 'ok = force_single_coil...', 'ok = force_multiple_coils...' and 'ok = preset_*_register' with 'ok = 1;' or 'ok =field_nb;' [that is I don't have output devices... don't test for them.]
gives results like:

Connecting to 192.168.2.245

[00][01][00][00][00][06][01][01][03][E8][00][01]
Waiting for response (10)...
<00><01><00><00><00><04><01><01><01><00>

[00][02][00][00][00][06][01][01][03][E8][00][01]
Waiting for response (10)...
<00><02><00><00><00><04><01><01><01><00>

[00][03][00][00][00][06][01][03][03][E8][00][01]
Waiting for response (11)...
<00><03><00><00><00><05><01><03><02><00><00>
ERROR read_holding_registers single (13893 != 0)
Slave = 1, address = 1000

[00][04][00][00][00][06][01][03][03][E8][00][01]
Waiting for response (11)...
<00><04><00><00><00><05><01><03><02><00><00>
ERROR read_holding_registers (13893 != 0)
Slave = 1, address = 1000

[00][05][00][00][00][06][01][01][03][E8][00][01]
Waiting for response (10)...
<00><05><00><00><00><04><01><01><01><00>

[00][06][00][00][00][06][01][01][03][E8][00][02]
Waiting for response (10)...
<00><06><00><00><00><04><01><01><01><00>
ERROR read_coil_status (0 != 1)
Slave = 1, address = 1000

I think I am close to having my answer, but not there yet.

Revision history for this message
Todd Denniston (todd-denniston) said :
#3

Ok, I think I have a few of the answers I needed now. :)

I had a fundamental misunderstanding because I failed, in the first pass, to read/understand the comment at line 116 of modbus.h, i.e., All functions used for sending or receiving data return :
   - the numbers of values (bits or word) if success (0 or more)
   - less than 0 for exceptions errors

Once I understood that my test program started looking a little nicer.
I have other questions that I will start other threads for.
Thanks for the help.

Revision history for this message
Todd Denniston (todd-denniston) said :
#4

Thanks Stéphane Raimbault, that solved my question.