CODESYS - the IEC 61131-3 automation software

Welcome to the official CODESYS Forum
Deutsche Version English version russian version 
It is currently Tue Oct 17, 2017 5:02 am

All times are UTC+01:00

Post new topic  Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Inject C Code into ST
PostPosted: Fri Oct 07, 2016 9:22 am 

Joined: Thu Oct 06, 2016 12:06 pm
Posts: 4
I have found mostly dead links or hopelessly outdated information in regards to my problem. Hopefully anyone in this forum can advise me. I want to inject native code into my structured text. I do not care whether it is C, Python or whatsoever, I just need to find a way to embed "external" functionality into my CodeSys Program running on the Raspberry.
And yes, I have found this module provided by CodeSys that matches this very purpose, but it is geared towards device manufacturers. It is not geared towards the average joe end user.

Thank you in advance for your time to respond to this thread.


PostPosted: Sun Oct 23, 2016 4:14 am 
Frequent User
Frequent User

Joined: Fri Sep 02, 2011 8:02 pm
Posts: 255
The module was at one time available for everyone but now only to their OEMs (implies not easily implemented/issues/etc). Many people have asked - nothing has been offered up. You may be better off setting a GPO (general purpose output) that your other code is watching for.

Scott Cunningham
KEB America, Inc.

PostPosted: Sun Nov 06, 2016 4:21 pm 

Joined: Mon Nov 24, 2014 9:16 pm
Posts: 37
Modbus is your friend. Its the best way that I have found to get external data into and out of Codesys.

Just add the relevant library into your application (C, Python, etc), and just send data from a client (your code usually), into a Modbus slave running in Codesys. I've done this with C, Python, and Node-Red and they worked just fine.

For example, I had an Adafruit Ultimate GPS board plugged into the Pi. I used Adafruit's sample code, and just added the Python Modbus library, and sent position data over 4 registers into Codesys.

For the Node-Red, I simply added the Node-Red-Contrib_Modbus library, and was sending data to and from Codesys from Grove Sensors (also added via Node-Red library)

I've also used Modbus from Codesys into ESP8266 modules. This was using the Modbus libraries available for Arduino. I could pass all the IO of the ESP8266 (an Adafruit Huzzah actually), and use it as a generic remote wireless IO node.

PostPosted: Wed Apr 05, 2017 9:16 pm 

Joined: Wed Jul 27, 2016 7:52 am
Posts: 1
Hi @fixstuff555

I have a smart home project. I did for this project that connecting between arduino/ethernet shield and raspberry with modbus tcp in codesys. But I need to do this project with wireless. So I had a ESP8266. But I didn't know arduino code. Can you help me ?

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

All times are UTC+01:00

Who is online

Users browsing this forum: A. Akkerman and 4 guests

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