?? 006c6438a95f001d1289bbda6de18a35
字號:
** >AUTHOR : MY
** FUNCTION NAME : void B3_M008_SelDebugPROGMode
**
** >DESCRIPTION: example that how to set program debug mode
**
** >NOTES: the file path and name are fixed at the moment
** "usr/user/Rechteck.npg"
**
** >PARAMETER:
**
** >RETURN VALUE: void
**
** >INCLUDES: dab_h_callbacks.h
**
*/
EXPORT void B3_M008_SelDebugPROGMode(TRT_ReceiveData * Datat,void * ClientData_p)
{
Dab_h_SelDebugPROGMode();
/*lint -e715*/
} /* OF B0_M005_Open */
/*lint +e715*/
EXPORT void B7_M008_CPLBACK(TRT_ReceiveData* Datat, void* ClientData_p)
{
TRT_SetValues(TRT_cid2,"Message_Display",
TRT_ATT_TEXT,"",NULL);
TRT_SetValues(TRT_cid2,"FilesUnderFold",
TRT_ATT_TEXT,"",NULL);
//Before you go out the CPL ,you should the retain the character size
TRT_SetValues(TRT_cid2, "Message_Display",
TRT_ATT_FONT_SIZE,14,
NULL);
TRT_SetValues(TRT_cid2, "FoldSelect",
TRT_ATT_FONT_SIZE,14,
NULL);
TRT_SetValues(TRT_cid2, "Test_tree",
TRT_ATT_FONT_SIZE,14,
NULL);
TRT_SetValues(TRT_cid2, "FilesUnderFold",
TRT_ATT_FONT_SIZE,14,
NULL);
TRT_SetValues(TRT_cid2, "FileContext",
TRT_ATT_FONT_SIZE,14,
NULL);
}
extern void B2_M008_LoadDirectory(TRT_ReceiveData* Datat, void* ClientData_p)
{
Directory_Load();
Directory_Load();
TRT_SetValues(TRT_cid2, "Message_Display",
TRT_ATT_TEXT,"Open the directory Successly!",
NULL);
TRT_SetValues(TRT_cid2, "Test_tree",
TRT_ATT_STATE,TRUE,
TRT_ATT_CURRENT_ITEM,0,
NULL);
TRT_SetValues(TRT_cid2, "FilesUnderFold",
TRT_ATT_STATE,TRUE,
TRT_ATT_CURRENT_ITEM,0,
NULL);
/*use it to updata the head of the fold head.
Problem here will be solved in the future.*/
}
extern void B2_M008_LoadPragram(TRT_ReceiveData* Datat, void* ClientData_p)
{
FileReadTest();
Dab_h_LoadNcProg();
}
extern void B6_M000_CPLDebug(TRT_ReceiveData* Datat, void* ClientData_p)
{
static int start=0;
// Before you go into the CPL ,you should minize the character size
//this function is a callback function ,which will be called by the
//button CPL Debuger
int VarNumber=10; //At here our example can read 10 CPL variables.
int n;
char VairableNamebuffer[20]="";
for(n=0;n<VarNumber;n++){
sprintf(VairableNamebuffer, "VariableList#%d#0",n);
TRT_SetValues(TRT_cid2, VairableNamebuffer,
TRT_ATT_FONT_SIZE,8,
NULL);
sprintf(VairableNamebuffer, "VariableList#%d#1",n);
TRT_SetValues(TRT_cid2, VairableNamebuffer,
TRT_ATT_FONT_SIZE,8,
NULL);
}
TRT_SetValues(TRT_cid2, "Message_Display",
TRT_ATT_FONT_SIZE,10,
NULL);
TRT_SetValues(TRT_cid2, "FoldSelect",
TRT_ATT_FONT_SIZE,10,
NULL);
TRT_SetValues(TRT_cid2, "Test_tree",
TRT_ATT_FONT_SIZE,10,
NULL);
TRT_SetValues(TRT_cid2, "FilesUnderFold",
TRT_ATT_FONT_SIZE,10,
NULL);
TRT_SetValues(TRT_cid2, "FileContext",
TRT_ATT_FONT_SIZE,10,
NULL);
TRT_SetValues(TRT_cid2, "VariableTree",
TRT_ATT_FONT_SIZE,10,
NULL);
TRT_SetValues(TRT_cid2, "Lbox_RunShow",
TRT_ATT_FONT_SIZE,10,
NULL);
TRT_SetValues(TRT_cid2, "VariableTree",
TRT_ATT_STATE,TRUE,
TRT_ATT_CURRENT_ITEM,0,
NULL);
/*************Load Directory Automatically**************************/
if(!start){ /*This part run only one time.*/
Directory_Load();
Directory_Load();
TRT_SetValues(TRT_cid2, "Message_Display",
TRT_ATT_TEXT,"Open the directory Successly!",
NULL);
TRT_SetValues(TRT_cid2, "Test_tree",
TRT_ATT_STATE,TRUE,
TRT_ATT_CURRENT_ITEM,0,
NULL);
TRT_SetValues(TRT_cid2, "FilesUnderFold",
TRT_ATT_STATE,TRUE,
TRT_ATT_CURRENT_ITEM,0,
NULL);
start=1;
};
}
/*F*/
/*
************************************************************************
** >AUTHOR : Jiang
** FUNCTION NAME : B4_M008_StartNC
**
** >DESCRIPTION: to run a NC program
**
** >NOTES: none
**
** >PARAMETER: none
**
** >RETURN VALUE: none
**
** >INCLUDES:dab_h_axis_if.h
**
*/
EXPORT void B4_M008_StartNC(TRT_ReceiveData* Datat, void*ClientData_p){
Dab_h_RunNcProg();
}
/*F*/
/*
************************************************************************
** >AUTHOR : Jiang
** FUNCTIONNAME : B1_M008_ModeSelect
**
** >DESCRIPTION: this funktion is to switch NC Mode by one button.
**
** >NOTES:
**
** >PARAMETER:
**
** >RETURN VALUE:
**
** >INCLUDES:
**
*/
EXPORT void B1_M008_ModeSelect(TRT_ReceiveData* Datat, void* ClientData_p){
static int SwitchFlag=0;
SwitchFlag++;
if(SwitchFlag==4) SwitchFlag=1;
if(SwitchFlag==1) Dab_h_SelContinueMode();
if(SwitchFlag==2) Dab_h_SelDebugSTEPMode();
if(SwitchFlag==3) Dab_h_SelDebugPROGMode();
}
/*F*/
/*
************************************************************************
** >AUTHOR : Jiang
** FUNCTIONNAME : GetCPLVariableValue_Rec
**
** >DESCRIPTION: this funktion is Callback function of B7_M008_AddWatchPoint
**
** >NOTES:
**
** >PARAMETER:
**
** >RETURN VALUE:
**
** >INCLUDES:
**
*/
LOCAL int GetCPLVariableValue_Rec(Ncs_Msg_t *ncsMsg, Ncs_RecPara_t* para)
{
int Fehler;
int UserId;
int Version;
int Ergebnis;
int ErgebnisBelegt;
int ElemAnz = 1;
int Index1;
int Index2;
int Idfind; /*we use it to find watchpoint record place.*/
char Valuebuffer[10];
int Find=0;
int TilconError;
char Indexbuffer[20];
Fehler = Ncs_CplWatchVarArr_X (ncsMsg,
&UserId,
&Version,
&ErgebnisBelegt,
&Ergebnis,
&ElemAnz,
&Index1,
&Index2);
if (Fehler != 0)
{
/* Error in requesting (see */
/* FUNKTIONSWERT Ncs_CplWatchVarArr_X) */
}
else
{
if (ErgebnisBelegt == 0)
{
/* The CPL variable exists but has no */
/* valid value. The variable 'Version' contains the */
/* current version number. */
}
else
{
/* we can find ,because we have record it ,here only find it.*/
for(Idfind=0;Idfind<WatchPointRecordNr;Idfind++){
if(WatchPointRecord[Idfind].ID==UserId){
break;
}
};
//save the watchpoint value
WatchPointRecord[Idfind].Value=Ergebnis;
sprintf(Indexbuffer,"VariableList#%d#1",WatchPointRecord[Idfind].Index);
sprintf(Valuebuffer,"%d",WatchPointRecord[Idfind].Value);
TilconError = TRT_SetValues(TRT_cid2,Indexbuffer,
TRT_ATT_TEXT,Valuebuffer,
NULL);
}
}
/* Requesting the watchpoint */
Fehler = Ncs_CplWatchVarArrGet_A(GetCPLVariableValue_Rec,
(Ncs_RecPara_t*)NULL,
UserId,
Version);
return 0;
}
/*F*/
/*
************************************************************************
** >AUTHOR : Jiang
** FUNCTIONNAME : B7_M008_AddWatchPoint
**
** >DESCRIPTION: this funktion is used to add a watchpoint.
**
** >NOTES:
**
** >PARAMETER:
**
** >RETURN VALUE:
**
** >INCLUDES:
**
*/
EXPORT void B5_M008_AddWatchPoint(TRT_ReceiveData* Datat, void* ClientData_p){
char cBuffer[20];/*Save Watch Point name*/
int Fehler;
int UserId;
int Version;
int Ergebnis;
int ElemAnz = 1;
int TilconError = 0;
int index1=1;
int index2=1;
char Listbuffer[20]="";
int n;
char Number[10]="";
/*Get the Watch point you want to monitor*/
TRT_GetValues(TRT_cid2, "WatchSelect",
TRT_ATT_TEXT,cBuffer,
NULL);
/*if Watchpoint list have had that variable,adding will be cancel.*/
for(n=0;n<WatchPointRecordNr;n++){
if(!strcmp(WatchPointRecord[n].Name,cBuffer))
return ;
}
/* Creation of the watchpoint */
Fehler = Ncs_CplWatchPermVarArrCreate
(&UserId, //get user id
&Version, //version number
1, //write access
cBuffer, //watchpoint name
0, //type of variable
&Ergebnis, //result
&ElemAnz,
1, //index,or 1
1); //index,or 1
if (Fehler != 0)
{
/* Error in creating the watchpoint (see */
/* FUNKTIONSWERT Ncs_CplWatchPermVarArrCreate) */
}
else
{
/*Save watchpoint ID,Index,Name*/
/*We will save watchpoint value in the Callback function.*/
WatchPointRecord[WatchPointRecordNr].ID=UserId;
WatchPointRecord[WatchPointRecordNr].Index=WatchPointRecordNr;
strcpy(WatchPointRecord[WatchPointRecordNr].Name,cBuffer);
/*Add Watchpoint name into the watchpoint list.*/
sprintf(Listbuffer,"VariableList#%d#0",WatchPointRecord[WatchPointRecordNr].Index);
TRT_SetValues(TRT_cid2,Listbuffer,
TRT_ATT_TEXT,WatchPointRecord[WatchPointRecordNr].Name,
NULL);
WatchPointRecordNr++; /*we have add a watchpoint*/
}
Fehler = Ncs_CplWatchVarArrGet_A(GetCPLVariableValue_Rec,
(Ncs_RecPara_t*)NULL,
UserId,
Version);
if (Fehler!= 0)
{
//Error occurs!
}
else{
}
}
/*F*/
/*
************************************************************************
** >AUTHOR : Jiang
** FUNCTIONNAME : DelCPLWatchPoint_Rec
**
** >DESCRIPTION: this funktion is a Callback function of B8_M008_DelWatchPoint
**
** >NOTES:
**
** >PARAMETER:
**
** >RETURN VALUE:
**
** >INCLUDES:
**
*/
LOCAL void DelCPLWatchPoint_Rec(Ncs_Msg_t *ncsMsg, Ncs_RecPara_t para){
int Error=0;
char Number[10]="";
char Listbuffer[20]="";
Error=Ncs_CplWatchVarDelete_X(ncsMsg);
if(!Error){
WatchPointRecordNr--; /*the number of the watchpoint decrease 1*/
sprintf(Listbuffer,"VariableList#%d#0",WatchPointRecordNr);
TRT_SetValues(TRT_cid2,Listbuffer,
TRT_ATT_TEXT,"",
NULL);
sprintf(Listbuffer,"VariableList#%d#1",WatchPointRecordNr);
TRT_SetValues(TRT_cid2,Listbuffer,
TRT_ATT_TEXT,"",
NULL);
/*delete the watchpoint record from the list.*/
}
else{
if(Error==-8){
//asynchronous sub program active
}
if(Error==-10){
//Incorrect user identification number
}
}
}
/*F*/
/*
************************************************************************
** >AUTHOR : Jiang
** FUNCTIONNAME : B8_M008_DelWatchPoint
**
** >DESCRIPTION: this funktion is used to delete a watchpoint.
**
** >NOTES:
**
** >PARAMETER:
**
** >RETURN VALUE:
**
** >INCLUDES:
**
*/
EXPORT void B6_M008_DelWatchPoint(TRT_ReceiveData* Datat, void* ClientData_p){
char cBuffer[20];
int Error;
int Idexfind;
BOOL Find=FALSE;
char Listbuffer[20]="";
char Listbuffer1[20]="";
char Listbuffer2[20]="";
char temp[20]="";
int MovFlag=0;
//Get the Watch variable you want to handle(add/delete)
TRT_GetValues(TRT_cid2, "WatchSelect",
TRT_ATT_TEXT,cBuffer,
NULL);
//find the Watchpoint variable in the watchpoint list.
for(Idexfind=0;Idexfind<WatchPointRecordNr;Idexfind++){
if(!strcmp(WatchPointRecord[Idexfind].Name,cBuffer)){
Find=TRUE;
break;}
};
if(Find){
Error=Ncs_CplWatchVarDelete_A(DelCPLWatchPoint_Rec,
(Ncs_RecPara_t)NULL,//
WatchPointRecord[Idexfind].ID); //system task
if(!Error){
MovFlag=WatchPointRecord[Idexfind].Index;
//move following data one step forward
do{
//1: Record updata WatchPointRecord(n) <- WatchPointRecord(n+1)
strcpy(WatchPointRecord[MovFlag].Name,WatchPointRecord[MovFlag+1].Name);
WatchPointRecord[MovFlag].ID=WatchPointRecord[MovFlag+1].ID;
WatchPointRecord[MovFlag].Index=WatchPointRecord[MovFlag+1].Index-1;
WatchPointRecord[MovFlag].Value=WatchPointRecord[MovFlag+1].Value;
/*Updata watchpoint name palce */
sprintf(Listbuffer1,"VariableList#%d#0",WatchPointRecord[MovFlag].Index);
/*Updata watchpoint name at that place*/
TRT_SetValues(TRT_cid2,Listbuffer1,
TRT_ATT_TEXT,WatchPointRecord[MovFlag].Name,
NULL);
/*Updata watchpoint value palce */
sprintf(Listbuffer2,"VariableList#%d#1",WatchPointRecord[MovFlag].Index);
/*Updata watchpoint value at that place*/
sprintf(temp,"%d",WatchPointRecord[MovFlag].Value);
TRT_SetValues(TRT_cid2,Listbuffer2,
TRT_ATT_TEXT,temp,
NULL);
MovFlag++;
}while(MovFlag<WatchPointRecordNr);//Move!
TRT_SetValues(TRT_cid2,"Message_Display",
TRT_ATT_TEXT,"It will be Delete soon!",NULL);
}//No error! */
}//Find!
else{
TRT_SetValues(TRT_cid2,"Message_Display",
TRT_ATT_TEXT,"There is no that WatchPoint!",NULL);
}
TRT_SetValues(TRT_cid2,"WatchSelect",
TRT_ATT_TEXT,"",
NULL);
}//End function!
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -