nikitost

RS485 Modbus connection PLC Sensor

10 posts in this topic

Hello everyone!

 

Could you help me with my problem?

I have a PLC FX3G-24M and a FX3U-485ADP-MB module. I'm trying to establish connection between PLC and the Sensor to get a pressure reading.

I made the program using official guides but it doesn't work... This is what it looks like:

 

First problem: if I set M8411 it's immediately reset. So I use the SET block.

And second problem: I need to read Input Registers. The command isn't sent. I don't see the flashing light on the module and the result of command ADPRW in M8029. I tried changing the S3 parameter to 1, 8, 16... I think the problem is in the configuration. What do you think?

And here is the sensor documentation. Description of input registers:

 

Thank you in advance if you try to help me.

Init.png

IMG_20201014_101919~2.jpg

Share this post


Link to post
Share on other sites

M8411 --- From M8000 and up these are special devices. this one is for setting the coms. you do not need to set it.

So delete your first line of code!!!

1 person likes this

Share this post


Link to post
Share on other sites
1 hour ago, Gambit said:

M8411 --- From M8000 and up these are special devices. this one is for setting the coms. you do not need to set it.

So delete your first line of code!!!

Thanks for the answer! But how can I initialize the start of the configuration? If I just switch the M8411, it will turn off again, and the values will return to their initial... I need to use a local variable?

Edited by nikitost
correction

Share this post


Link to post
Share on other sites

You don't need to it will do this it will be done auto at startup

1 person likes this

Share this post


Link to post
Share on other sites
22 hours ago, Gambit said:

You don't need to it will do this it will be done auto at startup

Ok. What I found in manual "To initiate the setup, the PLC program must use the auxiliary relay M8411 for Channel 1 or Channel 2. When the PLC program contains the "LD M8411" instruction, it is then possible to configure the MODBUS functionality using MOV operations.". In fact I did it.

I remove the first line of code. What should I do next? After loading the program and restarting the PLC, nothing happens. If I use "Modify value..." function in online monitoring and set the M8411 bit, then the D8400...D8412 values will be set to the desired values, but after that M8411 will reset again and they will return to the initial values. 

Share this post


Link to post
Share on other sites

That is strange after a reboot M8411 should activate once and the setting should be done. 
What does your hardware config look like ?

Do you have a FX3G-CNV-ADP or BF board in between.

Edited by Gambit
1 person likes this

Share this post


Link to post
Share on other sites
1 hour ago, Gambit said:

That is strange after a reboot M8411 should activate once and the setting should be done. 
What does your hardware config look like ?

Do you have a FX3G-CNV-ADP or BF board in between.

 

IMG_20201015_145226.jpg

MELSOFT Navigator C__Users_User_Documents_MyModbus - [FX Module Configuration] 15.10.2020 14_50_48.png

MELSOFT Series GX Works2 C__Users_User_Documents_MyModbus_a - [Program [PRG] Program [Structured Ladder_FBD] ] 15.10.2020 14_51_31.png

Share this post


Link to post
Share on other sites

You should uncheck the PLC System 2 Operate communication setting.!!!

you've set this up in D8400 etc. 

1 person likes this

Share this post


Link to post
Share on other sites

My colleague and I solved this problem.

First, we configured the D8370 register. Then register D8420.

They have similar configurations. Only a few bytes differ.

The most interesting thing is that I configured CR+LF in D8370 at the end of the message, and in D8420 I had to reset this bit... But everything works and I can send and receive messages.

The program is on ST, because it was more convenient for my colleague to work this way.

IF LDP( TRUE, M8000) THEN
    MOV( MOV( TRUE, HBC97, D8370), K2, D8379);
    Start := TRUE;
    MOV( MOV ( MOV ( MOV( M8411, H3097, D8420), H0001, D8421), K10, D8431), K1, D8434); 
    (*MODBUS: 19200, 8 bit, EVEN, 1 stop, node addr = 1, delay 10 ms *)
    comm := 4;
    addr1:= 2;
    addr2:= 3;
    S3_1 := 1;
    S3_2 := 1;
END_IF;

IF Start  = TRUE THEN
    ADPRW(ADPRW(M10, H1, comm, addr1, S3_1, D0), H1, comm, addr2, S3_2, D1);
    IF LDP(TRUE, M8029) THEN
        RST(TRUE, M10);
    END_IF;
END_IF;

 

Edited by nikitost

Share this post


Link to post
Share on other sites

As I understood - activating CH1 checkbox in Parameters -> PLC System(2) gives activation of port and then you can manipulate with M8411 setting the port protocol, master/slave etc. Am I right? Thnx.

Edited by eziccc

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now