Hi Tom,
I'm implementing a CMM system with KMotion434 in Labview.
So far everything worked fine, but I have a problem compiling and executing C programs.
If I compile the execute the C program on thread1 with the your "Kmotion->C program", the system works 100%.
As far as I understood, in KM_Controller the Compile() method creates an .OUT file at the same location as the c program was loaded from and the ExecuteProgram() method runs the .OUT file on the target.
So my problem is that when I call the Compile() method or even the ExecuteProgram() or even the CompileAndLoadCoff() or LoadCoff(), I cannot figure out what should be the representation of the full path as string for the methods.
I posted the image with the current version of the string, however i tried with many different scenarios:
"D:\\CZCMM-MAIN.c"
@"D:\\CZCMM-MAIN.c"
D:\CZCMM-MAIN.c
D:/CZCMM-MAIN.c
"D:/CZCMM-MAIN.c"
@"D:/CZCMM-MAIN.c"
https:// ibb. co/ 2Ns9FM5 (no spaces)
So neither of them compiles and creates the .OUT file for me. Some versions gives me an Error message that the TCCP64.exe got a NullPointerException, but most of the versions just returns "Error Compiling and Loading Program".
I have the C:\Kmotion434 folder in the system as environmental path so I have no problems with that while I was writing our C# versions.
Also I checked that the Labview is capable of reading and writing on the current paths, even into C:\Kmotion434\C programs folder.
Everything else works just fine, but I just can`t figure out this.
please help
thank you
--------------------------
Tamás Czimmermann
Applied Laser Solutions Inc.
p.s.:
The C program in this scenario is not relevant, however I post it not cause any confusion:
#include "KMotionDef.h"
main()
{
Delay_sec(.1);
WriteSnapAmp(SNAP0+SNAP_PEAK_CUR_LIMIT0, 9);
WriteSnapAmp(SNAP0+SNAP_PEAK_CUR_LIMIT1, 9);
WriteSnapAmp(SNAP0+SNAP_SUPPLY_CLAMP0, SNAP_CONVERT_VOLTS_TO_ADC(27.0));
WriteSnapAmp(SNAP0+SNAP_SUPPLY_CLAMP0, SNAP_CONVERT_VOLTS_TO_ADC(27.0));
WriteSnapAmp(SNAP0+SNAP_SUPPLY_CLAMP_ENA0, 1);
WriteSnapAmp(SNAP0+SNAP_SUPPLY_CLAMP_ENA1, 1);
ch0->InputMode=ENCODER_MODE;
ch0->OutputMode=BRUSHLESS_4PH_MODE;
ch0->Vel=40000;
ch0->Accel=80000;
ch0->Jerk=8e+06;
ch0->P=2.5;
ch0->I=0.0025;
ch0->D=12;
ch0->FFAccel=0;
ch0->FFVel=0;
ch0->MaxI=200;
ch0->MaxErr=1e+06;
ch0->MaxOutput=200;
ch0->DeadBandGain=1;
ch0->DeadBandRange=0;
ch0->InputChan0=9;
ch0->InputChan1=0;
ch0->OutputChan0=8;
ch0->OutputChan1=9;
ch0->MasterAxis=-1;
ch0->LimitSwitchOptions=0x100;
ch0->LimitSwitchNegBit=0;
ch0->LimitSwitchPosBit=0;
ch0->SoftLimitPos=1e+09;
ch0->SoftLimitNeg=-1e+09;
ch0->InputGain0=1;
ch0->InputGain1=1;
ch0->InputOffset0=0;
ch0->InputOffset1=0;
ch0->OutputGain=1;
ch0->OutputOffset=0;
ch0->SlaveGain=1;
ch0->BacklashMode=BACKLASH_OFF;
ch0->BacklashAmount=0;
ch0->BacklashRate=0;
ch0->invDistPerCycle=0.0025;
ch0->Lead=0;
ch0->MaxFollowingError=1000000;
ch0->StepperAmplitude=255;
ch0->iir[0].B0=1;
ch0->iir[0].B1=0;
ch0->iir[0].B2=0;
ch0->iir[0].A1=0;
ch0->iir[0].A2=0;
ch0->iir[1].B0=1;
ch0->iir[1].B1=0;
ch0->iir[1].B2=0;
ch0->iir[1].A1=0;
ch0->iir[1].A2=0;
ch0->iir[2].B0=1;
ch0->iir[2].B1=0;
ch0->iir[2].B2=0;
ch0->iir[2].A1=0;
ch0->iir[2].A2=0;
Zero(0);
EnableAxisDest(0, ch0->Position);
DefineCoordSystem(0, -1, -1, -1);
}
Compile and Execute C programs in Labview
Moderators: TomKerekes, dynomotion
- TomKerekes
- Posts: 2679
- Joined: Mon Dec 04, 2017 1:49 am
Re: Compile and Execute C programs in Labview
Hi Tamás,
Its not clear why that wouldn't work.
We aren't very familiar with LabView. In our simple demo we did this and it worked:
Maybe try that example first. Note KMotionSrc will need to be changed to KMotion434
Actually the Environment PATH should be: C:\KMotion434\KMotion\Release
That error is displayed when an error code is returned without any specific compiler error. So I suspect it can't find the compiler or something.
You could always debug it if you are familiar with Visual Studio 2015. Build the debug libraries using the BuildAllLibs.sln. Point the PATH to C:\KMotion434\KMotion\Debug. Run Labview. Have VS2015 attach to the LabView Process. Set a breakpoint in CompileAndLoadCoff. Trigger the Compile. It should hit the breakpoint. Then step through it to see where it goes wrong.
Sorry for no simple answer.
Its not clear why that wouldn't work.
We aren't very familiar with LabView. In our simple demo we did this and it worked:
Maybe try that example first. Note KMotionSrc will need to be changed to KMotion434
Actually the Environment PATH should be: C:\KMotion434\KMotion\Release
That error is displayed when an error code is returned without any specific compiler error. So I suspect it can't find the compiler or something.
You could always debug it if you are familiar with Visual Studio 2015. Build the debug libraries using the BuildAllLibs.sln. Point the PATH to C:\KMotion434\KMotion\Debug. Run Labview. Have VS2015 attach to the LabView Process. Set a breakpoint in CompileAndLoadCoff. Trigger the Compile. It should hit the breakpoint. Then step through it to see where it goes wrong.
Sorry for no simple answer.
Regards,
Tom Kerekes
Dynomotion, Inc.
Tom Kerekes
Dynomotion, Inc.