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

Can i use C code for creating a library in Codesys?

Volvo742
2016-06-10
2016-08-09
  • Volvo742 - 2016-06-10

    Hello!

    I have created a library in C by using Arduino. The library is very basic and only uses HI and LOW communication method to simulate SPI technology. Really basic algorithm.

    Im using MAX7219 and 7-segments displays. But i want to implement that C-code as a library in Codesys. It does not need to be just C-code at the end. I just want the library to make it work with Codesys.

    I have also created a program who reads analog values with MCP3008 and i used structure text to create that program. Can i convert that into a library so i don't need to call the program in the task any more? I know that it already exist a library for MCP3008, but i want to try to create it by my self. At least i have't created a library yet, only program+functions.

    The point is that i want to develop libraries for digital communication, so i don't need to create programs who needs to be called by a task every single time.

    I want to create libraries for a specific component. And that library should run in the background and the library of course need parameters as a setup.

     
  • Anonymous - 2016-08-09

    Originally created by: scott_cunningham

    For your c-code, I think you are out of luck unless you are a manufacturer of controls (CoDeSys has an add-on product, but only offers to control builders). I would just convert to ST in this case (my company is doing that all the time).

    A library is just a library of code. If you have a POU that needs to run (your analog input controller), then you still need to call it from your program. You would just have the POU in the library so nobody needs to see the code, but they would still need to load your library and then call YourLibrary.YourProgram(); from the main program. You could use a task, but I would avoid calling an instance of a FB.

    Now, creating a "device" may be different... But I have no idea how to do that. I think that is mainly reserved for the control manufacturers and CoDeSys...

     

Log in to post a comment.