?? 101e3568af5f001d1289bbda6de18a35
字號:
EXPORT void Dab_h_Backup(void){ Ncs_DataExport(NCS_TAR_MODE_MACODA_C,0,"/mnt/UserBackup");}/*F*//*************************************************************************** >AUTHOR : AB** FUNCTION NAME : Dab_h_CloneMachine** ** >DESCRIPTION: Test Clone Maschine** ** >NOTES: ** ** >PARAMETER:** ** >RETURN VALUE:** ** >INCLUDES:** */EXPORT void Dab_h_CloneMaschine(void){ TRT_Display(TRT_cid,"Wait_Icon"); Ncs_CloneMachine(); TRT_Hide(TRT_cid,"Wait_Icon");}/*F*//*************************************************************************** >AUTHOR : AB** FUNCTION NAME : ** ** >DESCRIPTION: Test restore** ** >NOTES: ** ** >PARAMETER:** ** >RETURN VALUE:** ** >INCLUDES:** */EXPORT void Dab_h_RestoreMaschine(void){ TRT_Display(TRT_cid,"Wait_Icon"); Ncs_RetoreMachine(); TRT_Hide(TRT_cid,"Wait_Icon");}/*----------------------------------------------------------------------*//*--------------- Example of CIL Editor -------------------------------*//*----------------------------------------------------------------------*//*F*//*************************************************************************** >AUTHOR : AB** FUNCTION NAME : ** ** >DESCRIPTION: Test Read Pou** ** >NOTES: ** ** >PARAMETER:** ** >RETURN VALUE:** ** >INCLUDES:** */EXPORT void Dab_h_ReadPou(void){ char PouBuffer[200]=""; unsigned long Size=200; int returnValue; returnValue=Ncs_Ilc_CILEReadPouByName(POUNamebuffer,PouBuffer,&Size); TRT_SetValues(TRT_cid2,"CILEDITOR", TRT_ATT_TEXT,PouBuffer,NULL);}/*************************************************************************** >AUTHOR : AB** FUNCTION NAME : ** ** >DESCRIPTION: Cleare Cil Display ** ** >NOTES: ** ** >PARAMETER:** ** >RETURN VALUE:** ** >INCLUDES:** */EXPORT void Dab_h_CleareCilDisplay(void){ char PouBuffer[]=""; /*Clear POU info and monitor info*/ TRT_SetValues(TRT_cid2,"MONIVALUE", TRT_ATT_TEXT,PouBuffer,NULL); TRT_SetValues(TRT_cid2,"MONITYPE", TRT_ATT_TEXT,PouBuffer,NULL); TRT_SetValues(TRT_cid2,"INF1", TRT_ATT_TEXT,PouBuffer,NULL); TRT_SetValues(TRT_cid2,"INF2", TRT_ATT_TEXT,PouBuffer,NULL); TRT_SetValues(TRT_cid2,"INF3", TRT_ATT_TEXT,PouBuffer,NULL); TRT_SetValues(TRT_cid2,"INF4", TRT_ATT_TEXT,PouBuffer,NULL); TRT_SetValues(TRT_cid2,"INF5", TRT_ATT_TEXT,PouBuffer,NULL); TRT_SetValues(TRT_cid2,"CILEDITOR", TRT_ATT_TEXT,PouBuffer,NULL); }/*F*//*************************************************************************** >AUTHOR : AB** FUNCTION NAME : ** ** >DESCRIPTION: Test Compile Pou** ** >NOTES: ** ** >PARAMETER:** ** >RETURN VALUE:** ** >INCLUDES:** */EXPORT void Dab_h_CompilePou(void){ Ncs_CILE_CompErrInf_t Struct1; unsigned long CompileCode; /* Handel to Compile Result*/ char PouInBuffer [200]; /* Fehler Nummer z.b Fehler Position 2 */ Ncs_CILE_CompErr_t Array[5]; char CompileOut [100]; int ii,len; char POUName[10]=""; memset(Array, 0, sizeof(Array)); Struct1.pCompileErrors=Array; Struct1.iCapacity=5; Struct1.iErrorCount=0; /*Get the POU name which POU you want to compile*/ TRT_GetValues(TRT_cid2,"POUNAME", TRT_ATT_TEXT,POUName, NULL); TRT_GetValues(TRT_cid2,"CILEDITOR", TRT_ATT_TEXT,PouInBuffer,NULL); len = strlen(PouInBuffer) ; for(ii=0; ii<len; ii++ ) { if(PouInBuffer[ii]=='\r') PouInBuffer[ii] = '\n'; } /* Write*/ Ncs_Ilc_CILEWritePouByName(POUName,PouInBuffer); /* Compile*/ Ncs_Ilc_CILECompilePouByName(POUName, &Struct1, 0, &CompileCode);
HandelCompiled = CompileCode; /* chec if Error*/ if (Struct1.iErrorCount==0) { /* Actrivate Compiled Pou*/ Ncs_Ilc_CILEReplacePouByName (POUName,CompileCode); /* save in CilBoot*/ Ncs_Ilc_CILESaveBootApplication(POUName); } /* Output of Compile Error*/ /* Build Compile Error Texte*/ /* See Bibliothec-> Cilexecution 1.0.0.1-> enumeration->CIl_Error_Codes*/ #if 0 /*not implemented now.only in case of using error texte */ ARRAY[0..CILE_ErrorCodes.MaxError - 1] OF CILE_ErrorPattern := [ (diErrorCodeCILE_ErrorCodes.NoError (0), stPart1 := 'Ok'), (diErrorCode := CILE_ErrorCodes.NoMemoryForCompiledPou (1), iPartCount := 2, stPart1 := 'No memory for compiled pou: '), (diErrorCode := CILE_ErrorCodes.InvalidOperator (2), iPartCount := 2, stPart1 := 'Invalid Operator: '), (diErrorCode := CILE_ErrorCodes.TooManyCodeLines, iPartCount := 2, stPart1 := 'Signature: ', stPart2 := ' has too many lines of code'), (diErrorCode := CILE_ErrorCodes.InvalidOperand, iPartCount := 2, stPart1 := 'Invalid Operand: '), (diErrorCode := CILE_ErrorCodes.InvalidOperandType, iPartCount := 2, stPart1 := 'Invalid Type of Operand: $'', stPart2 := '$' Only addresses, literals and pou references allowed'), (diErrorCode := CILE_ErrorCodes.NoAddress, iPartCount := 2, stPart1 := 'No address specified in Operand: '), (diErrorCode := CILE_ErrorCodes.InvalidAddress, iPartCount := 2, stPart1 := 'Invalid address specified in Operand: '), (diErrorCode := CILE_ErrorCodes.TooLargeAddress, iPartCount := 3, stPart1 := 'The specified address in the Operand $'', stPart2 := '$' is too large, ', stPart3 := CONCAT(WORD_TO_STRING(SizeConstants.MaxAddress), 'is the largest allowed address')), (diErrorCode := CILE_ErrorCodes.NotYetImplemented, iPartCount := 2, stPart1 := 'A used feature is not yet implemented: '), (diErrorCode := CILE_ErrorCodes.InvalidBitAccess, iPartCount := 2, stPart1 := 'The operand uses an invalid bitaccess: '), (diErrorCode := CILE_ErrorCodes.TooLargeBitAddress, iPartCount := 3, stPart1 := 'The specified bitaddress in the Operand $'', stPart2 := '$' is too large, ', stPart3 := CONCAT(WORD_TO_STRING(Constants.MaxBitAccess), 'is the largest allowed bitaddress')), (diErrorCode := CILE_ErrorCodes.Internal, iPartCount := 1, stPart1 := 'An internal error happened'), (diErrorCode := CILE_ErrorCodes.InvalidPouId, iPartCount := 2, stPart1 := 'An invalid pou id has been specified: '), (diErrorCode := CILE_ErrorCodes.InvalidPou, iPartCount := 2, stPart1 := 'The pou with the following id is invalid: '), (diErrorCode := CILE_ErrorCodes.InvalidOperatorModifier, iPartCount := 1, stPart1 := 'The operator has an invalid modifier'), (diErrorCode := CILE_ErrorCodes.InvalidLiteralType, iPartCount := 1, stPart1 := 'The literal type of the operand is invalid'), (diErrorCode := CILE_ErrorCodes.InvalidLiteralValue, iPartCount := 2, stPart1 := 'The literal value of the operand is invalid: '), (diErrorCode := CILE_ErrorCodes.DivByZero, iPartCount := 1, stPart1 := 'Division by Zero'), (diErrorCode := CILE_ErrorCodes.TooManyPous, iPartCount := 1, stPart1 := 'Too many pous used concurrently.'), (diErrorCode := CILE_ErrorCodes.SignatureNotFound, iPartCount := 2, stPart1 := 'The signature $'', stPart2 := '$' was not found.'), (diErrorCode := CILE_ErrorCodes.CompiledPouNotFound, iPartCount := 2, stPart1 := 'No pou exists for the name $'', stPart2 := '$'. It will be created'), (diErrorCode := CILE_ErrorCodes.Watchdog, iPartCount := 2, stPart1 := 'The watchdog for the execution has expired after ', stPart2 := 'ms'), (diErrorCode := CILE_ErrorCodes.InvalidJump, iPartCount := 2, stPart1 := 'A jump to the invalid address ', stPart2 := ' happened'), (diErrorCode := CILE_ErrorCodes.InvalidAccuType, iPartCount := 1, stPart1 := 'The current type of the accu register is wrong'), (diErrorCode := CILE_ErrorCodes.UnknownPou, iPartCount := 2, stPart1 := 'The pou $'', stPart2 := '$' is not registered within the pouorganizer'), (diErrorCode := CILE_ErrorCodes.WriteError, iPartCount := 2, stPart1 := 'A problem occurred during saving the pou'), (diErrorCode := CILE_ErrorCodes.TooLargeCodeLine, iPartCount := 1, stPart1 := 'A line of code in the source that is to load was too long.'), (diErrorCode := CILE_ErrorCodes.NoMemoryOperandOperator, iPartCount := 3, stPart1 := 'The operator $'', stPart2 := '$' does not allow the memory operand $'', stPart3 := '$''), (diErrorCode := CILE_ErrorCodes.NoMemoryBitOperandOperator, iPartCount := 3, stPart1 := 'The operator $'', stPart2 := '$' does not allow the memory-bit operand $'', stPart3 := '$''), (diErrorCode := CILE_ErrorCodes.NoLiteralBitOperandOperator, iPartCount := 3, stPart1 := 'The operator $'', stPart2 := '$' does not allow the literal bit-operand $'', stPart3 := '$''), (diErrorCode := CILE_ErrorCodes.NoLiteralNumericOperandOperator, iPartCount := 3, stPart1 := 'The operator $'', stPart2 := '$' does not allow the literal numeric operand $'', stPart3 := '$''), (diErrorCode := CILE_ErrorCodes.TwoSubsequentNetworkNumbers, iPartCount := 1, stPart1 := 'Two subsequent networknumbers'), (diErrorCode := CILE_ErrorCodes.TwoSubsequentComments, iPartCount := 1, stPart1 := 'Two subsequent comments'), (diErrorCode := CILE_ErrorCodes.TooManyComments, iPartCount := 1, stPart1 := 'Too many comments'), (diErrorCode := CILE_ErrorCodes.TooManyNetworks, iPartCount := 1, stPart1 := 'Too many networks'), (diErrorCode := CILE_ErrorCodes.MissingOperator, iPartCount := 1, stPart1 := 'There is no operator'), (diErrorCode := CILE_ErrorCodes.InternalCodeGenError, iPartCount := 1, stPart1 := 'An internal error occurred during code generation'), (diErrorCode := CILE_ErrorCodes.BitAccessOnlyOnBitOperands, iPartCount := 1, stPart1 := 'A bit access is only allowed on bit direct addresses (%*X)'), (diErrorCode := CILE_ErrorCodes.BitOperandWithoutBitAccess, iPartCount := 1, stPart1 := 'A bit direct access (%*X) must have a bit index'), (diErrorCode := CILE_ErrorCodes.InvalidPouAccessOperand, iPartCount := 1, stPart1 := 'An operand for accessing a pou is invalid'), (diErrorCode := CILE_ErrorCodes.NoLdInParentheses, iPartCount := 1, stPart1 := 'LD is not allowed in parentheses'), (diErrorCode := CILE_ErrorCodes.ExpressionTooNested, iPartCount := 1, stPart1 := 'Expression is too nested'), (diErrorCode := CILE_ErrorCodes.CloseParentheseWithoutOpen, iPartCount := 1, stPart1 := 'Closing parenthese found without an open one'), (diErrorCode := CILE_ErrorCodes.STWithWrongType, iPartCount := 1, stPart1 := 'The type of the operand of ST does not match the current accu'), (diErrorCode := CILE_ErrorCodes.NoCodeMemory, iPartCount := 1, stPart1 := 'There is no more memory for code available'), (diErrorCode := CILE_ErrorCodes.AddressNotResolved, iPartCount := 1, stPart1 := 'Internal: The address has not been resolved'), (diErrorCode := CILE_ErrorCodes.SROnlyInBitMode, iPartCount := 1, stPart1 := 'The operators S/R are only allowed with a boolean accumulator'), (diErrorCode := CILE_ErrorCodes.SROnlyWithBitMemoryOperand, iPartCount := 1, stPart1 := 'The operators S/R are only allowed with destinations of type bit'), (diErrorCode := CILE_ErrorCodes.NoMemoryNumericOperandOperator, iPartCount := 3, stPart1 := 'The operator $'', stPart2 := '$' does not allow the numeric operand $'', stPart3 := '$'.'), (diErrorCode := CILE_ErrorCodes.InvalidLabelPosition, iPartCount := 1, stPart1 := 'The label is located at an invalid position'), (diErrorCode := CILE_ErrorCodes.TooManyLabels, iPartCount := 1, stPart1 := 'Too many labels are used in the current pou'), (diErrorCode := CILE_ErrorCodes.DuplicateLabel, iPartCount := 1, stPart1 := 'The label occurs more than once'), (diErrorCode := CILE_ErrorCodes.InvalidLabel, iPartCount := 2, stPart1 := 'The label $'', stPart2 := '$' is not valid'), (diErrorCode := CILE_ErrorCodes.LabelNotDefined, iPartCount := 2, stPart1 := 'The label $'', stPart2 := '$' is not defined'), (diErrorCode := CILE_ErrorCodes.TooManyLabelReferences, iPartCount := 1, stPart1 := 'The label is referenced too often'), (diErrorCode := CILE_ErrorCodes.ComparisonOnlyWithNumericAccu, iPartCount := 1, stPart1 := 'Numeric comparisons must not be done with a boolean result'), (diErrorCode := CILE_ErrorCodes.ComparisonOnlyWithNumericOperand, iPartCount := 1, stPart1 := 'Numeric comparisons must not be done with a boolean operand'), (diErrorCode := CILE_ErrorCodes.ConditionalStmtOnlyInBoolMode, iPartCount := 1, stPart1 := 'Conditional statements must only be used with a boolean result'), (diErrorCode := CILE_ErrorCodes.NoOperandExpected, iPartCount := 2, stPart1 := 'No operand expected for the operator $'', stPart2 := '$''), (diErrorCode := CILE_ErrorCodes.NoCallWithCompoAccess, iPartCount := 1, stPart1 := 'A call is not allowed with access to components'), (diErrorCode := CILE_ErrorCodes.PouAccessOnlyCompoAccess, iPartCount := 2, stPart1 := 'The operator $'', stPart2 := '$' needs an access to a component'), (diErrorCode := CILE_ErrorCodes.InvalidComponentOfPou, iPartCount := 3, stPart1 := 'The operand $'', stPart2 := '$' accesses an invalid component of the type $'', stPart3 := '$''), (diErrorCode := CILE_ErrorCodes.PouIndexOutOfBounds, iPartCount := 3, stPart1 := 'The operand $'', stPart2 := '$' accesses an invalid index of the iec-pou-type $'', stPart3 := '$''), (diErrorCode := CILE_ErrorCodes.InvalidIecPou, iPartCount := 2, stPart1 := 'The operand $'', stPart2 := '$' accesses an invalid iec pou'), (diErrorCode := CILE_ErrorCodes.ConversionWrongAccuType, iPartCount := 2, stPart1 := 'The source type of the conversion $'', stPart2 := '$' does not match the current type'), (diErrorCode := CILE_ErrorCodes.OperatorOnlyWithByteOperand, iPartCount := 2, stPart1 := 'The operator $'', stPart2 := '$' is only allowed with operands of type BYTE'), (diErrorCode := CILE_ErrorCodes.NumericOperationsOnlyWithNumericAccu, iPartCount := 2, stPart1 := 'The operator $'', stPart2 := '$' is only allowed with a numeric accu'), (diErrorCode := CILE_ErrorCodes.TypeMismatchAccuOperand, iPartCount := 3, stPart1 := 'The type $'', stPart2 := '$' of the accu does not match the type $'', stPart3 := '$' of the operand'), (diErrorCode := CILE_ErrorCodes.MissingLD, iPartCount := 1, stPart1 := 'The pou does not start with LD'), (diErrorCode := CILE_ErrorCodes.MissingCloseParenthese, iPartCount := 1, stPart1 := 'A closing parenthese $')$' is missing') ]; switch (GetNumOfParams(Struct1.pCompileErrors[0].ErrorNr)){ case 0: // error = GetErrorText(Struct1.pCompileErrors[0].ErrorNr); case 1: { Ncs_CILE_CompErrInf_t Struct1; unsigned long CompileCode; /* Handel to Compile Result*/ char PouInBuffer [200]; /* Fehler Nummer z.b Fehler Position 2 */ Ncs_CILE_CompErr_t Array[5]; char CompileOut [100]; int ii,len; char POUName[10]=""; memset(Array, 0, sizeof(Array)); Struct1.pCompileErrors=Array; Struct1.iCapacity=5; Struct1.iErrorCount=0; /*Get the POU name which POU you want to compile*/ TRT_GetValues(TRT_cid2,"POUNAME", TRT_ATT_TEXT,POUName, NULL); TRT_GetValues(TRT_cid2,"CILEDITOR", TRT_ATT_TEXT,PouInBuffer,NULL); len = strlen(PouInBuffer) ; for(ii=0; ii<len; ii++ ) { if(PouInBuffer[ii]=='\r') PouInBuffer[ii] = '\n'; } /* Write*/ Ncs_Ilc_CILEWritePouByName(POUName,PouInBuffer); /* Compile*/ Ncs_Ilc_CILECompilePouByName(POUName, &Struct1, 0, &CompileCode);
HandelCompiled = CompileCode; /* chec if Error*/ if (Struct1.iErrorCount==0) { /* Actrivate Compiled Pou*/ Ncs_Ilc_CILEReplacePouByName (POUName,CompileCode); /* save in CilBoot*/ Ncs_Ilc_CILESaveBootApplication(POUName); } /* Output of Compile Error*/ /* Build Compile Error Texte*/ /* See Bibliothec-> Cilexecution 1.0.0.1-> enumeration->CIl_Error_Codes*/ #if 0 /*not implemented now.only in case of using error texte */ ARRAY[0..CILE_ErrorCodes.MaxError - 1] OF CILE_ErrorPattern := [ (diErrorCodeCILE_ErrorCodes.NoError (0), stPart1 := 'Ok'), (diErrorCode := CILE_ErrorCodes.NoMemoryForCompiledPou (1), iPartCount := 2, stPart1 := 'No memory for compiled pou: '), (diErrorCode := CILE_ErrorCodes.InvalidOperator (2), iPartCount := 2, stPart1 := 'Invalid Operator: '), (diErrorCode := CILE_ErrorCodes.TooManyCodeLines, iPartCount := 2, stPart1 := 'Signature: ', stPart2 := ' has too many lines of code'), (diErrorCode := CILE_ErrorCodes.InvalidOperand, iPartCount := 2, stPart1 := 'Invalid Operand: '), (diErrorCode := CILE_ErrorCodes.InvalidOperandType, iPartCount := 2, stPart1 := 'Invalid Type of Operand: $'', stPart2 := '$' Only addresses, literals and pou references allowed'), (diErrorCode := CILE_ErrorCodes.NoAddress, iPartCount := 2, stPart1 := 'No address specified in Operand: '), (diErrorCode := CILE_ErrorCodes.InvalidAddress, iPartCount := 2, stPart1 := 'Invalid address specified in Operand: '), (diErrorCode := CILE_ErrorCodes.TooLargeAddress, iPartCount := 3, stPart1 := 'The specified address in the Operand $'', stPart2 := '$' is too large, ', stPart3 := CONCAT(WORD_TO_STRING(SizeConstants.MaxAddress), 'is the largest allowed address')), (diErrorCode := CILE_ErrorCodes.NotYetImplemented, iPartCount := 2, stPart1 := 'A used feature is not yet implemented: '), (diErrorCode := CILE_ErrorCodes.InvalidBitAccess, iPartCount := 2, stPart1 := 'The operand uses an invalid bitaccess: '), (diErrorCode := CILE_ErrorCodes.TooLargeBitAddress, iPartCount := 3, stPart1 := 'The specified bitaddress in the Operand $'', stPart2 := '$' is too large, ', stPart3 := CONCAT(WORD_TO_STRING(Constants.MaxBitAccess), 'is the largest allowed bitaddress')), (diErrorCode := CILE_ErrorCodes.Internal, iPartCount := 1, stPart1 := 'An internal error happened'), (diErrorCode := CILE_ErrorCodes.InvalidPouId, iPartCount := 2, stPart1 := 'An invalid pou id has been specified: '), (diErrorCode := CILE_ErrorCodes.InvalidPou, iPartCount := 2, stPart1 := 'The pou with the following id is invalid: '), (diErrorCode := CILE_ErrorCodes.InvalidOperatorModifier, iPartCount := 1, stPart1 := 'The operator has an invalid modifier'), (diErrorCode := CILE_ErrorCodes.InvalidLiteralType, iPartCount := 1, stPart1 := 'The literal type of the operand is invalid'), (diErrorCode := CILE_ErrorCodes.InvalidLiteralValue, iPartCount := 2, stPart1 := 'The literal value of the operand is invalid: '),
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -