Newbie questions regarding CodeSys V3 Modbus RTU

2015-08-13
2016-06-09
  • patrickduis - 2015-08-13

    Hi, I'm new to CodeSys but an experienced PLC engineer (25 years). In the past I used Philips PC10/20/P8, Siemens S5/S7, Allen Bradley. The last years I'm very busy programming Pro-face touchpanels.

    Currently I'm evaluating CodeSys V3.5, running on my laptop (no licende). I wish to try to communicatie with a temperature controller that is connected via an usb->rs485 convertor. The protocol is modbus RTU 38k4 N81 mapped to COM8. It all works fine on a SpecView SCADA application so the hardware/controller is ok, that is no problem.

    I installed CodeSys V3.5 SP7 on my Win7 32bit laptop and am able to config the Modbus RTU over there. In the future I wish to get the application running on ruggedized PLCs but at first I want to evaluate with a the test-application running on my laptop.
    I am able to get tests running in simulation mode in CodeSys but wish to read/write with the temperature controller. The actual temperature is modbus address 400001 (word 16 bits).
    I'm a very experienced modbus RTU user so I think I got the modbus config right.

    I understand that I need to run CodeSys RTE on my laptop, so I installed it also on my laptop.

    Here is an important newbie question because I'm stuck: how do I get the application running that I made in CodeSys 3.5 running on the CodeSys RTE engine?
    When I go online I understand the CodeSys 3.5 application wishes to download it into a plc, but that is currently my own laptop running Win7 32bit. I want to run it on the same laptop as where I'm developing, but is that maybe the problem?
    It wants to transfer to gatway-1 (left) localhost port 1217 and on the right is the name of my laptop in windows SERVICE-04. But I think there must be CodeSys RTE.

    Can you give me some advice on how to proceed because I'm stuck and are doing something essentially wrong here.......

    Thanks for the advice!

    IMG: codesys1.png

     
  • eschwellinger

    eschwellinger - 2015-08-13

    Hi,
    you need to update the plc in your project to control RTE.

    Second Option is to use 'Control Win' and start the plc in the task tray (sure then you do not need to Switch the plc in your project)

    BR
    Edwin

    IMG: StartControlWin.jpg

    IMG: ChangePLC.jpg

     
  • patrickduis - 2015-08-13

    Ok, I started the RTE and after the update device I was able to get it running.............my testcounter is running nicely now on the RTE!
    I have a bus failure on the Modbus..........so starting to dig again. Any advice is welcome.

     
  • patrickduis - 2015-08-13

    Had to disable the win SysTray because it was "claiming" the com8.......
    Almost there now....(must be some issue with the modbus address....)

    IMG: codesys3.png

     
  • eschwellinger

    eschwellinger - 2015-08-13

    Hi,

    add Modbus_Slave_COM_Port to the watch window and check the Modbus_Slave_COM_Port.byModbusError

    BR
    Edwin

    IMG: ModbusResponse_ErrorCode.jpg

     
  • patrickduis - 2015-08-13

    Still issues when restarting my laptop. I only have the CodeSys gateway systray and the codesys control RTE in running but after starting the codesys V3.5 sp7 tool there is always no gateway connection to the soft plc.
    In the communication settings I have to do gateway-configure the local gateway. There is nothing there, I push OK (after scanning) and only THEN I can push on the small circle on the right-bottom of the PLC symbol.
    I also sometimes need to restart the codesys gateway systray to be able to get the circle on the right-bottom of the PLC symbol green..............very strange behaviour.

    Still could not read from the modbus slave, but at least I can restart the laptop/system and come to the same point every time again.......

    I also included the watch of the modbus slave.......still need to figure out why it doesn't read.

    IMG: codesys5.png

     
  • patrickduis - 2015-08-13

    Yesyes: all green now, needed to use modbus function call 3 for this specific temperature controller.
    Only thing is that the value is still not the measured temperature.....but this must be because of wrong register address......

    IMG: CODESYS6.png

     
  • ZKh - 2016-06-09

    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 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

    IMG: ModbusRTU.png

     

Log in to post a comment.