CODESYS - the IEC 61131-3 automation software

Welcome to the official CODESYS Forum
Deutsche Version English version russian version 
It is currently Sat Nov 18, 2017 3:40 am

All times are UTC+01:00




Post new topic  Reply to topic  [ 14 posts ] 
Author Message
PostPosted: Fri Jun 10, 2016 12:45 pm 
Offline

Joined: Thu Jun 02, 2016 5:21 am
Posts: 16
Hi
I am new to CODESYS and Wago PFC200. I downloaded CODESYS 3.5.8 and PFC200 package manager. I also updated PFC200 package manager.

I want to read and write some values(Start Add:40001, Register Size:2, Type: Float) between PFC200 and my slave device (ELSTER EK220)through Modbus RTU (RS485).

I added all Modbus Libraries and PFC200 Libraries to my project.
I inserted Modbus_com, Modbus_Master_COM_Port and Modbus_Slave_COM_Port into Devices tree.
I changed serial mode to RS485.
I set the PLC settings as follows:
-Always update variables: Enabled2(Always in bus cycle task)
-Bus cycle task: Main task

But when I login and start CPU, Modbus_Slave_COM_Port does not running.
I also checked COM_Port, and there was no error!!
what else should I do?

I will attach screenshots.
Thanks in advance

Attachment:
ModbusRTU.png


You do not have the required permissions to view the files attached to this post.


Top
   
PostPosted: Sat Jun 11, 2016 4:26 pm 
Offline
Site Admin

Joined: Mon Sep 05, 2005 9:42 am
Posts: 2238
Hi,
are you sure this offsets are correct?
I probably do not have the correct documentation for this device but the one which I found with google does
not have these 40000 Offsets.
Could you check this and read for example just to try if the slave respond on that with other Offsets.
BR
Edwin


Top
   
PostPosted: Sun Jun 12, 2016 7:05 am 
Offline

Joined: Thu Jun 02, 2016 5:21 am
Posts: 16
Hi

I read my slave's manuals and datasheets. There was nothing about offsets, when configuring modbus.
I connected slave to SIEMENS S7-1200 through modbus RS485 and read data. There was a pre-arranged column for offsets (0.0; 4.0; 8.0; 12.0; ...)

I used these values in CODESYS as offsets. Still I've got the same results. Slave is not running.

Is it possible that there is something wrong with my 'CODESYSControl.CFG'?
I attached my CODESYSControl.CFG as pdf.

thanks in advance.

Attachment:
CODESYSControl.pdf


You do not have the required permissions to view the files attached to this post.


Top
   
PostPosted: Sun Jun 12, 2016 7:22 pm 
Offline
Site Admin

Joined: Mon Sep 05, 2005 9:42 am
Posts: 2238
Hi,
this CODESYSControl.cfg is from /GatewayPLC Directory from your PC right?
This has nothing to do with the PFC200.
BR
Edwin


Top
   
PostPosted: Mon Jun 13, 2016 5:43 am 
Offline

Joined: Thu Jun 02, 2016 5:21 am
Posts: 16
Hi Edwin

Thanks a lot for your response and help.

yes CODESYSControl.cfg is from GatewayPLC Directory.
I tried every thing to fix this problem but my slave status is still 'not running'.
I don't know whats wrong!!! :cry:

Is there anything else I have to consider?

Thanks in advance


Top
   
PostPosted: Mon Jun 13, 2016 6:30 am 
Offline
Site Admin

Joined: Mon Sep 05, 2005 9:42 am
Posts: 2238
Hi,
I would just read one function code without offset.
If this give a result add others...
Which functioncode does the modbus slave support to read?

BR
Edwin


Top
   
PostPosted: Mon Jun 13, 2016 2:42 pm 
Offline

Joined: Thu Jun 02, 2016 5:21 am
Posts: 16
Hi Edwin

Thanks a lot for helping me.

I reset all settings:
1- Factory Resetting PFC200-750-8202/025-002
2- adding all Modbus Libraries and PFC200 Libraries to the project
3- inserting Modbus_com, Modbus_Master_COM_Port and Modbus_Slave_COM_Port into Devices tree
4- Changing serial interface to RS485
3- set the PLC settings as follows:
Always update variables: Enabled2(Always in bus cycle task)
Bus cycle task: Main task

4- Modbus slave channel setting:
Modbus slave supports Function code 3 (read holding registers).
Access type: FC3
Offset: 0
Length: 1

Attachment:
SlaveChannel.png


Modbus slave status is 'not running' again. :cry:

Attachment:
Modbus.png


some questions:
1- How is it that when slave is connected or not, I got the same results? nothing will change. :|
2- The data type I am trying to read from slave is Real. The setting in CODESYS defines data of type word in Modbus slave I/O mapping. How can I change it to Real?
3- Is it helpful to Change Master or Slave response timeout and time between frames?


You do not have the required permissions to view the files attached to this post.


Top
   
PostPosted: Mon Jun 13, 2016 8:28 pm 
Offline
Site Admin

Joined: Mon Sep 05, 2005 9:42 am
Posts: 2238
Hi,
if the slave does not respond on that simple project,
this maybe is a wiring problem?

BR
Edwin


You do not have the required permissions to view the files attached to this post.


Top
   
PostPosted: Tue Jun 14, 2016 10:52 am 
Offline

Joined: Thu Jun 02, 2016 5:21 am
Posts: 16
Hi Edwin

Thanks a lot for your consideration.
Wiring was the first thing I checked. I don't have wiring problem.

To solve the problem; I did something different:
I did the same setting in CODESYS v2.3.9.47.
Still I can't read data from Modbus slave.
The program has no error (MBCFG_ERROR= MBCFG_NO_ERROR) but there is an error number generated by 'sercomm.lib' (MBCFG_SERCOM_ERROR= 2).
I've found 'sercomm.lib' from WAGO. If I'm not mistaken the error says: "0x02: COM port outside of the valid area". But the valid area is 2-65!!!!
This time I changed the slave and used 'ADAM-4561'; and I am sure of the COM Port 4; because I changed the port setting in device manager.

Why this happens? How can I fix it?
Is it possible that the x3:RS232/485 port of PFC200-750-8202 doesn't work properly?

I attached the screenshot.
Thanks in advance.

Attachment:
Codesysv2.png


You do not have the required permissions to view the files attached to this post.


Top
   
PostPosted: Sun Jul 03, 2016 12:21 pm 
Offline

Joined: Thu Jun 02, 2016 5:21 am
Posts: 16
Hi
Good news :D
Finally I established a Modbus RTU (RS485) connection and I can read data from slave.
I need data to update online but the problem is that, slave's data updates slowly
I defined timeout responses as 1 second. Still not enough.
Unfortunately adding data length makes updating slower.

Is there any way to boost the update operation?

Thanks in advance


Top
   
PostPosted: Tue Aug 30, 2016 11:33 am 
Offline

Joined: Thu Jun 02, 2016 5:21 am
Posts: 16
Hi every one


I established a Modbus RTU (RS485) connection between CODESYS and PFC200; and I can read data from slave.

The problem is that slave's responses are very slow and erratic.
-I tried to fix this by changing timeouts but didn't workout.
-I am sure about authenticity of slave device, because it works fine with other PLCs.

Is there any way to boost and organize the update operation?

Thanks in advance


Top
   
PostPosted: Mon Sep 18, 2017 7:54 pm 
Offline

Joined: Wed Dec 23, 2015 9:07 am
Posts: 14
Hi,

how did you establish your connection in this case? What was the solution?
I am struggling with a similar topic.

Best regards,
annD


Top
   
PostPosted: Mon Sep 18, 2017 8:03 pm 
Offline
Site Admin

Joined: Mon Sep 05, 2005 9:42 am
Posts: 2238
Hi,
are you using a PFC200 mit Modbus RTU?
BR
Edwin


Top
   
PostPosted: Fri Nov 03, 2017 10:59 am 
Offline

Joined: Fri Dec 26, 2014 3:10 am
Posts: 18
ZKh wrote:
Hi every one


I established a Modbus RTU (RS485) connection between CODESYS and PFC200; and I can read data from slave.

The problem is that slave's responses are very slow and erratic.
-I tried to fix this by changing timeouts but didn't workout.
-I am sure about authenticity of slave device, because it works fine with other PLCs.

Is there any way to boost and organize the update operation?

Thanks in advance


Hi ZKH,

The interest of the Modbus RTU is this communication protocol very easy to implementation due to it do not need any high speed communication chipset.
So for your case the issue is more on the slave site, if the slave it take longer time to process data then you can't do anything to boost up the respond time.
What you can try to do is shorter the distance of the wiring and using faster baud rate.

Thank you
John Lee


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 14 posts ] 

All times are UTC+01:00


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Limited