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

How to add an own device to the bus-master?

Photon
2016-02-26
2016-04-13
  • Photon - 2016-02-26

    Hey Guys,
    I'm using Codesys for the Raspberry Pi and searching for an option to configure my own device for the SPI/I2C bus? (it's a DA-Converter, MCP4725)
    The SPI-master just offers a few prepared devices and no option for custom settings.

    1. question: There are lots of posts explaining how to control Codesys via Python script but is it possible to start a Python script in codesys projects?
    2. condition = true then starting python_script(a,b,..)

    Thank you for helping!
    Photon

     
  • lafro - 2016-03-31

    Hvae you had any luck getting some information, i am also trying to connect a device
    where there is no specific device driver

     
  • Raspx10 - 2016-04-12

    I've got the same problem. Does really no one can help us? With the I2C-examples, you can only control the example devices, are there a bib for I2C devices in general?

     
  • eschwellinger

    eschwellinger - 2016-04-13

    Hi,

    a good startpoint is to read RaspberryPI_CodesysV3_FirstSteps_EN.pdf:

    "c:\Users\<yourwindowsusername>\CODESYS Control for Raspberry PI\3.5.8.10\Documentation\RaspberryPI_CodesysV3_FirstSteps_EN.pdf"
    In Chapter 4 'Connecting additional devices via IΒ²C and SPI' there is a Basic description how it works.</yourwindowsusername>

    See after reading this the 'open' libraries and devices here:
    "c:\Users\<yourwindowsusername>\CODESYS Control for Raspberry PI\3.5.8.10\Libraries\" </yourwindowsusername>

    I2C_AdafruitPWM.library
    I2C_Gyroscopes.library
    I2C_SRF02.library
    IoDrvGPIO.library

    open these libraries with CODESYS and check how they are implemented.
    They use the I2C/SPI FB's from Raspberry Pi Periphials Library.

    you need to implement a own device description for your device and install it then to the device repository
    "c:\Users\<yourwindowsusername>\CODESYS Control for Raspberry PI\3.5.8.10\Devices\" </yourwindowsusername>

    The best practice how to work/debug/install... with libraries you'll find here:
    l viewtopic.php?f=22&t=5641&p=10677#p10677 l

    BR
    Edwin

    IMG: I2C_SPIMasterFBs.jpg

     

Log in to post a comment.