📄 f0fd80ddc45f001d1289bbda6de18a35
字号:
TRT_ATT_TEXT,filenamewithpath,
NULL); /* you can get file path here*/
strcat(filenamewithpath,"/");
strcat(filenamewithpath,Currentfileselect); /* to get the filename*/
Delete_RepetCharacter(filenamewithpath,'/');
error=strcpy(CurrentFileToRun,filenamewithpath);
error=Ncs_Fsr_stat(filenamewithpath,&file_state);
error=Ncs_Fsr_read(Ncs_Fsr_open(filenamewithpath,O_RDONLY,0),
filecontextfuffer,
file_state.st_size+10); /*To ensure we have read the file complately.*/
TRT_SetValues(TRT_cid2, "FileContext", /*Send the file context to the Tilcon.*/
TRT_ATT_TEXT,filecontextfuffer,
NULL);
TRT_SetValues(TRT_cid2, "Message_Display1",
TRT_ATT_TEXT,"Load file to CPL Successfully!",
NULL);
TRT_SetValues(TRT_cid2, "CurrentProg", /*Show the program name and path*/
TRT_ATT_TEXT,CurrentFileToRun,
NULL);
error=Ncs_Fsr_logout("root",0);
}
/*F*/
/*
************************************************************************
** >AUTHOR : Jiang
** FUNCTION NAME : Dab_h_SelContinueMode
**
** >DESCRIPTION: This funciton is used to delete character
** For example //usr//user -> /usr/user
**
** >NOTES:
**
**
** >PARAMETER: none
**
** >RETURN VALUE: none
**
** >INCLUDES : none
**
*/
void Delete_RepetCharacter(char* Changestring,char d){
char *m = Changestring;
char *k =m+1;
char* m1=NULL;
char* k1=NULL;
while(*m != '\0'){
while(*m != '\0'){
if((*m == d)&&(*k == d)) //if we discover the repeat
{
m1=m;
k1=k;
while(*m1 != '\0'){
*m1=*k1;
m1++;
k1++; //we should delete the front one by covering
}
}
else break; //if we found no repeating
}//
m++;
k++;
}
}
/*F*/
/*
************************************************************************
** >AUTHOR : MY
** FUNCTION NAME : Dab_h_SelContinueMode
**
** >DESCRIPTION: Example to set the continue mode
**
**
**
** >NOTES:
**
**
**
** >PARAMETER: none
**
** >RETURN VALUE: none
**
** >INCLUDES : none
**
*/
EXPORT void Dab_h_SelContinueMode(void)
{
int loc_errncs;
int status;
int version;
int savstate;
int ipostate;
int AktOpMode;
Ncs_Error_t Ncs_Error_Code = Ncs_ErrOk;
/*At first compare the NC mode,if there is no change,program will do nothing.*/
Ncs_Error_Code = Ncs_SavGetNcMode(1,&version,&AktOpMode,&savstate);
if (AktOpMode == NCS_SAV_OP_MODE_AUTOMATIC_C)
TRT_SetValues(TRT_cid2,"Message_Display1",
TRT_ATT_TEXT,"You have already in the Automatic Mode!",NULL);
else{
/*At first we should know if the program is running*/
loc_errncs = Ncs_SavGetNcState(1,
&version,
&savstate,
&ipostate,
&status);
/*if(savstate==3) that means program is running*/
/*if program is running ,we should tell the user to Reset the Channel*/
if(savstate==3){
TRT_SetValues(TRT_cid2,"Message_Display1",
TRT_ATT_TEXT,"The Program is running,You should Reset Channel at first!",NULL);
}
else{
/*if the program is not running,we should switch the NC mode.*/
loc_errncs=Ncs_SavOpModeSelect(1,
NCS_SAV_OP_MODE_AUTOMATIC_C,
&status);
if ((status!=NCS_SAV_SERVICEOK_C) || (loc_errncs!=Ncs_ErrOk))
{
/*Fehlerbehandlung */
}
else
{
/*At last HMI will tell the user success of changing mode.*/
TRT_SetValues(TRT_cid2,"Message_Display1",
TRT_ATT_TEXT,"Current mode is Automatic",NULL);
}
}
}
}
/*F*/
/*
************************************************************************
** >AUTHOR : MY
** FUNCTION NAME : Dab_h_SelDebugSTEPMode
**
** >DESCRIPTION: Example to set the step debug mode
**
**
**
** >NOTES:
**
**
**
** >PARAMETER: none
**
** >RETURN VALUE: none
**
** >INCLUDES : none
**
*/
EXPORT void Dab_h_SelDebugSTEPMode(void)
{
int loc_errncs;
int status;
int version;
int savstate;
int ipostate;
int AktOpMode;
Ncs_Error_t Ncs_Error_Code = Ncs_ErrOk;
/*At first compare the NC mode,if there is no change,program will do nothing.*/
Ncs_Error_Code = Ncs_SavGetNcMode(1,&version,&AktOpMode,&savstate);
if (AktOpMode == NCS_SAV_OP_MODE_DEBUG_STEP_C)
TRT_SetValues(TRT_cid2,"Message_Display1",
TRT_ATT_TEXT,"You have already in the DubugStep Mode!",NULL);
else{
/*At first we should know if the program is running*/
loc_errncs= Ncs_SavGetNcState(1,
&version,
&savstate,
&ipostate,
&status);
/*if(savstate==3) that means program is running*/
/*if program is running ,we should tell the user to Reset the Channel*/
if(savstate==3){
TRT_SetValues(TRT_cid2,"Message_Display1",
TRT_ATT_TEXT,"The Program is running,You should Reset Channel at first!",NULL);
}
else{
/*if the program is not running,we should switch the NC mode.*/
loc_errncs=Ncs_SavOpModeSelect(1,
NCS_SAV_OP_MODE_DEBUG_STEP_C,
&status);
if ((status!=NCS_SAV_SERVICEOK_C) || (loc_errncs!=Ncs_ErrOk))
{
}
else{
/*At last HMI will tell the user success of changing mode.*/
TRT_SetValues(TRT_cid2,"Message_Display1",
TRT_ATT_TEXT,"Current mode is DebugStep",NULL);
}
}
}
}
/*F*/
/*
************************************************************************
** >AUTHOR : MY
** FUNCTION NAME : Dab_h_SelDebugPROGMode
**
** >DESCRIPTION: Example to set the program continue debug mode
**
**
**
** >NOTES:
**
**
**
** >PARAMETER: none
**
** >RETURN VALUE: none
**
** >INCLUDES : none
**
*/
EXPORT void Dab_h_SelDebugPROGMode(void)
{
int loc_errncs;
int status;
int version;
int savstate;
int ipostate;
int AktOpMode;
Ncs_Error_t Ncs_Error_Code = Ncs_ErrOk;
/*At first compare the NC mode,if there is no change,program will do nothing.*/
Ncs_Error_Code = Ncs_SavGetNcMode(1,&version,&AktOpMode,&savstate);
if (AktOpMode == NCS_SAV_OP_MODE_DEBUG_CONT_C)
TRT_SetValues(TRT_cid2,"Message_Display1",
TRT_ATT_TEXT,"You have already in the DubugProg Mode!",NULL);
else{
/*At first we should know if the program is running*/
loc_errncs= Ncs_SavGetNcState(1,
&version,
&savstate,
&ipostate,
&status);
/*if(savstate==3) that means program is running*/
/*if program is running ,we should tell the user to Reset the Channel*/
if(savstate==3){
TRT_SetValues(TRT_cid2,"Message_Display1",
TRT_ATT_TEXT,"The Program is running,You should Reset Channel at first!",NULL);
}
else{
/*if the program is not running,we should switch the NC mode.*/
loc_errncs=Ncs_SavOpModeSelect(1,
NCS_SAV_OP_MODE_DEBUG_CONT_C,
&status);
if ((status!=NCS_SAV_SERVICEOK_C) || (loc_errncs!=Ncs_ErrOk))
{
}
else
{
/*At last HMI will tell the user success of changing mode.*/
TRT_SetValues(TRT_cid2,"Message_Display1",
TRT_ATT_TEXT,"Current mode is DebugContinue!",NULL);
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -