- Posts: 9
- Thank you received: 0
creating c or c++ Programs which may be called by M-Functions
- Schneckerich_63
- Topic Author
- Offline
- New Member
-
Less
More
6 years 9 months ago #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
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 to join the conversation.
6 years 9 months ago #153823
by Grotius
Replied by Grotius on topic creating c or c++ Programs which may be called by M-Functions
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 !!
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 to join the conversation.
Time to create page: 0.088 seconds
