READ_VAR ethernet error

ndelucca

Member
Join Date
Jul 2013
Location
Rosario
Posts
28
Hi there, im having some problems communicating two PLCs M340 2020 (without NOE), with the READ_VAR function.

I need to read some values in one of the PLC.

First, i dont have the PLCs with me, so i have to perform de test with the simulator(the ethernet network is setup correctly). What i've done so far: i set up the function so it should read the values i want (i.e: %MW300) from the simulator itself (so the origin and destination IP's would be the same). The READ_VAR block is set up as follows:

ENABLE := PARAMETER_TABLE[1].0, (negated)
ADR := ADDM(CPU_ETH{192.168.5.15}),
OBJ := '%MW',
NUM := 300,
NB := 10,
GEST:= PARAMETER_TABLE,
RECP => READING;

CPU_ETH is the netlink for the simulated PLC, and the IP is the one configured on the same PLC.

The error i get in the third integer from the PARAMETER_TABLE is 16#0003, wich means "Incorrect address format" according to the Help file. There is a comment in the READ_VAR help wich i dont understand regarding this error and the RECP.

I've tried changing the way i write the ADR in many ways, i.e:
ADDM('0.0.3{192.168.5.15}')
ADDM('CPU_ETH{127.0.0.1}')
ADDM('{192.168.5.15{192.168.5.15}')
ADDM('CPU_ETH{CPU_ETH}')
and many other combinations.

Perhaps the self-reading is forbidden, but that would show me some other kind of error message, not incorrect format.
I cant seem to solve this on my own, maybe someone has an idea?
Thank you.
 
Last edited:
I don't think the simulator can be a client. Only a server (so could accept incoming messages). I never checked what errors it might give if you were on the Windows simulator - since it's not supported it is not something I would try.

I would not assume that this is not a proper error for what you are trying to do. You may be right, but it is an assumption that needs to be tested.

If you want I can check for some working code but will not be until tomorrow.
 
Just remembered - M340 uses ADDR, not ADDM.

Just got a working config going on the M340 (real comms) so need to move it over to the simulator to see what error I get.

Here is my ADDR string argument:

'0.0.3{192.168.10.51}1.TCP.MBS'
 
Correction - I can't read my own code...

It is ADDM block for address converting per the original poster. The string argument is in my previous post, and I verify in Wireshark that communication is correct with a READ_ VAR. When I run the same code on the simulator (requires a rebuild), I get the following error:

16#0003 <- incorrect address format from Unity help
 
Thank you robert, i guess that trying to test communication with the simulator was a bit naive, still is good to have confirmation on the error. I'll just have to trust the code, and hope for the best the day i go and install everything. Regards...
 
By the way, ill take this chance to ask something else regarding READ_VAR. When the block is setup to read '%M' (individual bits) how are they shown on the RECP? The block requires an array of INT to locate the readings, lets say i have to read 16 individual bits, is the block going to require an array of 1 INT (to be separated in individual bits), or an array of 16 INT, where each integer would show only values of 0 and 1?.
I've always used this block to read %MW and never cared for individual bits, and as i said before i dont have one with me to test this properly, so i'd like to be prepared.
 
On RECP bits are packed to integers. If you read 16 bits then then you need only one integer. for 20 bits you need two inetegers. 4 last bits are on second integer. (1st bit is %MWx.0 and 16 is %MWx.15)


By the way, this depends little bit of processor what you use. On P57 Unity processors read_var block supports also reading forcing status of bit, and for 16 bits you need now two integers. 1st integer tells if bit is zero or one and 2nd integer tells if bit is on normal or forced status.

Anyway, M340 support only readind bit value...so 1 integer for 16 bits...
 
Last edited:

Similar Topics

Hi, I am trying to use READ VAR function block in Modicon M251 to read data from 1 unit of Modbus RTU slave. However the READ VAR return error...
Replies
0
Views
784
Hi Guy's, I have fully configured all my reads writes and sequeneced them as per my usual setup. However while configuring my code I found that...
Replies
3
Views
3,999
Hi, The hardware is: Click Plc model # CO-O1DD1-O HMI model # S3ML-R magnetic-inductive flow meter model # FMM100-1001. I will set the flow meter...
Replies
4
Views
118
Is there a way to use the FAL instruction to do +=2 instead of +=1? I have an array that is organized with alternating "data" and "flag" values...
Replies
5
Views
123
Hi everyone i have a customer, who wants to show an alarm on the machine, if the I/O forces are enabled and set, on at ControlLogix L81E with...
Replies
3
Views
228
Back
Top Bottom