Greetings,
I am using the KFlop to run our automated factory equipment. I would like to use a hardware switch connected to the KFlop to signal to communicate with an application running on the PC. An example would be, we are making a dashboard for the engineering team to watch status of all the equipment. When an operator turns the switch I need some way to detect that in order to notify the dashboard.
The only way I am aware of to communicate from the KFlop to the PC is by writing a text file. Is there any other way? Can the KFlop start an executable on the PC? Could it write to a SQL server? I know an M code under "execute PC" will do something similar. Can I do the same thing from a C program running on the KFlop?
Thanks,
Scott
Switch Alarm
Moderators: TomKerekes, dynomotion
- TomKerekes
- Posts: 2677
- Joined: Mon Dec 04, 2017 1:49 am
Re: Switch Alarm
Hi Scott,
I believe your systems are running KMotionCNC? In this case when the input changes you might have KFLOP request KMotionCNC to perform an MCode Action that would in turn execute a PC program or batch file that would update some data somewhere for your dashboard. Below is the PC Command code to do this.
#define PC_COMM_MCODE 14 // Persist+1 is which MCode to execute
HTH
I believe your systems are running KMotionCNC? In this case when the input changes you might have KFLOP request KMotionCNC to perform an MCode Action that would in turn execute a PC program or batch file that would update some data somewhere for your dashboard. Below is the PC Command code to do this.
#define PC_COMM_MCODE 14 // Persist+1 is which MCode to execute
HTH
Regards,
Tom Kerekes
Dynomotion, Inc.
Tom Kerekes
Dynomotion, Inc.
-
- Posts: 60
- Joined: Fri Apr 27, 2018 10:43 pm
Re: Switch Alarm
Thanks Tom! Exactly what I was asking for. Trying to understand the comment "// Persist+1 is which MCode to execute". Lets say that KMotion CNC has "Execute PC" with a batch file connected to M100. Would to run that batch file from a C program I would simply insert the line of code:
#define PC_COMM_MCODE 99 // Persist+1 is which MCode to execute
99 is one less than the M code of 100 that I am wanting to run?
#define PC_COMM_MCODE 99 // Persist+1 is which MCode to execute
99 is one less than the M code of 100 that I am wanting to run?
- TomKerekes
- Posts: 2677
- Joined: Mon Dec 04, 2017 1:49 am
Re: Switch Alarm
Hi Scott,
No. See KFLOPtoPCCmdExamples.c
You would code:
DoPCInt(PC_COMM_MCODE,100);
To invoke the M100 Action.
No. See KFLOPtoPCCmdExamples.c
You would code:
DoPCInt(PC_COMM_MCODE,100);
To invoke the M100 Action.
Regards,
Tom Kerekes
Dynomotion, Inc.
Tom Kerekes
Dynomotion, Inc.