creating c or c++ Programs which may be called by M-Functions

More
01 Jan 2020 14:38 #153714 by Schneckerich_63
I would like to get example programs in c or c++ which are able to read and write I/Os.
How to get access to a RS232 interface by this c-Program for exchange Strings between an external Controller and Linuxcnc.

Thanks for any answer.

Schneckerich_63

Please Log in or Create an account to join the conversation.

More
02 Jan 2020 21:46 #153823 by Grotius
Hi,

To read and write rs232 or modbuss i/o you could use the python part of the linuxcnc user interface.
Within a existing template like gscreen.py you could adapt some i/o to test with.

To directly read i/o at c or c++ level, you have to do more then adapt a piece of python code.
I would advice you start with a component file. Important to do is a preprocess to a .c extension, see the component man pages
how to get the --preprocess, --compile and --install working. After you get this working, you can get a clear view what is going on at c level. The next step would be to adapt some of your code and look if you can get the i/o working.

With Linux ethercat things are easyer. Ethercat can talk at linuxcnc level, but can also talk at c level with etherlab.

Good luck !!

Please Log in or Create an account to join the conversation.

Time to create page: 0.045 seconds
Powered by Kunena Forum