Welcome to our new forum
All users of the legacy CODESYS Forums, please create a new account at account.codesys.com. But make sure to use the same E-Mail address as in the old Forum. Then your posts will be matched. Close

Proper method to configure and open Controller's serial port

conadmin
2018-01-31
2021-07-17
  • conadmin - 2018-01-31

    I am currently using CoDeSys V3.5 SP12 trying to grab drab some sensor data using a controller. Let me touch on the hardware architecture first.

    Computer -> LAN cable -> Conprosys controller -> RS-232 Serial cable -> CHINO temperature senor


    I have seen guides on how to open serial com ports using "COM.Open" and such but they are focusing on Computer -> Serial -> Controller. In my case I am hoping to open the Controller SERIAL COM port. I searched for the data sheet and it indicated that the CoDeSys syntax for that controller serial com port being "PORT 1"

    Link to mentioned controller (CPS-PCS341MB-DS1-1201): https://www.contec.com/jp/download/cont ... 370d53120a

    So how do I actually go about activating that Serial com port on the controller in CoDeSys?


    Another issue being more of CoDeSys.

    When I add Devices in CoDeSys, which do I select for my LAN then Serial configuration?

    MODBUS_COM> MODBUS_SERIAL_DEVICE

    or

    MODBUS_COM> MODBUS_MASTER_COM_PORT> MODBUS_SLAVE_COM_PORT

    or

    Ethernet> MODBUSTCP_SLAVE_DEVICE


    This has been confusing me for quite some time now, have no background on CoDeSys. Appreciate any help and confirmation, thanks.

     
  • eschwellinger

    eschwellinger - 2018-01-31

    Hello,

    which plc are you using, is this Control Win?
    I would recommend to the check this examples here:
    https://store.codesys.com/serial-com.html
    ->install it via CODESYS shopping cart and open it then here
    'c:\Users\<yourwindowsusername>\CODESYS Examples\SerialCom\1.0.0.1\SerialCom.project </yourwindowsusername>

    There are two applications in you need to decide which one is better for your needs (SyscomExample is more low Level based on the syslibs)

    If you see the project, there is nothing in the device tree according the Serial communcation... so for plain using the com port
    this is not needed.
    If you use a higher level protocoll like modbus rtu, then you need to add a modbus serial com port.

    BR
    Edwin

    IMG: serialcom.jpg

     
  • Thom - 2018-08-30

    Hello everybody,

    I try to execute the SerialCom.project example on my PC (simulation mode) with an USB serial adapter to emulate a COM1 but the opening never work.

    The handler is always 16#0! (see below)

    I try too on a target but the trouble is the same, handler never found...

    Kind regard,

    Thomas.

    IMG: Bild

     
  • eschwellinger

    eschwellinger - 2018-08-30

    Hi,
    this does not work in simulation mode,
    please start Control WIN in your Task tray - and login to this plc on your pc -
    then this will work.

    BR
    Edwin

     
  • Thom - 2018-08-30

    Zitat:
    Hi,
    this does not work in simulation mode,
    please start Control WIN in your Task tray - and login to this plc on your pc -
    then this will work.
    BR
    Edwin

    Thank you Edwin for your help.

    I start on Control WIN but the handler is always never found...(see below):

    IMG: Bild

     
  • Thom - 2018-08-31

    Thom hat geschrieben:
    Thank you Edwin for your help.
    I start on Control WIN but the handler is always never found...(see below):

    After many try, I delete all test of the handler value and force to write on the serial port and data are correctly sent...
    So, I don't understand what is the problem with the handler but it seems it not correctly fill.

    NB: Version of Codesys used is V3.5.13.0.

    Regards.

    IMG: Bild

     
  • aungwintun81 - 2021-07-17

    HI Anyone can help to codesys serialcom.project example login user and passeowrd.
    I cannot login to learn. any instruction to edit user and password.
    Please help me. thanks.

     
  • aungwintun81 - 2021-07-17

    HI Anyone can help to codesys serialcom.project example login user and passeowrd.
    I cannot login to learn. any instruction to edit user and password.
    Please help me. thanks.

     
  • eschwellinger

    eschwellinger - 2021-07-17

    with SP17 there is a forced UserManagement introduced,
    either you set a user and password on fist login or you could disable it.
    depening on your plc system you could add for example for Linux SL in
    /etc/CODESYSControl_User.cfg
    https://faq.codesys.com/display/CDSFAQ/Device+UserManagement

     

Log in to post a comment.