public static void OptimizeAWL(S7FunctionBlock myPLCBlock, int akMemnoic) { int MN = 0; List<S7FunctionBlockRow> delLst = new List<S7FunctionBlockRow>(); string akdb = ""; for (int n = 0; n < myPLCBlock.AWLCode.Count; n++) //foreach (var myAkVal in myPLCBlock.AWLCode) { S7FunctionBlockRow myAkVal = (S7FunctionBlockRow)myPLCBlock.AWLCode[n]; if (myAkVal.Command == Mnemonic.opNOP[MN] || myAkVal.Command == Mnemonic.opBLD[MN]) { if (myAkVal.Label == "") delLst.Add(myAkVal); else if (myAkVal.Label != "" && n < myPLCBlock.AWLCode.Count - 1 && myPLCBlock.AWLCode[n + 1].Label == "") { myPLCBlock.AWLCode[n + 1].Label = myAkVal.Label; delLst.Add(myAkVal); } } else if (myAkVal.Command == Mnemonic.opAUF[MN] && myAkVal.Label == "") if (akdb == myAkVal.Parameter && !akdb.Contains("[") && myAkVal.Label == "") delLst.Add(myAkVal); else akdb = myAkVal.Parameter; else if (myAkVal.Label != "" || myAkVal.Command == Mnemonic.opUC[akMemnoic] || myAkVal.Command == Mnemonic.opCC[akMemnoic]) //If there is a Jump or Call, reset the actual DB! akdb = ""; } foreach (var myAkVal in delLst) myPLCBlock.AWLCode.Remove(myAkVal); }
//todo only use the networks structure! public static List<Network> GetNetworksList(S7FunctionBlock blk) { var retVal = new List<Network>(); S7FunctionBlockNetwork nw = null; if (blk.AWLCode != null) foreach (S7FunctionBlockRow s7FunctionBlockRow in blk.AWLCode) { if (s7FunctionBlockRow.Command == "NETWORK") { nw = new S7FunctionBlockNetwork(); nw.Parent = blk; nw.AWLCode = new List<FunctionBlockRow>(); retVal.Add(nw); nw.Name = s7FunctionBlockRow.NetworkName; nw.Comment = s7FunctionBlockRow.Comment; } else { if (nw == null) { nw = new S7FunctionBlockNetwork(); nw.Parent = blk; nw.AWLCode = new List<FunctionBlockRow>(); retVal.Add(nw); } nw.AWLCode.Add(s7FunctionBlockRow); } } return retVal; }
public static List<S7FunctionBlockRow> GenerateFBParameterUsesFromAR2Calls(S7FunctionBlock myBlk, int Memnoic) { List<S7FunctionBlockRow> retVal = new List<S7FunctionBlockRow>(); //In this list the Values are stored when we try to combine them, //when we are succesfull, this list is cleard, when not, it is added to the retVal List<S7FunctionBlockRow> tmpVal = new List<S7FunctionBlockRow>(); //if the command is a TAR xx this will be set! int combineStep = 0; int byteaddr = 0; int bitaddr = 0; string TarLdTarget = ""; /* Todo: Converting FB Commands to Access to Static Data * * Like: * TAR2 LD1 This is done, wehen the static address gets to high! +AR2 P#4090.0 so the ar2 is saved, then increased and the it loads the data. +AR2 P#4090.0 later ar2 is saved back! L DID[AR2,P#1840.0] LAR2 LD1 * * * or: TAR2 LD1 +AR2 P#4090.0 +AR2 P#4090.0 U DIX[AR2,P#1838.0] LAR2 LD1 * or a simple one: * L DID[AR2,P#294.0] should be: L #blabla (wher blabla is static data at 294) */ //Check if Command is a TAR to LokalData, wich is not defined in the Interface //If next command is a + stor the address //if next command contains [ar2,xx) add the stored vakue to xx //and change the whole command to the parameter if there is a matching one //check if command is a lar2 from the lokaldata used before //if not role back! foreach (S7FunctionBlockRow plcFunctionBlockRow in myBlk.AWLCode) { if (plcFunctionBlockRow.Command == MC7.Mnemonic.opTAR2[Memnoic] && plcFunctionBlockRow.Parameter.Contains("LD")) { retVal.AddRange(tmpVal); tmpVal.Clear(); tmpVal.Add(plcFunctionBlockRow); combineStep = 1; byteaddr = 0; bitaddr = 0; TarLdTarget = plcFunctionBlockRow.Parameter; } else if (combineStep == 1 && plcFunctionBlockRow.Command == MC7.Mnemonic.opPAR2[Memnoic]) { tmpVal.Add(plcFunctionBlockRow); byteaddr = Convert.ToInt32(plcFunctionBlockRow.Parameter.Split(new char[] {'#'})[1]); } else if (combineStep == 1 && plcFunctionBlockRow.Parameter.Contains("[AR2,P#")) { tmpVal.Add(plcFunctionBlockRow); combineStep = 2; } else if ( (combineStep == 2 && plcFunctionBlockRow.Command == MC7.Mnemonic.opLAR2[Memnoic] && plcFunctionBlockRow.Parameter == TarLdTarget) || (combineStep == 0 && plcFunctionBlockRow.Parameter.Contains("[AR2,P#")) ) { //OK we commbined the command sucessfully, add the new command, delete the old ones... //And add the Byte Sequence from the old commands to the new. List<byte> bytes =new List<byte>(); foreach (S7FunctionBlockRow tmpFunctionBlockRow in tmpVal) bytes.AddRange(tmpFunctionBlockRow.MC7); retVal.Add(new S7FunctionBlockRow() {MC7 = bytes.ToArray()}); tmpVal.Clear(); combineStep = 0; } else { retVal.AddRange(tmpVal); tmpVal.Clear(); retVal.Add(plcFunctionBlockRow); combineStep = 0; } } return retVal; }
//Todo: Check if Jump label is used in the Block! public static bool IsJumpTarget(S7FunctionBlockRow myCmd, S7FunctionBlock myBlk) { if (!string.IsNullOrEmpty(myCmd.Label)) return true; return false; }
public Block GetBlock(ProjectBlockInfo blkInfo, S7ConvertingOptions myConvOpt) { if (blkInfo._Block != null && ((blkInfo._Block) as S7Block).usedS7ConvertingOptions.Equals(myConvOpt)) return blkInfo._Block; ProjectPlcBlockInfo plcblkifo = (ProjectPlcBlockInfo)blkInfo; tmpBlock myTmpBlk = GetBlockBytes(blkInfo); List<Step7Attribute> step7Attributes = null; if (myTmpBlk != null) { if (myTmpBlk.uda != null) { int uPos = 2; if (myTmpBlk.uda != null && myTmpBlk.uda.Length > 0 && myTmpBlk.uda[0] > 0) { step7Attributes = new List<Step7Attribute>(); for (int j = 0; j < myTmpBlk.uda[0]; j++) { string t1 = Project.ProjectEncoding.GetString(myTmpBlk.uda, uPos + 1, myTmpBlk.uda[uPos]); uPos += myTmpBlk.uda[uPos] + 1; string t2 = Project.ProjectEncoding.GetString(myTmpBlk.uda, uPos + 1, myTmpBlk.uda[uPos]); uPos += myTmpBlk.uda[uPos] + 1; step7Attributes.Add(new Step7Attribute(t1, t2)); } } } //Begin with the Block Reading... if (blkInfo.BlockType == PLCBlockType.VAT) { S7VATBlock retValBlock = new S7VATBlock(myTmpBlk.mc7code, myTmpBlk.comments, plcblkifo.BlockNumber, Project.ProjectEncoding); retValBlock.Attributes = step7Attributes; retValBlock.LastCodeChange = myTmpBlk.LastCodeChange; retValBlock.LastInterfaceChange = myTmpBlk.LastInterfaceChange; retValBlock.ParentFolder = this; retValBlock.usedS7ConvertingOptions = myConvOpt; blkInfo._Block = retValBlock; return retValBlock; } else if (blkInfo.BlockType == PLCBlockType.DB || blkInfo.BlockType == PLCBlockType.UDT) { List<string> tmpList = new List<string>(); S7DataBlock retVal = new S7DataBlock(); retVal.IsInstanceDB = myTmpBlk.IsInstanceDB; retVal.FBNumber = myTmpBlk.FBNumber; if (myTmpBlk.mc7code != null) retVal.CodeSize = myTmpBlk.mc7code.Length; retVal.StructureFromString = Parameter.GetInterfaceOrDBFromStep7ProjectString(myTmpBlk.blkinterface, ref tmpList, blkInfo.BlockType, false, this, retVal, myTmpBlk.mc7code); if (myTmpBlk.blkinterfaceInMC5 != null) { //List<string> tmp = new List<string>(); //retVal.StructureFromMC7 = Parameter.GetInterface(myTmpBlk.blkinterfaceInMC5, myTmpBlk.mc7code, ref tmp, blkInfo.BlockType, myTmpBlk.IsInstanceDB, retVal); } retVal.BlockNumber = plcblkifo.BlockNumber; retVal.BlockType = blkInfo.BlockType; retVal.Attributes = step7Attributes; retVal.LastCodeChange = myTmpBlk.LastCodeChange; retVal.LastInterfaceChange = myTmpBlk.LastInterfaceChange; retVal.ParentFolder = this; retVal.usedS7ConvertingOptions = myConvOpt; blkInfo._Block = retVal; return retVal; } else if (blkInfo.BlockType == PLCBlockType.FC || blkInfo.BlockType == PLCBlockType.FB || blkInfo.BlockType == PLCBlockType.OB || blkInfo.BlockType == PLCBlockType.SFB || blkInfo.BlockType == PLCBlockType.SFC) { List<string> ParaList = new List<string>(); S7FunctionBlock retVal = new S7FunctionBlock(); retVal.LastCodeChange = myTmpBlk.LastCodeChange; retVal.LastInterfaceChange = myTmpBlk.LastInterfaceChange; retVal.BlockNumber = plcblkifo.BlockNumber; retVal.BlockType = blkInfo.BlockType; retVal.Attributes = step7Attributes; retVal.KnowHowProtection = myTmpBlk.knowHowProtection; retVal.MnemonicLanguage = Project.ProjectLanguage; retVal.Author = myTmpBlk.username; retVal.Version = myTmpBlk.version; retVal.Parameter = Parameter.GetInterfaceOrDBFromStep7ProjectString(myTmpBlk.blkinterface, ref ParaList, blkInfo.BlockType, false, this, retVal); if (myTmpBlk.blockdescription != null) { retVal.Title = Project.ProjectEncoding.GetString(myTmpBlk.blockdescription, 3, myTmpBlk.blockdescription[1] - 4); retVal.Description = Project.ProjectEncoding.GetString(myTmpBlk.blockdescription, myTmpBlk.blockdescription[1], myTmpBlk.blockdescription.Length - myTmpBlk.blockdescription[1] - 1).Replace("\n", Environment.NewLine); } if (blkInfo.BlockType == PLCBlockType.FC || blkInfo.BlockType == PLCBlockType.FB || blkInfo.BlockType == PLCBlockType.OB) { retVal.CodeSize = myTmpBlk.mc7code.Length; int[] Networks; Networks = NetWork.GetNetworks(0, myTmpBlk.nwinfo); S7ProgrammFolder prgFld = null; if (this.Parent is S7ProgrammFolder) prgFld = (S7ProgrammFolder)this.Parent; retVal.AWLCode = MC7toAWL.GetAWL(0, myTmpBlk.mc7code.Length - 2, (int)myConvOpt.Mnemonic, myTmpBlk.mc7code, Networks, ParaList, prgFld, retVal); retVal.AWLCode = JumpMarks.AddJumpmarks(retVal.AWLCode, myTmpBlk.jumpmarks, myTmpBlk.nwinfo, myConvOpt); LocalDataConverter.ConvertLocaldataToSymbols(retVal, myConvOpt); CallConverter.ConvertUCToCall(retVal, prgFld, this, myConvOpt, null); FBStaticAccessConverter.ReplaceStaticAccess(retVal, prgFld, myConvOpt); #region UseComments from Block if (myConvOpt.UseComments) { List<FunctionBlockRow> newAwlCode = new List<FunctionBlockRow>(); int n = 0; int akRowInAwlCode = 0; int lineNumberInCall = 0; //Counter wich line in Command (for Calls and UCs) if (myTmpBlk.comments != null) { byte[] cmt = myTmpBlk.comments; //string aa = System.Text.Encoding.GetEncoding("Windows-1251").GetString(cmt); //string testaa = ""; while (n < myTmpBlk.comments.Length) { int kommLen = cmt[n + 0]; int startNWKomm = cmt[n + 1]; int anzUebsprungZeilen = cmt[n + 2] + cmt[n + 3] * 0x100; int lenNWKommZeile = cmt[n + 3] + cmt[n + 4] * 0x100; //Console.WriteLine(cmt[n + 5].ToString("X")); if (cmt[n + 5] == 0x06) { //NWKomentar: string tx1 = Project.ProjectEncoding.GetString(cmt, n + 6, startNWKomm - 7); string tx2 = Project.ProjectEncoding.GetString(cmt, n + startNWKomm, lenNWKommZeile - startNWKomm - 1).Replace("\n", Environment.NewLine); n += lenNWKommZeile; if (retVal.AWLCode.Count > akRowInAwlCode) { while (retVal.AWLCode.Count - 1 > akRowInAwlCode && retVal.AWLCode[akRowInAwlCode].Command != "NETWORK") { if (!newAwlCode.Contains(retVal.AWLCode[akRowInAwlCode])) { //newAwlCode.Add(retVal.AWLCode[akRowInAwlCode]); S7FunctionBlockRow akRw = (S7FunctionBlockRow)retVal.AWLCode[akRowInAwlCode]; if (akRw.CombineDBAccess) { S7FunctionBlockRow nRw = (S7FunctionBlockRow)retVal.AWLCode[akRowInAwlCode + 1]; if (!nRw.Parameter.Contains("[")) { nRw.Parameter = akRw.Parameter + "." + nRw.Parameter; nRw.MC7 = Helper.CombineByteArray(akRw.MC7, nRw.MC7); nRw.Label = akRw.Label ?? nRw.Label; akRw = nRw; retVal.AWLCode.RemoveAt(akRowInAwlCode + 1); } } if (!newAwlCode.Contains(akRw)) newAwlCode.Add(akRw); } akRowInAwlCode++; } ((S7FunctionBlockRow)retVal.AWLCode[akRowInAwlCode]).NetworkName = tx1; ((S7FunctionBlockRow)retVal.AWLCode[akRowInAwlCode]).Comment = tx2; newAwlCode.Add(retVal.AWLCode[akRowInAwlCode]); } akRowInAwlCode++; lineNumberInCall = 0; } else { S7FunctionBlockRow lastRow = null; //Anzahl der Anweisungen vor diesem Kommentar (inklusive aktueller Zeile!) for (int q = 0; q < (anzUebsprungZeilen); q++) { if (retVal.AWLCode.Count > akRowInAwlCode) { S7FunctionBlockRow akRw = (S7FunctionBlockRow) retVal.AWLCode[akRowInAwlCode]; if (cmt[n + 4] == 0xc0 && q == anzUebsprungZeilen-1) akRw.CombineDBAccess = false; //Db Zugriff zusammenfügen... if (akRw.CombineDBAccess) { S7FunctionBlockRow nRw = (S7FunctionBlockRow) retVal.AWLCode[akRowInAwlCode + 1]; nRw.Parameter = akRw.Parameter + "." + nRw.Parameter; nRw.MC7 = Helper.CombineByteArray(akRw.MC7, nRw.MC7); nRw.Label = akRw.Label ?? nRw.Label; akRw = nRw; retVal.AWLCode.RemoveAt(akRowInAwlCode + 1); } if (!newAwlCode.Contains(akRw)) newAwlCode.Add(akRw); if (akRw.GetNumberOfLines() == 1) { lineNumberInCall = 0; lastRow = akRw; //if (!newAwlCode.Contains(akRw)) // newAwlCode.Add(akRw); akRowInAwlCode++; } else { lastRow = akRw; if (lineNumberInCall == 0 && !(cmt[n + 4] != 0x80 && cmt[n + 4] != 0xc0)) { //if (!newAwlCode.Contains(akRw)) // newAwlCode.Add(akRw); } if (akRw.GetNumberOfLines() - 1 == lineNumberInCall) { akRowInAwlCode++; lineNumberInCall = 0; //subCnt++; //The set to zero was wrong here, but maybe now comments on calls do not work, need to check! } else { lineNumberInCall++; } } } } //if (lastRow == null || cmt[n + 4] != 0x80) if (lastRow == null || (cmt[n + 4] != 0x80 && cmt[n + 4] != 0xc0)) { lastRow = new S7FunctionBlockRow(){ Parent = retVal }; newAwlCode.Add(lastRow); lineNumberInCall = 0; } string tx1 = Project.ProjectEncoding.GetString(cmt, n + 6, kommLen); if (lineNumberInCall == 0) lastRow.Comment = tx1; else if (lastRow.Command == "CALL") if (lineNumberInCall == 1) lastRow.Comment = tx1; else { if (lastRow.CallParameter.Count >= lineNumberInCall - 2) { lastRow.CallParameter[lineNumberInCall - 2].Comment = tx1; } } n += kommLen + 6; //subCnt = 0; } } } while (akRowInAwlCode < retVal.AWLCode.Count) { newAwlCode.Add(retVal.AWLCode[akRowInAwlCode]); akRowInAwlCode++; } retVal.AWLCode = newAwlCode; } #endregion } retVal.Networks = NetWork.GetNetworksList(retVal); retVal.ParentFolder = this; retVal.usedS7ConvertingOptions = myConvOpt; blkInfo._Block = retVal; return retVal; } } return null; }
public static void ConvertLocaldataToSymbols(S7FunctionBlock myFct, S7ConvertingOptions myOpt) { if (myOpt.ReplaceLokalDataAddressesWithSymbolNames) { List<DataBlockRow> rows = null; Dictionary<String, String> parLst = new Dictionary<string, string>(); if (myFct.Parameter != null && myFct.Parameter.Children!=null) foreach (var plcDataRow in myFct.Parameter.Children) { if (plcDataRow.Name == "TEMP") { TiaAndSTep7DataBlockRow tmpRw = ((TiaAndSTep7DataBlockRow)plcDataRow)._GetExpandedChlidren(new S7DataBlockExpandOptions() { ExpandCharArrays = true, ExpandSubChildInINOUT = false })[0]; rows = DataBlockRow.GetChildrowsAsList(tmpRw); break; } } if (rows != null) { foreach (var plcDataRow in rows) { if (plcDataRow.DataType != S7DataRowType.STRUCT && plcDataRow.DataType != S7DataRowType.UDT && plcDataRow.DataType != S7DataRowType.FB) parLst.Add("P#L" + plcDataRow.BlockAddress.ToString(), "P##" + plcDataRow.StructuredName); string tmp = ((S7DataRow)plcDataRow).GetSymbolicAddress(); if (tmp != null) { parLst.Add("L" + tmp.Replace("X", ""), "#" + plcDataRow.StructuredName); } } } foreach (S7FunctionBlockRow plcFunctionBlockRow in myFct.AWLCode) { if (!plcFunctionBlockRow.Parameter.Contains("'") && !plcFunctionBlockRow.Parameter.Contains("[AR") && plcFunctionBlockRow.Parameter.Contains("[")) { int pos1 = plcFunctionBlockRow.Parameter.IndexOf("[")+1; int pos2 = plcFunctionBlockRow.Parameter.IndexOf("]"); string par = plcFunctionBlockRow.Parameter.Substring(pos1, pos2 - pos1); if (parLst.ContainsKey(par)) { byte[] tmp = plcFunctionBlockRow.MC7; plcFunctionBlockRow.Parameter = plcFunctionBlockRow.Parameter.Substring(0, pos1) + parLst[par] + "]"; plcFunctionBlockRow.MC7 = tmp; } } else { string par = plcFunctionBlockRow.Parameter.Replace(" ", ""); if (parLst.ContainsKey(par)) { byte[] tmp = plcFunctionBlockRow.MC7; plcFunctionBlockRow.Parameter = ""; plcFunctionBlockRow.Parameter = parLst[par]; plcFunctionBlockRow.MC7 = tmp; } } } } }
private string CreateHirachy(string prefix, S7FunctionBlock block, Stack<string> parentBlocks) { string spacer = " | "; parentBlocks.Push(block.BlockName); string retVal = ""; if (prefix != "") retVal += prefix.Substring(0, prefix.Length - 3) + "---" + block.BlockName + Environment.NewLine; else retVal += block.BlockName + Environment.NewLine; //foreach (var calledBlock in block.CalledBlocks) foreach (var calledBlock in block.CalledBlocks.Distinct()) { var fld = block.ParentFolder as BlocksOfflineFolder; var blk = fld.GetBlock(calledBlock) as S7FunctionBlock; if (blk != null) { if (!parentBlocks.Contains(blk.BlockName)) { retVal += CreateHirachy(prefix + spacer, blk, parentBlocks); } else { retVal += prefix + spacer.Substring(0,3) + "---" + blk.BlockName + " (recursive)" + Environment.NewLine; } } } parentBlocks.Pop(); return retVal; }
private string CreateHirachy(string prefix, S7FunctionBlock block) { string retVal = ""; retVal += prefix + block.BlockName + Environment.NewLine; //foreach (var calledBlock in block.CalledBlocks) foreach (var calledBlock in block.CalledBlocks.Distinct()) { var fld = block.ParentFolder as BlocksOfflineFolder; var blk = fld.GetBlock(calledBlock) as S7FunctionBlock; if (blk != null) retVal += CreateHirachy(prefix + " |---", blk); } return retVal; }
public static void ReplaceStaticAccess(S7FunctionBlock myFct, S7ProgrammFolder myFld, S7ConvertingOptions myOpt) { if (myOpt.ReplaceDIAccessesWithSymbolNames && myFct.BlockType==PLCBlockType.FB) { List<FunctionBlockRow> retVal = new List<FunctionBlockRow>(); List<FunctionBlockRow> tempList = new List<FunctionBlockRow>(); bool LargeAccess = false; int add_adresse = 0; foreach (var functionBlockRow in myFct.AWLCode) { if (functionBlockRow.Command == "TAR2") { tempList.Add(functionBlockRow); LargeAccess = true; } else if (functionBlockRow.Command == "+AR2" && LargeAccess) { tempList.Add(functionBlockRow); add_adresse += Convert.ToInt32(Convert.ToDouble(((S7FunctionBlockRow) functionBlockRow).Parameter.Substring(2), new NumberFormatInfo() {NumberDecimalSeparator = "."})); } else if (((S7FunctionBlockRow)functionBlockRow).Parameter.Contains("[AR2,P#") && ((S7FunctionBlockRow)functionBlockRow).Parameter.Substring(0, 2) == "DI" && !LargeAccess) { string para = ((S7FunctionBlockRow) functionBlockRow).Parameter; ByteBitAddress adr = new ByteBitAddress(para.Substring(10, para.Length - 11)); var parRow = S7DataRow.GetDataRowWithAddress(myFct.Parameter, adr); if (parRow!=null) { byte[] tmp = ((S7FunctionBlockRow) functionBlockRow).MC7; ((S7FunctionBlockRow) functionBlockRow).Parameter = "#" + parRow.StructuredName.Substring(parRow.StructuredName.IndexOf('.') + 1); ((S7FunctionBlockRow) functionBlockRow).MC7 = tmp; } retVal.Add(functionBlockRow); } else if (((S7FunctionBlockRow)functionBlockRow).Parameter.Contains("[AR2,P#") && ((S7FunctionBlockRow)functionBlockRow).Parameter.Substring(0, 2) == "DI" && LargeAccess) { /* string para = ((S7FunctionBlockRow)functionBlockRow).Parameter; ByteBitAddress adr = new ByteBitAddress(para.Substring(10, para.Length - 11)); adr.ByteAddress += add_adresse; var parRow = S7DataRow.GetDataRowWithAddress(myFct.Parameter, adr); if (parRow != null) { byte[] tmp = ((S7FunctionBlockRow)functionBlockRow).MC7; ((S7FunctionBlockRow)functionBlockRow).Parameter = "#" + parRow.StructuredName; ((S7FunctionBlockRow)functionBlockRow).MC7 = tmp; } retVal.Add(functionBlockRow); * */ } else if (functionBlockRow.Command=="LAR2") { } else { LargeAccess = false; retVal.AddRange(tempList); tempList.Clear(); retVal.Add(functionBlockRow); } } myFct.AWLCode = retVal; } }
//In this Class a UC is converted to a Call and also backwards... public static void ConvertUCToCall(S7FunctionBlock myFct, S7ProgrammFolder myFld, BlocksOfflineFolder myblkFld, S7ConvertingOptions myOpt, byte[] addInfoFromBlock) { if (myOpt.GenerateCallsfromUCs) { int inBld = 0; //1=nach BLD 1 S7FunctionBlockRow newRow = null; Dictionary<string, string> Parameters = new Dictionary<string, string>(); List<FunctionBlockRow> retVal = new List<FunctionBlockRow>(); List<FunctionBlockRow> tempList = new List<FunctionBlockRow>(); string registerDi = "DI"; string registerDb = ""; string registerAkku1 = ""; string registerAkku2 = ""; string registerAR1 = ""; string registerAR2 = ""; string diName = ""; string akPar = ""; string db = ""; string label = ""; string akku = ""; bool afterCall = false; bool multiInstance = false; int multiInstanceOffset = 0; Pointer ar2Addr = new Pointer(0,0); S7FunctionBlockRow callRow = null; for (int n = 0; n < myFct.AWLCode.Count; n++) { S7FunctionBlockRow row = (S7FunctionBlockRow)myFct.AWLCode[n]; if (row.Command == Mnemonic.opBLD[(int)myOpt.Mnemonic] && (row.Parameter == "1" || row.Parameter == "7" || row.Parameter == "3" || row.Parameter == "16" || row.Parameter == "14") && inBld == 0) { retVal.AddRange(tempList); tempList.Clear(); Parameters.Clear(); db = ""; label = row.Label; inBld = Convert.ToInt32(row.Parameter); newRow = null; afterCall = false; callRow = null; diName = ""; multiInstance = false; multiInstanceOffset = 0; ar2Addr = new Pointer(0, 0); tempList.Add(row); } else if (inBld == 1 || inBld == 7) { #region FC Aufruf tempList.Add(row); if (row.Command == "=" && n > 0 && myFct.AWLCode[n - 1].Command == Mnemonic.opBLD[(int)myOpt.Mnemonic]) { //Do nothing, but this line needs to be there! } else if (row.Command == Mnemonic.opU[(int)myOpt.Mnemonic] || row.Command == Mnemonic.opUN[(int)myOpt.Mnemonic] || row.Command == Mnemonic.opO[(int)myOpt.Mnemonic] || row.Command == Mnemonic.opON[(int)myOpt.Mnemonic] || row.Command == Mnemonic.opO[(int)myOpt.Mnemonic] || row.Command == Mnemonic.opON[(int)myOpt.Mnemonic] || row.Command == Mnemonic.opX[(int)myOpt.Mnemonic] || row.Command == Mnemonic.opXN[(int)myOpt.Mnemonic] || row.Command == Mnemonic.opL[(int)myOpt.Mnemonic]) { akPar = row.Parameter; } else if (row.Command == Mnemonic.opAUF[(int)myOpt.Mnemonic]) { db = row.Parameter + "."; } else if (row.Command == Mnemonic.opCLR[(int)myOpt.Mnemonic]) { akPar = "FALSE"; } else if (row.Command == Mnemonic.opSET[(int)myOpt.Mnemonic] ) { akPar = "TRUE"; } else if (row.Command == Mnemonic.opTAR2[(int)myOpt.Mnemonic]) { //look what we need to do here!!! } else if (row.Command == Mnemonic.opPAR2[(int)myOpt.Mnemonic]) { //look what we need to do here!!! } else if (row.Command == Mnemonic.opLAR2[(int)myOpt.Mnemonic]) { //look what we need to do here!!! } else if (row.Command == Mnemonic.opLAR1[(int)myOpt.Mnemonic]) { //look what we need to do here!!! } else if ((row.Command == "=") && akPar != "") { if (afterCall == false) { string key = row.Parameter.Replace("L", "").Replace("W", "").Replace("B", "").Replace("D", ""); if (!Parameters.ContainsKey(key)) Parameters.Add("P#V " + key, db + akPar); } else { string key = akPar.Replace("L", "").Replace("W", "").Replace("B", "").Replace("D", ""); if (!Parameters.ContainsKey(key)) Parameters.Add("P#V " + key, db + row.Parameter); } akPar = ""; db = ""; } else if (row.Command == Mnemonic.opT[(int)myOpt.Mnemonic] && akPar != "") { if (afterCall == false) { string key = row.Parameter.Replace("L", "").Replace("W", "").Replace("B", "").Replace("D", ""); if (!Parameters.ContainsKey(key)) Parameters.Add("P#V " + key + ".0", db + akPar); } else { string key = akPar.Replace("L", "").Replace("W", "").Replace("B", "").Replace("D", ""); if (!Parameters.ContainsKey("P#V " + key)) Parameters.Add("P#V " + key, db + row.Parameter); } akPar = ""; db = ""; } else if (row.Command == Mnemonic.opT[(int)myOpt.Mnemonic] && akPar == "") { //look what we need to do here!!! } else if (row.Command == Mnemonic.opUC[(int)myOpt.Mnemonic]) { //Commands after a Call --> Out-Para callRow = row; afterCall = true; } else if (row.Command == Mnemonic.opBLD[(int)myOpt.Mnemonic] && (row.Parameter == "2" || row.Parameter == "8")) { //Block Interface auslesen (von FC oder vom Programm) S7DataRow para = myblkFld.GetInterface(callRow.Parameter); newRow = new S7FunctionBlockRow(); newRow.Command = Mnemonic.opCALL[(int)myOpt.Mnemonic]; newRow.Parent = callRow.Parent; newRow.Parameter = callRow.Parameter; newRow.CallParameter = new List<S7FunctionBlockParameter>(); for (int i = 0; i < callRow.ExtParameter.Count; i++) { string s = callRow.ExtParameter[i]; string parnm = ""; S7DataRow akRow = Parameter.GetFunctionParameterFromNumber(para, i); if (akRow != null) parnm = akRow.Name + ""; else parnm = "$$undef"; S7FunctionBlockParameter newPar = new S7FunctionBlockParameter(newRow); newPar.Name = parnm; if (akRow != null) { newPar.ParameterDataType = akRow.DataType; if (akRow.Parent.Name == "OUT") newPar.ParameterType = S7FunctionBlockParameterDirection.OUT; else if (akRow.Parent.Name == "IN_OUT") newPar.ParameterType = S7FunctionBlockParameterDirection.IN_OUT; else newPar.ParameterType = S7FunctionBlockParameterDirection.IN; } if (akRow != null) { int posL = s.IndexOf(' '); int ak_address = 0; if (posL >= 0) ak_address = Convert.ToInt32(s.Substring(posL + 1).Split('.')[0]); else { ak_address = Convert.ToInt32(s.Substring(2).Split('.')[0])*8 + Convert.ToInt32(s.Substring(2).Split('.')[1]); } int lokaldata_address = -1; if (s.Substring(0, 3) == "P#V") lokaldata_address = Convert.ToInt32(s.Substring(4).Split('.')[0]); if (akRow.DataType == S7DataRowType.STRING || akRow.DataType == S7DataRowType.DATE_AND_TIME || akRow.DataType == S7DataRowType.STRUCT || akRow.DataType == S7DataRowType.UDT || akRow.DataType == S7DataRowType.POINTER || akRow.IsArray) { string p1 = ""; string p2 = ""; Parameters.TryGetValue("P#V " + (lokaldata_address + 0).ToString() + ".0", out p1); Parameters.TryGetValue("P#V " + (lokaldata_address + 2).ToString() + ".0", out p2); string tmp = ""; if (p1 != "" && p1 != "0") tmp += "P#DB" + p1 + "." + (p2 == null ? "0" : p2.Substring(2)); else tmp += p2; newPar.Value = tmp; newRow.CallParameter.Add(newPar); } else if (akRow.DataType == S7DataRowType.ANY) { string tmp = s; if (Parameters.ContainsKey("P#V " + (lokaldata_address + 0).ToString() + ".0") && Parameters.ContainsKey("P#V " + (lokaldata_address + 2).ToString() + ".0") && Parameters.ContainsKey("P#V " + (lokaldata_address + 4).ToString() + ".0") && Parameters.ContainsKey("P#V " + (lokaldata_address + 6).ToString() + ".0")) { string p1 = Parameters["P#V " + (lokaldata_address + 0).ToString() + ".0"]; string p2 = Parameters["P#V " + (lokaldata_address + 2).ToString() + ".0"]; string p3 = Parameters["P#V " + (lokaldata_address + 4).ToString() + ".0"]; string p4 = Parameters["P#V " + (lokaldata_address + 6).ToString() + ".0"]; tmp = "P#"; if (p3 != "0") tmp += "DB" + p3 + "."; tmp += p4.Substring(2); tmp += " BYTE "; //Todo Parse Byte 1 if the Type is Byte! tmp += p2; } newPar.Value = tmp; newRow.CallParameter.Add(newPar); } else { if (Parameters.ContainsKey(s)) { string par = Parameters[s]; if (akRow.DataType == S7DataRowType.S5TIME && par[0] >= '0' && par[0] <= '9') { newPar.Value = Helper.GetS5Time( BitConverter.GetBytes(Convert.ToInt32(par))[1], BitConverter.GetBytes(Convert.ToInt32(par))[0]); } else if (akRow.DataType == S7DataRowType.TIME && par[0] >= '0' && par[0] <= '9') { newPar.Value = Helper.GetDTime(BitConverter.GetBytes(Convert.ToInt32(par)),0); } else if (akRow.DataType == S7DataRowType.CHAR && par[0] == 'B') { newPar.Value = (char) Int32.Parse(par.Substring(5), System.Globalization.NumberStyles.AllowHexSpecifier) + "'"; } else { newPar.Value = Parameters[s]; } } else { if (akRow.DataType == S7DataRowType.BOOL) { newPar.Value = s.Substring(2).Replace('V', 'L'); } else if (akRow.DataType == S7DataRowType.BLOCK_DB) { newPar.Value = "DB" + ak_address.ToString(); } else if (akRow.DataType == S7DataRowType.BLOCK_FB) { newPar.Value = "FB" + ak_address.ToString(); } else if (akRow.DataType == S7DataRowType.BLOCK_FC) { newPar.Value = "FC" + ak_address.ToString(); } else if (akRow.DataType == S7DataRowType.BLOCK_SDB) { newPar.Value = "SDB" + ak_address.ToString(); } else if (akRow.DataType == S7DataRowType.TIMER) { newPar.Value = Mnemonic.adT[(int)myOpt.Mnemonic] + ak_address.ToString(); } else if (akRow.DataType == S7DataRowType.COUNTER) { newPar.Value = Mnemonic.adZ[(int)myOpt.Mnemonic] + ak_address.ToString(); } else { string ber = ""; if (s.Substring(0, 5) == "P#DBX") ber = "DB"; else if (s.Substring(0, 5) == "P#DIX") ber = "DI"; else ber = s.Substring(2, 1); if (akRow.ByteLength == 1) ber += "B"; else if (akRow.ByteLength == 2) ber += "W"; else if (akRow.ByteLength == 4) ber += "D"; newPar.Value = ber.Replace('V', 'L') + ak_address.ToString(); } } newRow.CallParameter.Add(newPar); } } } newRow.CombinedCommands = tempList; newRow.Label = label; int sz = 0; foreach (var functionBlockRow in newRow.CombinedCommands) { sz += ((S7FunctionBlockRow) functionBlockRow).ByteSize; } byte[] mcges=new byte[sz]; sz = 0; foreach (var functionBlockRow in newRow.CombinedCommands) { Array.Copy(((S7FunctionBlockRow) functionBlockRow).MC7, 0, mcges, sz, ((S7FunctionBlockRow) functionBlockRow).ByteSize); sz += ((S7FunctionBlockRow)functionBlockRow).ByteSize; } newRow.MC7 = mcges; retVal.Add(newRow); Parameters.Clear(); tempList = new List<FunctionBlockRow>(); inBld = 0; newRow = null; } else { retVal.AddRange(tempList); tempList.Clear(); inBld = 0; } #endregion } else if (inBld == 3 || inBld == 16 || inBld == 14) { #region FB Aufruf tempList.Add(row); if (row.Command == "=" && n > 0 && myFct.AWLCode[n - 1].Command == Mnemonic.opBLD[(int)myOpt.Mnemonic]) { //Do nothing, but this line needs to be there! } else if (row.Command == Mnemonic.opTDB[(int)myOpt.Mnemonic]) { //Do nothing, but this line needs to be there! } else if (row.Command == Mnemonic.opBLD[(int)myOpt.Mnemonic] && row.Parameter=="11") { //whatever this BLD 11 in the FB Calls means... } else if (row.Command == Mnemonic.opTAR2[(int)myOpt.Mnemonic]) { if (ar2Addr.MemoryArea==MemoryArea.None) akPar = "P#DIX " + ar2Addr.ToString(); else akPar = ar2Addr.ToString(myOpt.Mnemonic); } else if (row.Command == Mnemonic.opLAR2[(int)myOpt.Mnemonic]) { if (row.Parameter.StartsWith("P#")) { ar2Addr = new Pointer(row.Parameter.Substring(2)); } else { ar2Addr.ByteAddress = 0; ar2Addr.BitAddress = 0; } } else if (row.Command == Mnemonic.opPAR2[(int)myOpt.Mnemonic]) { ar2Addr += new Pointer(row.Parameter); } else if (row.Command == Mnemonic.opAUF[(int)myOpt.Mnemonic] && (tempList.Count == 4)) { diName = row.Parameter; } else if (row.Command == Mnemonic.opAUF[(int)myOpt.Mnemonic] && row.Parameter.Contains("[") && (tempList.Count == 6)) { multiInstance = true; diName = ""; } else if (row.Command == Mnemonic.opU[(int)myOpt.Mnemonic] || row.Command == Mnemonic.opUN[(int)myOpt.Mnemonic] || row.Command == Mnemonic.opO[(int)myOpt.Mnemonic] || row.Command == Mnemonic.opON[(int)myOpt.Mnemonic] || row.Command == Mnemonic.opO[(int)myOpt.Mnemonic] || row.Command == Mnemonic.opON[(int)myOpt.Mnemonic] || row.Command == Mnemonic.opX[(int)myOpt.Mnemonic] || row.Command == Mnemonic.opXN[(int)myOpt.Mnemonic] || row.Command == Mnemonic.opL[(int)myOpt.Mnemonic]) { akPar = db + row.Parameter; db = ""; } else if (row.Command == Mnemonic.opAUF[(int)myOpt.Mnemonic]) { db = row.Parameter + "."; } else if (row.Command == "CLR") { akPar = "FALSE"; } else if (row.Command == "SET") { akPar = "TRUE"; } else if ((row.Command == "=") && akPar != "") { if (afterCall == false) { if (!Parameters.ContainsKey(row.Parameter)) Parameters.Add(row.Parameter, akPar); } else { if (!Parameters.ContainsKey(akPar)) Parameters.Add(akPar, row.Parameter); } akPar = ""; db = ""; } else if (row.Command == Mnemonic.opT[(int)myOpt.Mnemonic] && akPar != "") { if (afterCall == false) { if (!Parameters.ContainsKey(row.Parameter)) Parameters.Add(row.Parameter, akPar); } else { if (!Parameters.ContainsKey(akPar)) Parameters.Add(akPar, row.Parameter); } akPar = ""; db = ""; } else if (row.Command == Mnemonic.opT[(int)myOpt.Mnemonic]) { if (afterCall == false) { if (!Parameters.ContainsKey(row.Parameter)) Parameters.Add(row.Parameter, ""); } akPar = ""; db = ""; } else if (row.Command == Mnemonic.opUC[(int)myOpt.Mnemonic]) { multiInstanceOffset = 0; for (int j = tempList.Count - 2; j > -1; j--) { if (tempList[j].Command == Mnemonic.opPAR2[(int)myOpt.Mnemonic]) multiInstanceOffset += (int)double.Parse((((S7FunctionBlockRow)tempList[j]).Parameter.Substring(2)), CultureInfo.InvariantCulture); break; } //Commands after a Call --> Out-Para callRow = row; afterCall = true; } else if (row.Command == Mnemonic.opBLD[(int)myOpt.Mnemonic] && (row.Parameter == "4" || row.Parameter == "17" || row.Parameter == "15")) { //Block Interface auslesen (von FC oder vom Programm) S7DataRow para = myblkFld.GetInterface(callRow.Parameter); newRow = new S7FunctionBlockRow(); newRow.Parent = callRow.Parent; newRow.Command = Mnemonic.opCALL[(int)myOpt.Mnemonic]; newRow.Parameter = callRow.Parameter; if (diName.Length > 2 && !diName.StartsWith("#")) newRow.DiName = "DI" + int.Parse(diName.Substring(2)); else if (diName.StartsWith("#")) newRow.DiName = diName; newRow.CallParameter = new List<S7FunctionBlockParameter>(); if (para != null) { var allPar = para.Children.Where(itm => itm.Name == "IN" || itm.Name == "IN_OUT" || itm.Name == "OUT"); foreach (var s7DataRowMain in allPar) { foreach (var s7DataRow in s7DataRowMain.Children) { S7FunctionBlockParameter newPar = new S7FunctionBlockParameter(newRow); newPar.Name = s7DataRow.Name; string par = null; if (!multiInstance) Parameters.TryGetValue(((S7DataRow)s7DataRow).BlockAddressInDbFormat.Replace("DB", "DI"), out par); else if (((S7DataRow)s7DataRow).DataType == S7DataRowType.ANY) { var anySizeAddr = ((S7DataRow)s7DataRow).BlockAddress.ByteAddress + multiInstanceOffset + 2; var anyPosAddr = ((S7DataRow)s7DataRow).BlockAddress.ByteAddress + multiInstanceOffset + 6; string anySize = ""; string anyPos = ""; Parameters.TryGetValue("DIW[AR2,P#" + anySizeAddr + ".0]", out anySize); Parameters.TryGetValue("DID[AR2,P#" + anyPosAddr + ".0]", out anyPos); par = anyPos + " BYTE " + anySize; } else { var addr = ((S7DataRow)s7DataRow).BlockAddressInDbFormat; if (!string.IsNullOrEmpty(addr)) { var addrTp = addr.Substring(0, 3).Replace("DB", "DI"); double bytepos = double.Parse(addr.Substring(3), CultureInfo.InvariantCulture) + multiInstanceOffset; Parameters.TryGetValue(addrTp + "[AR2,P#" + bytepos.ToString("0.0", CultureInfo.InvariantCulture) + "]", out par); } } if (par != null && par.Contains("[AR2")) { newPar.Value = par; var addr = par.Substring(10); addr = addr.Substring(0, addr.Length - 1); var pRow = S7DataRow.GetDataRowWithAddress(myFct.Parameter.Children.Where(itm => itm.Name != "TEMP").Cast<S7DataRow>(), new ByteBitAddress(addr)); if (pRow != null) newPar.Value = ((S7DataRow)pRow).StructuredName.Substring(((S7DataRow)pRow).StructuredName.IndexOf('.') + 1); } else { switch (((S7DataRow)s7DataRow).DataType) { case S7DataRowType.BLOCK_DB: newPar.Value = "DB" + par; break; case S7DataRowType.BLOCK_FC: newPar.Value = "FC" + par; break; case S7DataRowType.BLOCK_FB: newPar.Value = "FB" + par; break; case S7DataRowType.TIMER: newPar.Value = Mnemonic.adT[(int)myOpt.Mnemonic] + par.ToString(); break; case S7DataRowType.COUNTER: newPar.Value = Mnemonic.adZ[(int)myOpt.Mnemonic] + par.ToString(); break; case S7DataRowType.TIME: if (par != null && par.StartsWith("L#")) { var arr = BitConverter.GetBytes(Convert.ToInt32(par.Substring(2))); Array.Reverse(arr); newPar.Value = Helper.GetDTime(arr, 0); } else { newPar.Value = par; } break; default: newPar.Value = par; break; } } newRow.CallParameter.Add(newPar); } } } newRow.CombinedCommands = tempList; newRow.Label = label; int sz = 0; foreach (var functionBlockRow in newRow.CombinedCommands) { sz += ((S7FunctionBlockRow)functionBlockRow).ByteSize; } byte[] mcges = new byte[sz]; sz = 0; foreach (var functionBlockRow in newRow.CombinedCommands) { Array.Copy(((S7FunctionBlockRow)functionBlockRow).MC7, 0, mcges, sz, ((S7FunctionBlockRow)functionBlockRow).ByteSize); sz += ((S7FunctionBlockRow)functionBlockRow).ByteSize; } newRow.MC7 = mcges; retVal.Add(newRow); Parameters.Clear(); tempList = new List<FunctionBlockRow>(); inBld = 0; newRow = null; } else { retVal.AddRange(tempList); tempList.Clear(); inBld = 0; } #endregion } else { retVal.Add(row); } } myFct.AWLCode = retVal; } }
//In this Class a UC is converted to a Call and also backwards... public static void ConvertUCToCall(S7FunctionBlock myFct, S7ProgrammFolder myFld, BlocksOfflineFolder myblkFld, S7ConvertingOptions myOpt, byte[] addInfoFromBlock) { if (myOpt.GenerateCallsfromUCs) { int inBld = 0; //1=nach BLD 1 S7FunctionBlockRow newRow = null; Dictionary<string, string> Parameters = new Dictionary<string, string>(); List<FunctionBlockRow> retVal = new List<FunctionBlockRow>(); List<FunctionBlockRow> tempList = new List<FunctionBlockRow>(); string akPar = ""; string db = ""; string label = ""; bool afterCall = false; S7FunctionBlockRow callRow = null; for (int n = 0; n < myFct.AWLCode.Count; n++) { S7FunctionBlockRow row = (S7FunctionBlockRow)myFct.AWLCode[n]; if (row.Command == Mnemonic.opBLD[(int)myOpt.Mnemonic] && ( row.Parameter == "1" || row.Parameter == "7") && inBld==0) { retVal.AddRange(tempList); tempList.Clear(); Parameters.Clear(); db = ""; label = row.Label; inBld = Convert.ToInt32(row.Parameter); newRow = null; afterCall = false; callRow = null; tempList.Add(row); } else if (inBld > 0) { tempList.Add(row); if (row.Command == "=" && n > 0 && myFct.AWLCode[n - 1].Command == Mnemonic.opBLD[(int)myOpt.Mnemonic]) { //Do nothing, but this line needs to be there! } else if (row.Command == Mnemonic.opU[(int)myOpt.Mnemonic] || row.Command == Mnemonic.opUN[(int)myOpt.Mnemonic] || row.Command == Mnemonic.opO[(int)myOpt.Mnemonic] || row.Command == Mnemonic.opON[(int)myOpt.Mnemonic] || row.Command == Mnemonic.opO[(int)myOpt.Mnemonic] || row.Command == Mnemonic.opON[(int)myOpt.Mnemonic] || row.Command == Mnemonic.opX[(int)myOpt.Mnemonic] || row.Command == Mnemonic.opXN[(int)myOpt.Mnemonic] || row.Command == Mnemonic.opL[(int)myOpt.Mnemonic]) { akPar = row.Parameter; } else if (row.Command == "AUF") { db = row.Parameter + "."; } else if (row.Command == "CLR") { akPar = "FALSE"; } else if (row.Command == "SET") { akPar = "TRUE"; } else if ((row.Command == "=") && akPar != "") { if (afterCall == false) { string key = row.Parameter.Replace("L", "").Replace("W", "").Replace("B", "").Replace("D", ""); if (!Parameters.ContainsKey(key)) Parameters.Add("P#V " + key, db + akPar); } else { string key = akPar.Replace("L", "").Replace("W", "").Replace("B", "").Replace("D", ""); if (!Parameters.ContainsKey(key)) Parameters.Add("P#V " + key, db + row.Parameter); } akPar = ""; db = ""; } else if (row.Command == Mnemonic.opT[(int)myOpt.Mnemonic] && akPar != "") { if (afterCall == false) { string key = row.Parameter.Replace("L", "").Replace("W", "").Replace("B", "").Replace("D", ""); if (!Parameters.ContainsKey(key)) Parameters.Add("P#V " + key + ".0", db + akPar); } else { string key = akPar.Replace("L", "").Replace("W", "").Replace("B", "").Replace("D", ""); if (!Parameters.ContainsKey(key)) Parameters.Add("P#V " + key, db + row.Parameter); } akPar = ""; db = ""; } else if (row.Command == Mnemonic.opUC[(int)myOpt.Mnemonic]) { //Commands after a Call --> Out-Para callRow = row; afterCall = true; } else if (row.Command == Mnemonic.opBLD[(int)myOpt.Mnemonic] && (row.Parameter == "2" || row.Parameter == "8")) { //Block Interface auslesen (von FC oder vom Programm) //myFld.BlocksOfflineFolder.GetBlock() S7DataRow para = myblkFld.GetInterface(callRow.Parameter); newRow = new S7FunctionBlockRow(); newRow.Command = Mnemonic.opCALL[(int)myOpt.Mnemonic]; newRow.Parameter = callRow.Parameter; //newRow.ExtParameter = new List<string>(); newRow.CallParameter=new List<S7FunctionBlockParameter>(); for (int i = 0; i < callRow.ExtParameter.Count; i++) { string s = callRow.ExtParameter[i]; string parnm = ""; S7DataRow akRow = Parameter.GetFunctionParameterFromNumber(para, i); if (akRow != null) parnm = akRow.Name + ""; else parnm = "$$undef"; S7FunctionBlockParameter newPar = new S7FunctionBlockParameter(); newPar.Name = parnm; if (akRow != null) { newPar.ParameterDataType = akRow.DataType; if (akRow.Parent.Name == "OUT") newPar.ParameterType = S7FunctionBlockParameterDirection.OUT; else if (akRow.Parent.Name == "IN_OUT") newPar.ParameterType = S7FunctionBlockParameterDirection.IN_OUT; else newPar.ParameterType = S7FunctionBlockParameterDirection.IN; //newPar.ParameterType } if (akRow != null) { int posL = s.IndexOf(' '); int ak_address = 0; if (posL >= 0) ak_address = Convert.ToInt32(s.Substring(posL + 1).Split('.')[0]); else { ak_address = Convert.ToInt32(s.Substring(2).Split('.')[0])*8 + Convert.ToInt32(s.Substring(2).Split('.')[1]); } int lokaldata_address = -1; if (s.Substring(0, 3) == "P#V") lokaldata_address = Convert.ToInt32(s.Substring(4).Split('.')[0]); if (akRow.DataType == S7DataRowType.STRING || akRow.DataType == S7DataRowType.DATE_AND_TIME || akRow.DataType == S7DataRowType.STRUCT || akRow.DataType == S7DataRowType.UDT || akRow.DataType == S7DataRowType.POINTER || akRow.IsArray) { string p1 = Parameters["P#V " + (lokaldata_address + 0).ToString() + ".0"]; string p2 = Parameters["P#V " + (lokaldata_address + 2).ToString() + ".0"]; string tmp = ""; if (p1 != "" && p1 != "0") tmp += "P#DB" + p1 + "." + p2.Substring(2); else tmp += p2; newPar.Value = tmp; newRow.CallParameter.Add(newPar); //newRow.ExtParameter.Add(parnm + tmp); } else if (akRow.DataType == S7DataRowType.ANY) { string tmp = s; if (Parameters.ContainsKey("P#V " + (lokaldata_address + 0).ToString() + ".0") && Parameters.ContainsKey("P#V " + (lokaldata_address + 2).ToString() + ".0") && Parameters.ContainsKey("P#V " + (lokaldata_address + 4).ToString() + ".0") && Parameters.ContainsKey("P#V " + (lokaldata_address + 6).ToString() + ".0")) { string p1 = Parameters["P#V " + (lokaldata_address + 0).ToString() + ".0"]; string p2 = Parameters["P#V " + (lokaldata_address + 2).ToString() + ".0"]; string p3 = Parameters["P#V " + (lokaldata_address + 4).ToString() + ".0"]; string p4 = Parameters["P#V " + (lokaldata_address + 6).ToString() + ".0"]; tmp = "P#"; if (p3 != "0") tmp += "DB" + p3 + "."; tmp += p4.Substring(2); tmp += " BYTE "; //Todo Parse Byte 1 if the Type is Byte! tmp += p2; } newPar.Value = tmp; newRow.CallParameter.Add(newPar); //newRow.ExtParameter.Add(parnm + tmp); } else { if (Parameters.ContainsKey(s)) { string par = Parameters[s]; if (akRow.DataType == S7DataRowType.S5TIME && par[0] >= '0' && par[0] <= '9') { newPar.Value = Helper.GetS5Time( BitConverter.GetBytes(Convert.ToInt32(par))[1], BitConverter.GetBytes(Convert.ToInt32(par))[0]); newRow.CallParameter.Add(newPar); //newRow.ExtParameter.Add(parnm + // Helper.GetS5Time( // BitConverter.GetBytes(Convert.ToInt32(par))[1], // BitConverter.GetBytes(Convert.ToInt32(par))[0])); } else if (akRow.DataType == S7DataRowType.TIME && par[0] >= '0' && par[0] <= '9') { newPar.Value = Helper.GetDTime(BitConverter.GetBytes(Convert.ToInt32(par)),0); newRow.CallParameter.Add(newPar); //newRow.ExtParameter.Add(parnm + // Helper.GetDTime(BitConverter.GetBytes(Convert.ToInt32(par)),0)); } else if (akRow.DataType == S7DataRowType.CHAR && par[0] == 'B') { newPar.Value = (char) Int32.Parse(par.Substring(5), System.Globalization.NumberStyles.AllowHexSpecifier) + "'"; newRow.CallParameter.Add(newPar); //newRow.ExtParameter.Add(parnm + "'" + // (char)Int32.Parse(par.Substring(5), System.Globalization.NumberStyles.AllowHexSpecifier) + "'"); } else { newPar.Value = Parameters[s]; newRow.CallParameter.Add(newPar); //newRow.ExtParameter.Add(parnm + Parameters[s]); } } else { if (akRow.DataType == S7DataRowType.BOOL) { newPar.Value = s.Substring(2).Replace('V', 'L'); newRow.CallParameter.Add(newPar); //newRow.ExtParameter.Add(parnm + s.Substring(2).Replace('V', 'L')); } else if (akRow.DataType == S7DataRowType.BLOCK_DB) { newPar.Value = "DB" + ak_address.ToString(); newRow.CallParameter.Add(newPar); //newRow.ExtParameter.Add(parnm + "DB" + ak_address.ToString()); } else if (akRow.DataType == S7DataRowType.BLOCK_FB) { newPar.Value = "FB" + ak_address.ToString(); newRow.CallParameter.Add(newPar); //newRow.ExtParameter.Add(parnm + "FB" + ak_address.ToString()); } else if (akRow.DataType == S7DataRowType.BLOCK_FC) { newPar.Value = "FC" + ak_address.ToString(); newRow.CallParameter.Add(newPar); } else if (akRow.DataType == S7DataRowType.BLOCK_SDB) { newPar.Value = "SDB" + ak_address.ToString(); newRow.CallParameter.Add(newPar); } else if (akRow.DataType == S7DataRowType.TIMER) { newPar.Value = Mnemonic.adT[(int)myOpt.Mnemonic] + ak_address.ToString(); newRow.CallParameter.Add(newPar); } else if (akRow.DataType == S7DataRowType.COUNTER) { newPar.Value = Mnemonic.adZ[(int)myOpt.Mnemonic] + ak_address.ToString(); newRow.CallParameter.Add(newPar); } else { string ber = ""; if (s.Substring(0, 5) == "P#DBX") ber = "DB"; else if (s.Substring(0, 5) == "P#DIX") ber = "DI"; else ber = s.Substring(2, 1); if (akRow.ByteLength == 1) ber += "B"; else if (akRow.ByteLength == 2) ber += "W"; else if (akRow.ByteLength == 4) ber += "D"; newPar.Value = ber.Replace('V', 'L') + ak_address.ToString(); newRow.CallParameter.Add(newPar); //newRow.ExtParameter.Add(parnm + // ber.Replace('V', 'L') + // ak_address.ToString()); } } } } } newRow.CombinedCommands = tempList; newRow.Label = label; int sz = 0; foreach (var functionBlockRow in newRow.CombinedCommands) { sz += ((S7FunctionBlockRow) functionBlockRow).ByteSize; } byte[] mcges=new byte[sz]; sz = 0; foreach (var functionBlockRow in newRow.CombinedCommands) { Array.Copy(((S7FunctionBlockRow) functionBlockRow).MC7, 0, mcges, sz, ((S7FunctionBlockRow) functionBlockRow).ByteSize); sz += ((S7FunctionBlockRow)functionBlockRow).ByteSize; } newRow.MC7 = mcges; retVal.Add(newRow); Parameters.Clear(); tempList = new List<FunctionBlockRow>(); inBld = 0; } else { retVal.AddRange(tempList); tempList.Clear(); inBld = 0; } } else { retVal.Add(row); } } myFct.AWLCode = retVal; } }
private static S7Block CreateBlock(string blockType, string blockNumber, string type) { S7Block akBlock = null; switch (blockType.ToUpper()) { case ("TYPE"): { akBlock = new S7DataBlock() { BlockType = DataTypes.PLCBlockType.UDT, BlockLanguage = PLCLanguage.DB }; } break; case ("DATA_BLOCK"): { akBlock = new S7DataBlock() { BlockType = DataTypes.PLCBlockType.DB, BlockLanguage = PLCLanguage.DB }; } break; case ("FUNCTION"): { akBlock = new S7FunctionBlock() { BlockType = DataTypes.PLCBlockType.FC, BlockLanguage = PLCLanguage.AWL }; S7DataRow parameterRoot = new S7DataRow("ROOTNODE", S7DataRowType.STRUCT, akBlock); S7DataRow parameterIN = new S7DataRow("IN", S7DataRowType.STRUCT, akBlock); S7DataRow parameterOUT = new S7DataRow("OUT", S7DataRowType.STRUCT, akBlock); S7DataRow parameterINOUT = new S7DataRow("IN_OUT", S7DataRowType.STRUCT, akBlock); S7DataRow parameterSTAT = new S7DataRow("STATIC", S7DataRowType.STRUCT, akBlock); S7DataRow parameterTEMP = new S7DataRow("TEMP", S7DataRowType.STRUCT, akBlock); parameterOUT.Add(new S7DataRow("RET_VAL", (S7DataRowType)Enum.Parse(typeof(S7DataRowType), type), akBlock)); parameterRoot.Children.Add(parameterIN); parameterRoot.Children.Add(parameterOUT); parameterRoot.Children.Add(parameterINOUT); parameterRoot.Children.Add(parameterSTAT); parameterRoot.Children.Add(parameterTEMP); } break; case ("FUNCTION_BLOCK"): { akBlock = new S7FunctionBlock() { BlockType = DataTypes.PLCBlockType.FB, BlockLanguage = PLCLanguage.AWL }; S7DataRow parameterRoot = new S7DataRow("ROOTNODE", S7DataRowType.STRUCT, akBlock); S7DataRow parameterIN = new S7DataRow("IN", S7DataRowType.STRUCT, akBlock); S7DataRow parameterOUT = new S7DataRow("OUT", S7DataRowType.STRUCT, akBlock); S7DataRow parameterINOUT = new S7DataRow("IN_OUT", S7DataRowType.STRUCT, akBlock); S7DataRow parameterTEMP = new S7DataRow("TEMP", S7DataRowType.STRUCT, akBlock); parameterRoot.Children.Add(parameterIN); parameterRoot.Children.Add(parameterOUT); parameterRoot.Children.Add(parameterINOUT); parameterRoot.Children.Add(parameterTEMP); } break; } return akBlock; }
internal static List<FunctionBlockRow> GetAWL(int Start, int Count, int MN, byte[] BD, int[] Networks, List<string> ParaList, S7ProgrammFolder prjBlkFld, S7FunctionBlock block) { var retVal = new List<FunctionBlockRow>(); //bool CombineDBOpenAndCommand = false; // true; // false; //If DB Open and Acess should be One AWL Line (like in Step 7). This should be a Parameter. int NWNr = 1; int pos = Start; int counter = 0; int oldpos = pos; while (pos <= (Start + Count) - 2) { //if (retVal.Count >103) //For Bugfixing, The Rownumber in the AWL Editor - 2 // pos=pos; if (Networks != null) NetWork.NetworkCheck(ref Networks, ref retVal, ref counter, oldpos, pos, ref NWNr); oldpos = pos; if (BD[pos] == 0x00 && BD[pos + 1] == 0x00) { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opNOP[MN], Parameter = "0" }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } else if (BD[pos] == 0x01 && BD[pos + 1] == 0x00) { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opINVI[MN] }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } else if (BD[pos] == 0x05 && BD[pos + 1] == 0x00) { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opBEB[MN] }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } else if (BD[pos] == 0x09 && BD[pos + 1] == 0x00) { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opNEGI[MN] }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } else if (BD[pos] == 0x49 && BD[pos + 1] == 0x00) { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opOW[MN] }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } else if (BD[pos] == 0x00 || BD[pos] == 0x01 || BD[pos] == 0x05 || BD[pos] == 0x09 || BD[pos] == 0x49) { string curr_op = ""; string curr_ad = ""; int HighByte = BD[pos + 1] & 0xF0; //Only Highbyte switch (BD[pos]) { case (0x00): curr_op = HighByte < 0x90 ? Mnemonic.opU[MN] : Mnemonic.opUN[MN]; break; case (0x01): curr_op = HighByte < 0x90 ? Mnemonic.opO[MN] : Mnemonic.opON[MN]; break; case (0x05): curr_op = HighByte < 0x90 ? Mnemonic.opX[MN] : Mnemonic.opXN[MN]; break; case (0x09): curr_op = HighByte < 0x90 ? Mnemonic.opS[MN] : Mnemonic.opR[MN]; break; case (0x49): curr_op = HighByte < 0x90 ? Mnemonic.opFP[MN] : Mnemonic.opFN[MN]; break; } string par = ""; byte[] DBByte = null; switch (HighByte) { case (0x10): case (0x90): curr_ad = Mnemonic.adE[MN]; break; case (0x20): case (0xA0): curr_ad = Mnemonic.adA[MN]; break; case (0x30): case (0xB0): curr_ad = Mnemonic.adM[MN]; break; case (0x40): case (0xC0): if (retVal[retVal.Count - 1].Command == Mnemonic.opAUF[MN] && !((S7FunctionBlockRow)retVal[retVal.Count - 1]).Parameter.Contains("["))// && CombineDBOpenAndCommand) { ((S7FunctionBlockRow)retVal[retVal.Count - 1]).CombineDBAccess = true; } curr_ad = Mnemonic.adDBX[MN]; break; case (0x50): case (0xD0): curr_ad = Mnemonic.adDIX[MN]; break; case (0x60): case (0xE0): curr_ad = Mnemonic.adL[MN]; break; } int LowByte = BD[pos + 1] & 0x0F; retVal.Add(new S7FunctionBlockRow() { Command = curr_op, Parameter = par + curr_ad + " " + Convert.ToString(libnodave.getU16from(BD, pos + 2)) + "." + Convert.ToString(BD[pos + 1] - HighByte) }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; if (DBByte != null) ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = Helper.CombineByteArray(DBByte, ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7); pos += 4; } else switch (BD[pos]) { case 0x00: { switch (BD[pos + 1]) { case 0x00: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opNOP[MN], Parameter = "0" }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; break; default: retVal.Add(new S7FunctionBlockRow() { Command = "errx" }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; break; } } break; case 0x02: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opL[MN], Parameter = Mnemonic.adT[MN] + Convert.ToString(BD[pos + 1]) }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x04: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opFR[MN], Parameter = Mnemonic.adT[MN] + Convert.ToString(BD[pos + 1]) }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x0A: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opL[MN], Parameter = Mnemonic.adMB[MN] + Convert.ToString(BD[pos + 1]) }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x0B: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opT[MN], Parameter = Mnemonic.adMB[MN] + Convert.ToString(BD[pos + 1]) }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x0C: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opLC[MN], Parameter = Mnemonic.adT[MN] + Convert.ToString(BD[pos + 1]) }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x10: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opBLD[MN], Parameter = Convert.ToString(BD[pos + 1]) }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x11: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opINC[MN], Parameter = Convert.ToString(BD[pos + 1]) }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x12: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opL[MN], Parameter = Mnemonic.adMW[MN] + Convert.ToString(BD[pos + 1]) }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x13: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opT[MN], Parameter = Mnemonic.adMW[MN] + Convert.ToString(BD[pos + 1]) }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x14: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opSA[MN], Parameter = Mnemonic.adT[MN] + Convert.ToString(BD[pos + 1]) }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x19: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opDEC[MN], Parameter = Convert.ToString(BD[pos + 1]) }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x1A: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opL[MN], Parameter = Mnemonic.adMD[MN] + Convert.ToString(BD[pos + 1]) }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x1b: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opT[MN], Parameter = Mnemonic.adMD[MN] + Convert.ToString(BD[pos + 1]) }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x1C: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opSV[MN], Parameter = Mnemonic.adT[MN] + Convert.ToString(BD[pos + 1]) }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x1D: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opCC[MN], Parameter = Mnemonic.adFC[MN] + Convert.ToString(BD[pos + 1]) }); //Result = Result + Memnoic.opCC[MN] + Memnoic.adFC[MN] + Convert.ToString(BD[pos + 1]); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3], BD[pos + 4], BD[pos + 5] }; pos += 6; } break; case 0x20: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opAUF[MN], Parameter = Mnemonic.adDB[MN] + Convert.ToString(BD[pos + 1]) }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x21: { switch (BD[pos + 1]) { case 0x20: retVal.Add(new S7FunctionBlockRow() { Command = ">I" }); break; case 0x40: retVal.Add(new S7FunctionBlockRow() { Command = "<I" }); break; case 0x60: retVal.Add(new S7FunctionBlockRow() { Command = "<>I" }); break; case 0x80: retVal.Add(new S7FunctionBlockRow() { Command = "==I" }); break; case 0xA0: retVal.Add(new S7FunctionBlockRow() { Command = ">=I" }); break; case 0xC0: retVal.Add(new S7FunctionBlockRow() { Command = "<=I" }); break; } ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x24: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opSE[MN], Parameter = Mnemonic.adT[MN] + Convert.ToString(BD[pos + 1]) }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x28: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opL[MN], Parameter = "B#16#" + (BD[pos + 1]).ToString("X") }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x29: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opSLD[MN], Parameter = (BD[pos + 1]).ToString() }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x2C: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opSS[MN], Parameter = Mnemonic.adT[MN] + Convert.ToString(BD[pos + 1]) }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x30: { //Result = Result + Memnoic.opL[MN]; string par = ""; switch (BD[pos + 1]) { case 0x02: par = "2#" + Helper.GetWordBool(BD[pos + 2], BD[pos + 3]); break; case 0x03: par = Convert.ToString(libnodave.getS16from(BD, pos + 2)); //Helper.GetInt(BD[pos + 2], BD[pos + 3])); break; case 0x05: par = Helper.GetS7String(pos + 2, 2, BD); break; case 0x06: par = "B#(" + Convert.ToString(BD[pos + 2]) + ", " + Convert.ToString(BD[pos + 3]) + ")"; break; case 0x00: case 0x07: par = "W#16#" + libnodave.getU16from(BD, pos + 2).ToString("X"); // Helper.GetWord(BD[pos + 2], BD[pos + 3]).ToString("X"); break; case 0x08: par = "C#" + libnodave.getU16from(BD, pos + 2).ToString("X"); // Helper.GetWord(BD[pos + 2], BD[pos + 3]).ToString("X"); break; case 0x0A: par = Helper.GetDate(BD[pos + 2], BD[pos + 3]); break; case 0x0C: par = Helper.GetS5Time(BD[pos + 2], BD[pos + 3]); break; } retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opL[MN], Parameter = par }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x31: { switch (BD[pos + 1]) { case 0x20: retVal.Add(new S7FunctionBlockRow() { Command = ">R" }); break; case 0x40: retVal.Add(new S7FunctionBlockRow() { Command = "<R" }); break; case 0x60: retVal.Add(new S7FunctionBlockRow() { Command = "<>R" }); break; case 0x80: retVal.Add(new S7FunctionBlockRow() { Command = "==R" }); break; case 0xA0: retVal.Add(new S7FunctionBlockRow() { Command = ">=R" }); break; case 0xC0: retVal.Add(new S7FunctionBlockRow() { Command = "<=R" }); break; } ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x34: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opSI[MN], Parameter = Mnemonic.adT[MN] + Convert.ToString(BD[pos + 1]) }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x38: { string par = ""; switch (BD[pos + 1]) { case 0x01: par = libnodave.getFloatfrom(BD, pos + 2).ToString("0.000000e+000"); break; case 0x02: par = "2#" + Helper.GetDWordBool(BD[pos + 2], BD[pos + 3], BD[pos + 4], BD[pos + 5]); break; case 0x03: par = "L#" + Convert.ToString(libnodave.getS32from(BD, pos + 2)); break; case 0x04: par = Helper.GetPointer(BD, pos + 2, MN); break; case 0x05: par = Helper.GetS7String(pos + 2, 4, BD); break; case 0x06: par = "B#(" + Convert.ToString(BD[pos + 2]) + ", " + Convert.ToString(BD[pos + 3]) + ", " + Convert.ToString(BD[pos + 4]) + ", " + Convert.ToString(BD[pos + 5]) + ")"; break; case 0x07: par = "DW#16#" + libnodave.getU32from(BD, pos + 2).ToString("X"); break; case 0x09: par = Helper.GetDTime(BD, pos + 2); break; case 0x0b: par = Helper.GetTOD(BD, pos + 2); break; } retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opL[MN], Parameter = par }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3], BD[pos + 4], BD[pos + 5] }; pos += 6; } break; case 0x39: { switch (BD[pos + 1]) { case 0x20: retVal.Add(new S7FunctionBlockRow() { Command = ">D" }); //Result = Result + ">D"; break; case 0x40: retVal.Add(new S7FunctionBlockRow() { Command = "<D" }); //Result = Result + "<D"; break; case 0x60: retVal.Add(new S7FunctionBlockRow() { Command = "<>D" }); //Result = Result + "<>D"; break; case 0x80: retVal.Add(new S7FunctionBlockRow() { Command = "==D" }); //Result = Result + "==D"; break; case 0xA0: retVal.Add(new S7FunctionBlockRow() { Command = ">=D" }); //Result = Result + ">=D"; break; case 0xC0: retVal.Add(new S7FunctionBlockRow() { Command = "<=D" }); //Result = Result + "<=D"; break; } ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x3C: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opR[MN], Parameter = Mnemonic.adT[MN] + Convert.ToString(BD[pos + 1]) }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x3D: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opUC[MN], Parameter = Mnemonic.adFC[MN] + Convert.ToString(BD[pos + 1]) }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3], BD[pos + 4], BD[pos + 5] }; //Get Parameter Count int paranz = (BD[pos + 5] / 2) - 1; List<string> tmplst = new List<string>(); for (int n = 1; n <= paranz; n++) { tmplst.Add(Helper.GetFCPointer(BD[pos + 6], BD[pos + 7], BD[pos + 8], BD[pos + 9])); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = Helper.CombineByteArray(((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7, new byte[] { BD[pos + 6], BD[pos + 7], BD[pos + 8], BD[pos + 9] }); pos += 4; } byte[] backup = ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).ExtParameter = tmplst; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = backup; pos += 6; } break; case 0x41: { switch (BD[pos + 1]) { case 0x00: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opUW[MN] }); //Result = Result + Memnoic.opUW[MN]; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x10: case 0x11: case 0x12: case 0x13: case 0x14: case 0x15: case 0x16: case 0x17: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opZUW[MN], Parameter = Mnemonic.adE[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) + "." + Convert.ToString(BD[pos + 1] - 0x10) }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; break; case 0x20: case 0x21: case 0x22: case 0x23: case 0x24: case 0x25: case 0x26: case 0x27: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opZUW[MN], Parameter = Mnemonic.adA[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) + "." + Convert.ToString(BD[pos + 1] - 0x20) }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; break; case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: case 0x35: case 0x36: case 0x37: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opZUW[MN], Parameter = Mnemonic.adM[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) + "." + Convert.ToString(BD[pos + 1] - 0x30) }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; break; case 0x40: //Zuweisung with DB case 0x41: case 0x42: case 0x43: case 0x44: case 0x45: case 0x46: case 0x47: { string par = ""; byte[] DBByte = null; if (retVal[retVal.Count - 1].Command == Mnemonic.opAUF[MN] && !((S7FunctionBlockRow)retVal[retVal.Count - 1]).Parameter.Contains("["))// && CombineDBOpenAndCommand) { ((S7FunctionBlockRow)retVal[retVal.Count - 1]).CombineDBAccess = true; } retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opZUW[MN], Parameter = par + Mnemonic.adDBX[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) + "." + Convert.ToString(BD[pos + 1] - 0x40) }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; if (DBByte != null) ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = Helper.CombineByteArray(DBByte, ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7); pos += 4; break; } case 0x50: //Zuweisung with DI case 0x51: case 0x52: case 0x53: case 0x54: case 0x55: case 0x56: case 0x57: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opZUW[MN], Parameter = Mnemonic.adDIX[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) + "." + Convert.ToString(BD[pos + 1] - 0x50) }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; break; } case 0x60://Zuweisung without DB case 0x61: case 0x62: case 0x63: case 0x64: case 0x65: case 0x66: case 0x67: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opZUW[MN], Parameter = Mnemonic.adL[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) + "." + Convert.ToString(BD[pos + 1] - 0x60) }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; break; default: retVal.Add(new S7FunctionBlockRow() { Command = "erra" }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; break; } } break; case 0x42: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opL[MN], Parameter = Mnemonic.adZ[MN] + Convert.ToString(BD[pos + 1]) }); //Result = Result + Memnoic.opL[MN] + Memnoic.adZ[MN] + Convert.ToString(BD[pos + 1]); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x44: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opFR[MN], Parameter = Mnemonic.adZ[MN] + Convert.ToString(BD[pos + 1]) }); //Result = Result + Memnoic.opFR[MN] + Memnoic.adZ[MN] + Convert.ToString(BD[pos + 1]); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x4A: { if (BD[pos + 1] < 0x80) retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opL[MN], Parameter = Mnemonic.adEB[MN] + Convert.ToString(BD[pos + 1]) }); else retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opL[MN], Parameter = Mnemonic.adAB[MN] + Convert.ToString(BD[pos + 1] - 0x80) }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x4b: { if (BD[pos + 1] < 0x80) retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opT[MN], Parameter = Mnemonic.adEB[MN] + Convert.ToString(BD[pos + 1]) }); else retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opT[MN], Parameter = Mnemonic.adAB[MN] + Convert.ToString(BD[pos + 1] - 0x80) }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x4C: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opLC[MN], Parameter = Mnemonic.adZ[MN] + Convert.ToString(BD[pos + 1]) }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x51: case 0x58: case 0x59: { string cmd = "", par = ""; if (BD[pos + 1] == 0x00) { switch (BD[pos]) { case 0x51: cmd = Mnemonic.opXOW[MN]; retVal.Add(new S7FunctionBlockRow() { Command = cmd }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; break; case 0x58: cmd = Mnemonic.opPLU[MN]; retVal.Add(new S7FunctionBlockRow() { Command = cmd, Parameter = libnodave.getS16from(BD, pos + 2).ToString() }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; break; case 0x59: cmd = "-I"; retVal.Add(new S7FunctionBlockRow() { Command = cmd }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; break; } } else { int LowByte = BD[pos + 1] & 0x0F; //Only Highbyte switch (BD[pos]) { case 0x51: if (BD[pos + 1] < 0xb0) cmd = LowByte < 0x09 ? Mnemonic.opU[MN] : Mnemonic.opO[MN]; else cmd = LowByte < 0x09 ? Mnemonic.opUN[MN] : Mnemonic.opON[MN]; break; case 0x58: if (BD[pos + 1] < 0xb0) cmd = LowByte < 0x09 ? Mnemonic.opX[MN] : Mnemonic.opS[MN]; else cmd = LowByte < 0x09 ? Mnemonic.opXN[MN] : Mnemonic.opR[MN]; break; case 0x59: if (BD[pos + 1] < 0xb0) cmd = LowByte < 0x09 ? Mnemonic.opZUW[MN] : Mnemonic.opFP[MN]; else cmd = LowByte < 0x09 ? "err1" : Mnemonic.opFN[MN];//Don't know the Low Byte command break; } switch (BD[pos + 1] & 0x0F) { case 0x01: case 0x09: par = Mnemonic.adE[MN]; break; case 0x02: case 0x0A: par = Mnemonic.adA[MN]; break; case 0x03: case 0x0B: par = Mnemonic.adM[MN]; break; case 0x04: case 0x0C: par = Mnemonic.adDBX[MN]; break; case 0x05: case 0x0D: par = Mnemonic.adDIX[MN]; break; case 0x06: case 0x0E: par = Mnemonic.adL[MN]; break; } switch (BD[pos + 1] & 0xF0) { case 0x30: case 0xb0: par += Mnemonic.adMD[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) + "]"; break; case 0x40: case 0xc0: par += Mnemonic.adDBD[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) + "]"; break; case 0x50: case 0xd0: par += Mnemonic.adDID[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) + "]"; break; case 0x60: case 0xe0: par += Mnemonic.adLD[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) + "]"; break; case 0x70: case 0xf0: par += Mnemonic.adMD[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) + "]"; break; } ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; retVal.Add(new S7FunctionBlockRow() { Command = cmd, Parameter = par }); pos += 4; } } break; case 0x52: { if (BD[pos + 1] < 0x80) retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opL[MN], Parameter = Mnemonic.adEW[MN] + Convert.ToString(BD[pos + 1]) }); else retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opL[MN], Parameter = Mnemonic.adAW[MN] + Convert.ToString(BD[pos + 1] - 0x80) }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x53: { if (BD[pos + 1] < 0x80) retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opT[MN], Parameter = Mnemonic.adEW[MN] + Convert.ToString(BD[pos + 1]) }); //Result = Result + Memnoic.opT[MN] + Memnoic.adEW[MN] + Convert.ToString(BD[pos + 1]); else retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opT[MN], Parameter = Mnemonic.adAW[MN] + Convert.ToString(BD[pos + 1] - 0x80) }); //Result = Result + Memnoic.opT[MN] + Memnoic.adAW[MN] + Convert.ToString(BD[pos + 1] - 0x80); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x54: { if (BD[pos + 1] < 0x80) retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opZR[MN], Parameter = Mnemonic.adZ[MN] + Convert.ToString(BD[pos + 1]) }); //Result = Result + Memnoic.opZR[MN] + Memnoic.adZ[MN] + Convert.ToString(BD[pos + 1]); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x55: { if (BD[pos + 1] < 0x80) retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opCC[MN], Parameter = Mnemonic.adFB[MN] + Convert.ToString(BD[pos + 1]) }); //Result = Result + Memnoic.opCC[MN] + Memnoic.adFB[MN] + Convert.ToString(BD[pos + 1]); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x5A: { if (BD[pos + 1] < 0x80) retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opL[MN], Parameter = Mnemonic.adED[MN] + Convert.ToString(BD[pos + 1]) }); //Result = Result + Memnoic.opL[MN] + Memnoic.adED[MN] + Convert.ToString(BD[pos + 1]); else retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opL[MN], Parameter = Mnemonic.adAD[MN] + Convert.ToString(BD[pos + 1] - 0x80) }); //Result = Result + Memnoic.opL[MN] + Memnoic.adAD[MN] + Convert.ToString(BD[pos + 1] - 0x80); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x5b: { if (BD[pos + 1] < 0x80) retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opT[MN], Parameter = Mnemonic.adED[MN] + Convert.ToString(BD[pos + 1]) }); else retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opT[MN], Parameter = Mnemonic.adAD[MN] + Convert.ToString(BD[pos + 1]) }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x5C: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opS[MN], Parameter = Mnemonic.adZ[MN] + Convert.ToString(BD[pos + 1]) }); //Result = Result + Memnoic.opS[MN] + Memnoic.adZ[MN] + Convert.ToString(BD[pos + 1]); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x60: { switch (BD[pos + 1]) { case 0x00: retVal.Add(new S7FunctionBlockRow() { Command = "/I" }); break; case 0x01: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opMOD[MN] }); break; case 0x02: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opABS[MN] }); break; case 0x03: retVal.Add(new S7FunctionBlockRow() { Command = "/R" }); break; case 0x04: retVal.Add(new S7FunctionBlockRow() { Command = "*I" }); break; case 0x05: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opPLU[MN], Parameter = "L#" + Convert.ToString(libnodave.getS32from(BD, pos + 2)) }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3], BD[pos + 4], BD[pos + 5] }; pos += 6; goto brk2; } break; case 0x06: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opNEGR[MN] }); break; case 0x07: retVal.Add(new S7FunctionBlockRow() { Command = "*R" }); break; case 0x08: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opENT[MN] }); break; case 0x09: retVal.Add(new S7FunctionBlockRow() { Command = "-D" }); break; case 0x0A: retVal.Add(new S7FunctionBlockRow() { Command = "*D" }); break; case 0x0b: retVal.Add(new S7FunctionBlockRow() { Command = "-R" }); break; case 0x0D: retVal.Add(new S7FunctionBlockRow() { Command = "+D" }); break; case 0x0E: retVal.Add(new S7FunctionBlockRow() { Command = "/D" }); break; case 0x0F: retVal.Add(new S7FunctionBlockRow() { Command = "+R" }); break; case 0x10: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opSIN[MN] }); break; case 0x11: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opCOS[MN] }); break; case 0x12: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opTAN[MN] }); break; case 0x13: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opLN[MN] }); break; case 0x14: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opSQRT[MN] }); break; case 0x18: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opASIN[MN] }); break; case 0x19: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opACOS[MN] }); break; case 0x1A: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opATAN[MN] }); break; case 0x1b: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opEXP[MN] }); break; case 0x1C: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opSQR[MN] }); break; } ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } brk2: break; case 0x61: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opSLW[MN], Parameter = Convert.ToString(BD[pos + 1]) }); //Result = Result + Memnoic.opSLW[MN] + Convert.ToString(BD[pos + 1]); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x64: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opRLD[MN], Parameter = Convert.ToString(BD[pos + 1]) }); //Result = Result + Memnoic.opRLD[MN] + Convert.ToString(BD[pos + 1]); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x65: { switch (BD[pos + 1]) { case 0x00: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opBE[MN] }); //Result = Result + Memnoic.opBE[MN]; break; case 0x01: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opBEA[MN] }); //Result = Result + Memnoic.opBEA[MN]; break; } ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x68: { switch (BD[pos + 1]) { case 0x06: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opDTR[MN] }); //Result = Result + Memnoic.opDTR[MN]; break; case 0x07: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opNEGD[MN] }); //Result = Result + Memnoic.opNEGD[MN]; break; case 0x08: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opITB[MN] }); //Result = Result + Memnoic.opITB[MN]; break; case 0x0C: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opBTI[MN] }); //Result = Result + Memnoic.opBTI[MN]; break; case 0x0A: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opDTB[MN] }); //Result = Result + Memnoic.opDTB[MN]; break; case 0x0D: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opINVD[MN] }); //Result = Result + Memnoic.opINVD[MN]; break; case 0x0E: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opBTD[MN] }); //Result = Result + Memnoic.opBTD[MN]; break; case 0x12: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opSLW[MN] }); //Result = Result + Memnoic.opSLW[MN]; break; case 0x13: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opSLD[MN] }); //Result = Result + Memnoic.opSLD[MN]; break; case 0x17: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opRLD[MN] }); //Result = Result + Memnoic.opRLD[MN]; break; case 0x18: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opRLDA[MN] }); //Result = Result + Memnoic.opRLDA[MN]; break; case 0x1A: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opTAW[MN] }); //Result = Result + Memnoic.opTAW[MN]; break; case 0x1b: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opTAD[MN] }); //Result = Result + Memnoic.opTAD[MN]; break; case 0x1C: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opCLR[MN] }); //Result = Result + Memnoic.opCLR[MN]; break; case 0x1D: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opSET[MN] }); //Result = Result + Memnoic.opSET[MN]; break; case 0x1E: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opITD[MN] }); //Result = Result + Memnoic.opITD[MN]; break; case 0x22: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opSRW[MN] }); //Result = Result + Memnoic.opSRW[MN]; break; case 0x23: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opSRD[MN] }); //Result = Result + Memnoic.opSRD[MN]; break; case 0x24: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opSSI[MN] }); //Result = Result + Memnoic.opSSI[MN]; break; case 0x25: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opSSD[MN] }); //Result = Result + Memnoic.opSSD[MN]; break; case 0x27: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opRRD[MN] }); //Result = Result + Memnoic.opRRD[MN]; break; case 0x28: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opRRDA[MN] }); //Result = Result + Memnoic.opRRDA[MN]; break; case 0x2C: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opSAVE[MN] }); //Result = Result + Memnoic.opSAVE[MN]; break; case 0x2D: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opNOT[MN] }); //Result = Result + Memnoic.opNOT[MN]; break; case 0x2E: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opPUSH[MN] }); //Result = Result + Memnoic.opPUSH[MN]; break; case 0x37: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opUD[MN] }); //Result = Result + Memnoic.opUD[MN]; break; case 0x34: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opUW[MN], Parameter = "W#16#" + (libnodave.getU16from(BD, pos + 2)).ToString("X") }); //Result = Result + Memnoic.opUW[MN] + "W#16#" + // (Helper.GetWord(BD[pos + 2], BD[pos + 3])).ToString("X"); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; goto brk1; } break; case 0x36: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opUD[MN], Parameter = "DW#16#" + (libnodave.getU32from(BD, pos + 2).ToString("X")) }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3], BD[pos + 4], BD[pos + 5] }; pos += 6; goto brk1; } break; case 0x3A: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opMCRA[MN] }); //Result = Result + Memnoic.opMCRA[MN]; break; case 0x3b: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opMCRD[MN] }); //Result = Result + Memnoic.opMCRD[MN]; break; case 0x3C: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opMCRO[MN] }); //Result = Result + Memnoic.opMCRO[MN]; break; case 0x3D: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opMCRC[MN] }); //Result = Result + Memnoic.opMCRC[MN]; break; case 0x3E: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opPOP[MN] }); //Result = Result + Memnoic.opPOP[MN]; break; case 0x44: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opOW[MN], Parameter = "W#16#" + (libnodave.getU16from(BD, pos + 2)).ToString("X") }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; goto brk1; } break; case 0x46: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opOD[MN], Parameter = "DW#16#" + libnodave.getU32from(BD, pos + 2).ToString("X") }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3], BD[pos + 4], BD[pos + 5] }; pos += 6; goto brk1; } break; case 0x47: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opOD[MN] }); break; case 0x4E: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opLEAVE[MN] }); break; case 0x54: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opXOW[MN], Parameter = "W#16#" + (libnodave.getU16from(BD, pos + 2)).ToString("X") }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; goto brk1; } break; case 0x56: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opXOD[MN], Parameter = "DW#16#" + libnodave.getU32from(BD, pos + 2).ToString("X") }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3], BD[pos + 4], BD[pos + 5] }; pos += 6; goto brk1; } break; case 0x57: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opXOD[MN] }); break; case 0x5C: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opRND[MN] }); break; case 0x5D: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opRNDM[MN] }); break; case 0x5E: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opRNDP[MN] }); break; case 0x5F: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opTRUNC[MN] }); break; default: { if ((BD[pos + 1] & 0x0F) == 0x01) retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opSSI[MN], Parameter = Convert.ToString((BD[pos + 1] >> 4) & 0x0F) }); else retVal.Add(new S7FunctionBlockRow() { Command = "err2" }); } break; } ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } brk1: break; case 0x69: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opSRW[MN], Parameter = Convert.ToString(BD[pos + 1]) }); //Result = Result + Memnoic.opSRW[MN] + Convert.ToString(BD[pos + 1]); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x6C: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opZV[MN], Parameter = Mnemonic.adZ[MN] + Convert.ToString(BD[pos + 1]) }); //Result = Result + Memnoic.opZV[MN] + Memnoic.adZ[MN] + Convert.ToString(BD[pos + 1]); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x70: { switch (BD[pos + 1]) { case 0x02: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opTAK[MN] }); //Result = Result + Memnoic.opTAK[MN]; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x06: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opL[MN], Parameter = Mnemonic.adSTW[MN] }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x07: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opT[MN], Parameter = Mnemonic.adSTW[MN] }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x08: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opLOOP[MN], JumpWidth = libnodave.getS16from(BD, pos + 2) }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x09: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opSPL[MN], JumpWidth = libnodave.getS16from(BD, pos + 2) }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x0b: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opSPA[MN], JumpWidth = libnodave.getS16from(BD, pos + 2) }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; default: retVal.Add(new S7FunctionBlockRow() { Command = "err3" }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; break; } } break; case 0x71: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opSSD[MN], Parameter = Convert.ToString(BD[pos + 1]) }); //Result = Result + Memnoic.opSSD[MN] + Convert.ToString(BD[pos + 1]); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x74: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opRRD[MN], Parameter = Convert.ToString(BD[pos + 1]) }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x75: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opUC[MN], Parameter = Mnemonic.adFB[MN] + Convert.ToString(BD[pos + 1]) }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x79: { string cmd = "", par = ""; if (BD[pos + 1] == 0x00) { cmd = "+I"; retVal.Add(new S7FunctionBlockRow() { Command = cmd }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } else { int LowByte = BD[pos + 1] & 0x0F; int HighByte = BD[pos + 1] & 0xF0; switch (LowByte) { case 0x00: case 0x08: cmd += (HighByte < 0x90) ? Mnemonic.opU[MN] : Mnemonic.opS[MN]; break; case 0x01: case 0x09: cmd += (HighByte < 0x90) ? Mnemonic.opUN[MN] : Mnemonic.opR[MN]; break; case 0x02: case 0x0A: cmd += (HighByte < 0x90) ? Mnemonic.opO[MN] : Mnemonic.opZUW[MN]; break; case 0x03: case 0x0B: cmd += (HighByte < 0x90) ? Mnemonic.opON[MN] : "err5"; //Ther is no Value for this??? break; case 0x04: case 0x0C: cmd += (HighByte < 0x90) ? Mnemonic.opX[MN] : Mnemonic.opFP[MN]; break; case 0x05: case 0x0D: cmd += (HighByte < 0x90) ? Mnemonic.opXN[MN] : Mnemonic.opFN[MN]; break; } switch (HighByte) { case 0x10: case 0x90: par += Mnemonic.adE[MN]; break; case 0x20: case 0xa0: par += Mnemonic.adA[MN]; break; case 0x30: case 0xb0: par += Mnemonic.adM[MN]; break; case 0x40: case 0xc0: par += Mnemonic.adDBX[MN]; break; case 0x50: case 0xd0: par += Mnemonic.adDIX[MN]; break; case 0x60: case 0xe0: par += Mnemonic.adL[MN]; break; } if (LowByte < 0x08) par += "[" + Mnemonic.adAR1[MN] + "," + Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]"; else par += "[" + Mnemonic.adAR2[MN] + "," + Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]"; retVal.Add(new S7FunctionBlockRow() { Command = cmd, Parameter = par }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } } break; case 0x7C: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opR[MN], Parameter = Mnemonic.adZ[MN] + Convert.ToString(BD[pos + 1]) }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x7E: case 0xBE: { string cmd = "", par = ""; if (BD[pos + 1] == 0x00) { cmd = "err6"; retVal.Add(new S7FunctionBlockRow() { Command = cmd, Parameter = par }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } else { int LowByte = BD[pos + 1] & 0x0F; int HighByte = BD[pos + 1] & 0xF0; cmd = Mnemonic.opT[MN]; //if (LowByte>= 0x05 && LowByte<=0x09 || LowByte >) //cmd = (LowByte <= 0x07) ? Memnoic.opL[MN] : Memnoic.opT[MN]; if (LowByte <= 0x04 || ((LowByte >= 0x09) && LowByte <= 0x0c)) cmd = Mnemonic.opL[MN]; switch (HighByte) { case 0x00: switch (LowByte) { case 0x01: case 0x09: par += Mnemonic.adPEB[MN]; break; case 0x02: case 0x0A: par += Mnemonic.adPEW[MN]; break; case 0x03: case 0x0B: par += Mnemonic.adPED[MN]; break; case 0x05: case 0x0D: par += Mnemonic.adPAB[MN]; break; case 0x06: case 0x0E: par += Mnemonic.adPAW[MN]; break; case 0x07: case 0x0F: par += Mnemonic.adPAD[MN]; break; } break; case 0x10: switch (LowByte) { case 0x01: case 0x05: case 0x09: case 0x0D: par += Mnemonic.adEB[MN]; break; case 0x02: case 0x06: case 0x0A: case 0x0E: par += Mnemonic.adEW[MN]; break; case 0x03: case 0x07: case 0x0B: case 0x0F: par += Mnemonic.adED[MN]; break; } break; case 0x20: switch (LowByte) { case 0x01: case 0x05: case 0x09: case 0x0D: par += Mnemonic.adAB[MN]; break; case 0x02: case 0x06: case 0x0A: case 0x0E: par += Mnemonic.adAW[MN]; break; case 0x03: case 0x07: case 0x0B: case 0x0F: par += Mnemonic.adAD[MN]; break; } break; case 0x30: switch (LowByte) { case 0x01: case 0x05: case 0x09: case 0x0D: par += Mnemonic.adMB[MN]; break; case 0x02: case 0x06: case 0x0A: case 0x0E: par += Mnemonic.adMW[MN]; break; case 0x03: case 0x07: case 0x0B: case 0x0F: par += Mnemonic.adMD[MN]; break; } break; case 0x40: switch (LowByte) { case 0x01: case 0x05: case 0x09: case 0x0D: par += Mnemonic.adDBB[MN]; break; case 0x02: case 0x06: case 0x0A: case 0x0E: par += Mnemonic.adDBW[MN]; break; case 0x03: case 0x07: case 0x0B: case 0x0F: par += Mnemonic.adDBD[MN]; break; } break; case 0x50: switch (LowByte) { case 0x01: case 0x05: case 0x09: case 0x0D: par += Mnemonic.adDIB[MN]; break; case 0x02: case 0x06: case 0x0A: case 0x0E: par += Mnemonic.adDIW[MN]; break; case 0x03: case 0x07: case 0x0B: case 0x0F: par += Mnemonic.adDID[MN]; break; } break; case 0x60: switch (LowByte) { case 0x01: case 0x05: case 0x09: case 0x0D: par += Mnemonic.adLB[MN]; break; case 0x02: case 0x06: case 0x0A: case 0x0E: par += Mnemonic.adLW[MN]; break; case 0x03: case 0x07: case 0x0B: case 0x0F: par += Mnemonic.adLD[MN]; break; } break; } if (BD[pos] == 0x7E) par += Convert.ToString(libnodave.getU16from(BD, pos + 2)); else if (BD[pos] == 0xBE) if (LowByte < 0x09) par += "[" + Mnemonic.adAR1[MN] + "," + Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]"; else par += "[" + Mnemonic.adAR2[MN] + "," + Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]"; //new byte[] DBByte = null; if (retVal[retVal.Count - 1].Command == Mnemonic.opAUF[MN] && par.Substring(0, 2) == "DB")// && CombineDBOpenAndCommand) { ((S7FunctionBlockRow)retVal[retVal.Count - 1]).CombineDBAccess = true; } retVal.Add(new S7FunctionBlockRow() { Command = cmd, Parameter = par }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; if (DBByte != null) ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = Helper.CombineByteArray(DBByte, ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7); pos += 4; } } break; case 0x80: case 0x81: case 0x82: case 0x83: case 0x84: case 0x85: case 0x86: case 0x87: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opU[MN], Parameter = Mnemonic.adM[MN] + Convert.ToString(BD[pos + 1]) + "." + Convert.ToString(BD[pos] - 0x80) }); //Result = Result + Memnoic.opU[MN] + Memnoic.adM[MN] + Convert.ToString(BD[pos + 1]) + "." + // Convert.ToString(BD[pos] - 0x80); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; break; case 0x88: case 0x89: case 0x8A: case 0x8B: case 0x8C: case 0x8D: case 0x8E: case 0x8F: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opO[MN], Parameter = Mnemonic.adM[MN] + Convert.ToString(BD[pos + 1]) + "." + Convert.ToString(BD[pos] - 0x88) }); //Result = Result + Memnoic.opO[MN] + Memnoic.adM[MN] + Convert.ToString(BD[pos + 1]) + "." + // Convert.ToString(BD[pos] - 0x88); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; break; case 0x90: case 0x91: case 0x92: case 0x93: case 0x94: case 0x95: case 0x96: case 0x97: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opS[MN], Parameter = Mnemonic.adM[MN] + Convert.ToString(BD[pos + 1]) + "." + Convert.ToString(BD[pos] - 0x90) }); //Result = Result + Memnoic.opS[MN] + Memnoic.adM[MN] + Convert.ToString(BD[pos + 1]) + "." + // Convert.ToString(BD[pos] - 0x90); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; break; case 0x98: case 0x99: case 0x9A: case 0x9B: case 0x9C: case 0x9D: case 0x9E: case 0x9F: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opZUW[MN], Parameter = Mnemonic.adM[MN] + Convert.ToString(BD[pos + 1]) + "." + Convert.ToString(BD[pos] - 0x98) }); //Result = Result + Memnoic.opZUW[MN] + Memnoic.adM[MN] + Convert.ToString(BD[pos + 1]) + "." + // Convert.ToString(BD[pos] - 0x98); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; break; case 0xA0: case 0xA1: case 0xA2: case 0xA3: case 0xA4: case 0xA5: case 0xA6: case 0xA7: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opUN[MN], Parameter = Mnemonic.adM[MN] + Convert.ToString(BD[pos + 1]) + "." + Convert.ToString(BD[pos] - 0xA0) }); //Result = Result + Memnoic.opUN[MN] + Memnoic.adM[MN] + Convert.ToString(BD[pos + 1]) + "." + // Convert.ToString(BD[pos] - 0xA0); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; break; case 0xA8: case 0xA9: case 0xAA: case 0xAB: case 0xAC: case 0xAD: case 0xAE: case 0xAF: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opON[MN], Parameter = Mnemonic.adM[MN] + Convert.ToString(BD[pos + 1]) + "." + Convert.ToString(BD[pos] - 0xA8) }); //Result = Result + Memnoic.opON[MN] + Memnoic.adM[MN] + Convert.ToString(BD[pos + 1]) + "." + // Convert.ToString(BD[pos] - 0xA8); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; break; case 0xB0: case 0xB1: case 0xB2: case 0xB3: case 0xB4: case 0xB5: case 0xB6: case 0xB7: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opR[MN], Parameter = Mnemonic.adM[MN] + Convert.ToString(BD[pos + 1]) + "." + Convert.ToString(BD[pos] - 0xB0) }); //Result = Result + Memnoic.opR[MN] + Memnoic.adM[MN] + Convert.ToString(BD[pos + 1]) + "." + // Convert.ToString(BD[pos] - 0xB0); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; break; case 0xB8: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opU[MN], Parameter = Mnemonic.adZ[MN] + Convert.ToString(BD[pos + 1]) }); //Result = Result + Memnoic.opU[MN] + Memnoic.adZ[MN] + Convert.ToString(BD[pos + 1]); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0xB9: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opO[MN], Parameter = Mnemonic.adZ[MN] + Convert.ToString(BD[pos + 1]) }); //Result = Result + Memnoic.opO[MN] + Memnoic.adZ[MN] + Convert.ToString(BD[pos + 1]); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0xBA: case 0xBB: { int LowByte = BD[pos + 1] & 0x0F; int HighByte = BD[pos + 1] & 0xF0; string cmd = "", par = ""; if (BD[pos + 1] == 0x00) { switch (BD[pos]) { case 0xBA: cmd = cmd + Mnemonic.opUO[MN]; break; case 0xBB: cmd = cmd + Mnemonic.opOO[MN]; break; } retVal.Add(new S7FunctionBlockRow() { Command = cmd, Parameter = par }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } else { cmd += HighByte < 0x80 ? Mnemonic.opL[MN] : Mnemonic.opT[MN]; switch (BD[pos]) { case 0xBA: switch (LowByte) { case 0x00: par += HighByte < 0x80 ? Mnemonic.adPEB[MN] : Mnemonic.adPAB[MN]; break; case 0x01: par += Mnemonic.adEB[MN]; break; case 0x02: par += Mnemonic.adAB[MN]; break; case 0x03: par += Mnemonic.adMB[MN]; break; case 0x04: par += Mnemonic.adDBB[MN]; break; case 0x05: par += Mnemonic.adDIB[MN]; break; case 0x06: par += Mnemonic.adLB[MN]; break; } break; case 0xBB: switch (LowByte) { case 0x00: par += HighByte < 0x80 ? Mnemonic.adPEW[MN] : Mnemonic.adPAW[MN]; break; case 0x01: par += Mnemonic.adEW[MN]; break; case 0x02: par += Mnemonic.adAW[MN]; break; case 0x03: par += Mnemonic.adMW[MN]; break; case 0x04: par += Mnemonic.adDBW[MN]; break; case 0x05: par += Mnemonic.adDIW[MN]; break; case 0x06: par += Mnemonic.adLW[MN]; break; case 0x08: par += HighByte < 0x80 ? Mnemonic.adPED[MN] : Mnemonic.adPAD[MN]; break; case 0x09: par += Mnemonic.adED[MN]; break; case 0x0A: par += Mnemonic.adAD[MN]; break; case 0x0B: par += Mnemonic.adMD[MN]; break; case 0x0C: par += Mnemonic.adDBD[MN]; break; case 0x0D: par += Mnemonic.adDID[MN]; break; case 0x0E: par += Mnemonic.adLD[MN]; break; } break; } switch (HighByte) { case 0x00: //Not from old programm, guessed Values! case 0x80: par += "[" + Mnemonic.adPED[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) + "]"; break; case 0x10://Not from old programm, guessed Values! case 0x90: par += "[" + Mnemonic.adED[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) + "]"; break; case 0x20://Not from old programm, guessed Values! case 0xa0: par += "[" + Mnemonic.adAD[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) + "]"; break; case 0x30: case 0xb0: par += "[" + Mnemonic.adMD[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) + "]"; break; case 0x40: case 0xc0: par += "[" + Mnemonic.adDBD[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) + "]"; break; case 0x50: case 0xd0: par += "[" + Mnemonic.adDID[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) + "]"; break; case 0x60: case 0xe0: par += "[" + Mnemonic.adLD[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) + "]"; break; } retVal.Add(new S7FunctionBlockRow() { Command = cmd, Parameter = par }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } } break; case 0xBF: { string cmd = "", par = ""; if (BD[pos + 1] == 0x00) { cmd = ")"; retVal.Add(new S7FunctionBlockRow() { Command = cmd, Parameter = par }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } else { int LowByte = BD[pos + 1] & 0x0F; int HighByte = BD[pos + 1] & 0xF0; switch (LowByte) { case 0x00: cmd += Mnemonic.opU[MN]; break; case 0x01: cmd += Mnemonic.opUN[MN]; break; case 0x02: cmd += Mnemonic.opO[MN]; break; case 0x03: cmd += Mnemonic.opON[MN]; break; case 0x04: cmd += Mnemonic.opX[MN]; break; case 0x05: cmd += Mnemonic.opXN[MN]; break; case 0x06: cmd += Mnemonic.opL[MN]; break; case 0x08: cmd += Mnemonic.opFR[MN]; break; case 0x09: cmd += Mnemonic.opLC[MN]; break; case 0x0A: cmd += HighByte < 0x80 ? Mnemonic.opSA[MN] : Mnemonic.opZR[MN]; break; case 0x0B: cmd += HighByte < 0x80 ? Mnemonic.opSV[MN] : Mnemonic.opS[MN]; break; case 0x0C: cmd += Mnemonic.opSE[MN]; break; case 0x0D: cmd += HighByte < 0x80 ? Mnemonic.opSS[MN] : Mnemonic.opZV[MN]; break; case 0x0E: cmd += Mnemonic.opSI[MN]; break; case 0x0F: cmd += Mnemonic.opR[MN]; break; } if (HighByte < 0x80) par += Mnemonic.adT[MN]; else par += Mnemonic.adZ[MN]; switch (HighByte) { case 0x00://Guessed Value, not from old PRG case 0x80: par += "[" + Mnemonic.adPEW[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) + "]"; break; case 0x10://Guessed Value, not from old PRG case 0x90: par += "[" + Mnemonic.adEW[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) + "]"; break; case 0x20://Guessed Value, not from old Prg case 0xa0: par += "[" + Mnemonic.adAW[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) + "]"; break; case 0x30: case 0xb0: par += "[" + Mnemonic.adMW[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) + "]"; break; case 0x40: case 0xc0: par += "[" + Mnemonic.adDBW[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) + "]"; break; case 0x50: case 0xd0: par += "[" + Mnemonic.adDIW[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) + "]"; break; case 0x60: case 0xe0: par += "[" + Mnemonic.adLW[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) + "]"; break; } retVal.Add(new S7FunctionBlockRow() { Command = cmd, Parameter = par }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } } break; case 0xC0: case 0xC1: case 0xC2: case 0xC3: case 0xC4: case 0xC5: case 0xC6: case 0xC7: if (BD[pos + 1] < 0x80) retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opU[MN], Parameter = Mnemonic.adE[MN] + Convert.ToString(BD[pos + 1] & 0x7F) + "." + Convert.ToString(BD[pos] - 0xC0) }); //Result = Result + Memnoic.opU[MN] + Memnoic.adE[MN] + Convert.ToString(BD[pos + 1]) + "." + // Convert.ToString(BD[pos] - 0xC0); else retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opU[MN], Parameter = Mnemonic.adA[MN] + Convert.ToString(BD[pos + 1] & 0x7F) + "." + Convert.ToString(BD[pos] - 0xC0) }); //Result = Result + Memnoic.opU[MN] + Memnoic.adA[MN] + Convert.ToString(BD[pos + 1] - 0x80) + "." + // Convert.ToString(BD[pos] - 0xC0); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; break; case 0xC8: case 0xC9: case 0xCA: case 0xCB: case 0xCC: case 0xCD: case 0xCE: case 0xCF: if (BD[pos + 1] < 0x80) retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opO[MN], Parameter = Mnemonic.adE[MN] + Convert.ToString(BD[pos + 1] & 0x7F) + "." + Convert.ToString(BD[pos] - 0xC8) }); //Result = Result + Memnoic.opO[MN] + Memnoic.adE[MN] + Convert.ToString(BD[pos + 1]) + "." + // Convert.ToString(BD[pos] - 0xC8); else retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opO[MN], Parameter = Mnemonic.adA[MN] + Convert.ToString(BD[pos + 1] & 0x7F) + "." + Convert.ToString(BD[pos] - 0xC8) }); //Result = Result + Memnoic.opO[MN] + Memnoic.adA[MN] + Convert.ToString(BD[pos + 1] - 0x80) + "." + // Convert.ToString(BD[pos] - 0xC8); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; break; case 0xD0: case 0xD1: case 0xD2: case 0xD3: case 0xD4: case 0xD5: case 0xD6: case 0xD7: if (BD[pos + 1] < 0x80) retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opS[MN], Parameter = Mnemonic.adE[MN] + Convert.ToString(BD[pos + 1] & 0x7F) + "." + Convert.ToString(BD[pos] - 0xD0) }); //Result = Result + Memnoic.opS[MN] + Memnoic.adE[MN] + Convert.ToString(BD[pos + 1]) + "." + // Convert.ToString(BD[pos] - 0xD0); else retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opS[MN], Parameter = Mnemonic.adA[MN] + Convert.ToString(BD[pos + 1] & 0x7F) + "." + Convert.ToString(BD[pos] - 0xD0) }); //Result = Result + Memnoic.opS[MN] + Memnoic.adA[MN] + Convert.ToString(BD[pos + 1] - 0x80) + "." + // Convert.ToString(BD[pos] - 0xD0); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; break; case 0xD8: case 0xD9: case 0xDA: case 0xDB: case 0xDC: case 0xDD: case 0xDE: case 0xDF: if (BD[pos + 1] < 0x80) retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opZUW[MN], Parameter = Mnemonic.adE[MN] + Convert.ToString(BD[pos + 1] & 0x7F) + "." + Convert.ToString(BD[pos] - 0xD8) }); //Result = Result + Memnoic.opZUW[MN] + Memnoic.adE[MN] + Convert.ToString(BD[pos + 1]) + "." + // Convert.ToString(BD[pos] - 0xD8); else retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opZUW[MN], Parameter = Mnemonic.adA[MN] + Convert.ToString(BD[pos + 1] & 0x7F) + "." + Convert.ToString(BD[pos] - 0xD8) }); //Result = Result + Memnoic.opZUW[MN] + Memnoic.adA[MN] + Convert.ToString(BD[pos + 1] - 0x80) + "." + // Convert.ToString(BD[pos] - 0xD8); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; break; case 0xE0: case 0xE1: case 0xE2: case 0xE3: case 0xE4: case 0xE5: case 0xE6: case 0xE7: if (BD[pos + 1] < 0x80) retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opUN[MN], Parameter = Mnemonic.adE[MN] + Convert.ToString(BD[pos + 1] & 0x7F) + "." + Convert.ToString(BD[pos] - 0xE0) }); //Result = Result + Memnoic.opUN[MN] + Memnoic.adE[MN] + Convert.ToString(BD[pos + 1]) + "." + // Convert.ToString(BD[pos] - 0xE0); else retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opU[MN], Parameter = Mnemonic.adA[MN] + Convert.ToString(BD[pos + 1] & 0x7F) + "." + Convert.ToString(BD[pos] - 0xE0) }); //Result = Result + Memnoic.opUN[MN] + Memnoic.adA[MN] + Convert.ToString(BD[pos + 1] - 0x80) + "." + // Convert.ToString(BD[pos] - 0xE0); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; break; case 0xE8: case 0xE9: case 0xEA: case 0xEB: case 0xEC: case 0xED: case 0xEE: case 0xEF: if (BD[pos + 1] < 0x80) retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opON[MN], Parameter = Mnemonic.adE[MN] + Convert.ToString(BD[pos + 1] & 0x7F) + "." + Convert.ToString(BD[pos] - 0xE8) }); //Result = Result + Memnoic.opON[MN] + Memnoic.adE[MN] + Convert.ToString(BD[pos + 1]) + "." + // Convert.ToString(BD[pos] - 0xE8); else retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opON[MN], Parameter = Mnemonic.adA[MN] + Convert.ToString(BD[pos + 1] & 0x7F) + "." + Convert.ToString(BD[pos] - 0xE8) }); //Result = Result + Memnoic.opON[MN] + Memnoic.adA[MN] + Convert.ToString(BD[pos + 1] - 0x80) + "." + // Convert.ToString(BD[pos] - 0xE8); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; break; case 0xF0: case 0xF1: case 0xF2: case 0xF3: case 0xF4: case 0xF5: case 0xF6: case 0xF7: if (BD[pos + 1] < 0x80) retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opR[MN], Parameter = Mnemonic.adE[MN] + Convert.ToString(BD[pos + 1] & 0x7F) + "." + Convert.ToString(BD[pos] - 0xF0) }); //Result = Result + Memnoic.opR[MN] + Memnoic.adE[MN] + Convert.ToString(BD[pos + 1]) + "." + // Convert.ToString(BD[pos] - 0xF0); else retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opR[MN], Parameter = Mnemonic.adA[MN] + Convert.ToString(BD[pos + 1] & 0x7F) + "." + Convert.ToString(BD[pos] - 0xF0) }); //Result = Result + Memnoic.opR[MN] + Memnoic.adA[MN] + Convert.ToString(BD[pos + 1] - 0x80) + "." + // Convert.ToString(BD[pos] - 0xF0); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; break; case 0xF8: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opU[MN], Parameter = Mnemonic.adT[MN] + Convert.ToString(BD[pos + 1]) }); //Result = Result + Memnoic.opU[MN] + Memnoic.adT[MN] + Convert.ToString(BD[pos + 1]); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; break; case 0xF9: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opO[MN], Parameter = Mnemonic.adT[MN] + Convert.ToString(BD[pos + 1]) }); //Result = Result + Memnoic.opO[MN] + Memnoic.adT[MN] + Convert.ToString(BD[pos + 1]); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; break; case 0xFB: { switch (BD[pos + 1]) { case 0x00: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opO[MN] }); //Result = Result + Memnoic.opO[MN]; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x01: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opL[MN], Parameter = Mnemonic.adB[MN] + "[" + Mnemonic.adAR1[MN] + "," + Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]" }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x02: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opL[MN], Parameter = Mnemonic.adW[MN] + "[" + Mnemonic.adAR1[MN] + "," + Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]" }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x03: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opL[MN], Parameter = Mnemonic.adD[MN] + "[" + Mnemonic.adAR1[MN] + "," + Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]" }); //Result = Result + Memnoic.opL[MN] + Memnoic.adD[MN] + "[" + Memnoic.adAR1[MN] + "," + // Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x05: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opT[MN], Parameter = Mnemonic.adB[MN] + "[" + Mnemonic.adAR1[MN] + "," + Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]" }); //Result = Result + Memnoic.opT[MN] + Memnoic.adB[MN] + "[" + Memnoic.adAR1[MN] + "," + // Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x06: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opT[MN], Parameter = Mnemonic.adW[MN] + "[" + Mnemonic.adAR1[MN] + "," + Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]" }); //Result = Result + Memnoic.opT[MN] + Memnoic.adW[MN] + "[" + Memnoic.adAR1[MN] + "," + // Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x07: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opT[MN], Parameter = Mnemonic.adD[MN] + "[" + Mnemonic.adAR1[MN] + "," + Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]" }); //Result = Result + Memnoic.opT[MN] + Memnoic.adD[MN] + "[" + Memnoic.adAR1[MN] + "," + // Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x09: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opL[MN], Parameter = Mnemonic.adB[MN] + "[" + Mnemonic.adAR2[MN] + "," + Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]" }); //Result = Result + Memnoic.opL[MN] + Memnoic.adB[MN] + "[" + Memnoic.adAR2[MN] + "," + // Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x0A: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opL[MN], Parameter = Mnemonic.adW[MN] + "[" + Mnemonic.adAR2[MN] + "," + Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]" }); //Result = Result + Memnoic.opL[MN] + Memnoic.adW[MN] + "[" + Memnoic.adAR2[MN] + "," + // Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x0b: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opL[MN], Parameter = Mnemonic.adD[MN] + "[" + Mnemonic.adAR2[MN] + "," + Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]" }); //Result = Result + Memnoic.opL[MN] + Memnoic.adD[MN] + "[" + Memnoic.adAR2[MN] + "," + // Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x0D: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opT[MN], Parameter = Mnemonic.adB[MN] + "[" + Mnemonic.adAR2[MN] + "," + Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]" }); //Result = Result + Memnoic.opT[MN] + Memnoic.adB[MN] + "[" + Memnoic.adAR2[MN] + "," + // Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x0E: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opT[MN], Parameter = Mnemonic.adW[MN] + "[" + Mnemonic.adAR2[MN] + "," + Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]" }); //Result = Result + Memnoic.opT[MN] + Memnoic.adW[MN] + "[" + Memnoic.adAR2[MN] + "," + // Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x0F: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opT[MN], Parameter = Mnemonic.adD[MN] + "[" + Mnemonic.adAR2[MN] + "," + Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]" }); //Result = Result + Memnoic.opT[MN] + Memnoic.adD[MN] + "[" + Memnoic.adAR2[MN] + "," + // Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x10: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opU[MN], Parameter = "[" + Mnemonic.adAR1[MN] + "," + Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]" }); //Result = Result + Memnoic.opU[MN] + "[" + Memnoic.adAR1[MN] + "," + // Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x11: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opUN[MN], Parameter = "[" + Mnemonic.adAR1[MN] + "," + Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]" }); //Result = Result + Memnoic.opUN[MN] + "[" + Memnoic.adAR1[MN] + "," + // Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x12: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opO[MN], Parameter = "[" + Mnemonic.adAR1[MN] + "," + Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]" }); //Result = Result + Memnoic.opO[MN] + "[" + Memnoic.adAR1[MN] + "," + // Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x13: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opON[MN], Parameter = "[" + Mnemonic.adAR1[MN] + "," + Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]" }); //Result = Result + Memnoic.opON[MN] + "[" + Memnoic.adAR1[MN] + "," + // Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x14: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opX[MN], Parameter = "[" + Mnemonic.adAR1[MN] + "," + Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]" }); //Result = Result + Memnoic.opX[MN] + "[" + Memnoic.adAR1[MN] + "," + // Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x15: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opXN[MN], Parameter = "[" + Mnemonic.adAR1[MN] + "," + Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]" }); //Result = Result + Memnoic.opXN[MN] + "[" + Memnoic.adAR1[MN] + "," + // Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x18: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opU[MN], Parameter = "[" + Mnemonic.adAR2[MN] + "," + Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]" }); //Result = Result + Memnoic.opU[MN] + "[" + Memnoic.adAR2[MN] + "," + // Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x19: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opUN[MN], Parameter = "[" + Mnemonic.adAR2[MN] + "," + Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]" }); //Result = Result + Memnoic.opUN[MN] + "[" + Memnoic.adAR2[MN] + "," + // Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x1A: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opO[MN], Parameter = "[" + Mnemonic.adAR2[MN] + "," + Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]" }); //Result = Result + Memnoic.opO[MN] + "[" + Memnoic.adAR2[MN] + "," + // Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x1b: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opON[MN], Parameter = "[" + Mnemonic.adAR2[MN] + "," + Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]" }); //Result = Result + Memnoic.opON[MN] + "[" + Memnoic.adAR2[MN] + "," + // Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x1C: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opX[MN], Parameter = "[" + Mnemonic.adAR2[MN] + "," + Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]" }); //Result = Result + Memnoic.opX[MN] + "[" + Memnoic.adAR2[MN] + "," + // Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x1D: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opXN[MN], Parameter = "[" + Mnemonic.adAR2[MN] + "," + Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]" }); //Result = Result + Memnoic.opXN[MN] + "[" + Memnoic.adAR2[MN] + "," + // Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x20: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opS[MN], Parameter = "[" + Mnemonic.adAR1[MN] + "," + Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]" }); //Result = Result + Memnoic.opS[MN] + "[" + Memnoic.adAR1[MN] + "," + // Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x21: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opR[MN], Parameter = "[" + Mnemonic.adAR1[MN] + "," + Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]" }); //Result = Result + Memnoic.opR[MN] + "[" + Memnoic.adAR1[MN] + "," + // Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x22: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opZUW[MN], Parameter = "[" + Mnemonic.adAR1[MN] + "," + Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]" }); //Result = Result + Memnoic.opZUW[MN] + "[" + Memnoic.adAR1[MN] + "," + // Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x24: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opFP[MN], Parameter = "[" + Mnemonic.adAR1[MN] + "," + Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]" }); //Result = Result + Memnoic.opFP[MN] + "[" + Memnoic.adAR1[MN] + "," + // Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x25: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opFN[MN], Parameter = "[" + Mnemonic.adAR1[MN] + "," + Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]" }); //Result = Result + Memnoic.opFN[MN] + "[" + Memnoic.adAR1[MN] + "," + // Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x28: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opS[MN], Parameter = "[" + Mnemonic.adAR2[MN] + "," + Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]" }); //Result = Result + Memnoic.opS[MN] + "[" + Memnoic.adAR2[MN] + "," + // Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x29: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opR[MN], Parameter = "[" + Mnemonic.adAR2[MN] + "," + Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]" }); //Result = Result + Memnoic.opR[MN] + "[" + Memnoic.adAR2[MN] + "," + // Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x2A: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opZUW[MN], Parameter = "[" + Mnemonic.adAR2[MN] + "," + Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]" }); //Result = Result + Memnoic.opZUW[MN] + "[" + Memnoic.adAR2[MN] + "," + // Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x2C: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opFP[MN], Parameter = "[" + Mnemonic.adAR2[MN] + "," + Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]" }); //Result = Result + Memnoic.opFP[MN] + "[" + Memnoic.adAR2[MN] + "," + // Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x2D: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opFN[MN], Parameter = "[" + Mnemonic.adAR2[MN] + "," + Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]" }); //Result = Result + Memnoic.opFN[MN] + "[" + Memnoic.adAR2[MN] + "," + // Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) + "]"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x38: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opAUF[MN], Parameter = Mnemonic.adDB[MN] + "[" + Mnemonic.adMW[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) + "]" }); //Result = Result + Memnoic.opAUF[MN] + Memnoic.adDB[MN] + "[" + Memnoic.adMW[MN] + // Convert.ToString(Helper.GetWord(BD[pos + 2], BD[pos + 3])) + "]"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x39: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opAUF[MN], Parameter = Mnemonic.adDI[MN] + "[" + Mnemonic.adMW[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) + "]" }); //Result = Result + Memnoic.opAUF[MN] + Memnoic.adDI[MN] + "[" + Memnoic.adMW[MN] + // Convert.ToString(Helper.GetWord(BD[pos + 2], BD[pos + 3])) + "]"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x3C: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opL[MN], Parameter = Mnemonic.adDBLG[MN] }); //Result = Result + Memnoic.opL[MN] + Memnoic.adDBLG[MN]; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x3D: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opL[MN], Parameter = Mnemonic.adDILG[MN] }); //Result = Result + Memnoic.opL[MN] + Memnoic.adDILG[MN]; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x48: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opAUF[MN], Parameter = Mnemonic.adDB[MN] + "[" + Mnemonic.adDBW[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) + "]" }); //Result = Result + Memnoic.opAUF[MN] + Memnoic.adDB[MN] + "[" + Memnoic.adDBW[MN] + // Convert.ToString(Helper.GetWord(BD[pos + 2], BD[pos + 3])) + "]"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x49: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opAUF[MN], Parameter = Mnemonic.adDI[MN] + "[" + Mnemonic.adDBW[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) + "]" }); //Result = Result + Memnoic.opAUF[MN] + Memnoic.adDI[MN] + "[" + Memnoic.adDBW[MN] + // Convert.ToString(Helper.GetWord(BD[pos + 2], BD[pos + 3])) + "]"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x4C: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opL[MN], Parameter = Mnemonic.adDBNO[MN] }); //Result = Result + Memnoic.opL[MN] + Memnoic.adDBNO[MN]; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x4D: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opL[MN], Parameter = Mnemonic.adDINO[MN] }); //Result = Result + Memnoic.opL[MN] + Memnoic.adDINO[MN]; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x58: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opAUF[MN], Parameter = Mnemonic.adDB[MN] + "[" + Mnemonic.adDIW[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) + "]" }); //Result = Result + Memnoic.opAUF[MN] + Memnoic.adDB[MN] + "[" + Memnoic.adDIW[MN] + // Convert.ToString(Helper.GetWord(BD[pos + 2], BD[pos + 3])) + "]"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x59: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opAUF[MN], Parameter = Mnemonic.adDI[MN] + "[" + Mnemonic.adDIW[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) + "]" }); //Result = Result + Memnoic.opAUF[MN] + Memnoic.adDI[MN] + "[" + Memnoic.adDIW[MN] + // Convert.ToString(Helper.GetWord(BD[pos + 2], BD[pos + 3])) + "]"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x68: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opAUF[MN], Parameter = Mnemonic.adDB[MN] + "[" + Mnemonic.adLW[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) + "]" }); //Result = Result + Memnoic.opAUF[MN] + Memnoic.adDB[MN] + "[" + Memnoic.adLW[MN] + // Convert.ToString(Helper.GetWord(BD[pos + 2], BD[pos + 3])) + "]"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x69: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opAUF[MN], Parameter = Mnemonic.adDI[MN] + "[" + Mnemonic.adLW[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) + "]" }); //Result = Result + Memnoic.opAUF[MN] + Memnoic.adDI[MN] + "[" + Memnoic.adLW[MN] + // Convert.ToString(Helper.GetWord(BD[pos + 2], BD[pos + 3])) + "]"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x70: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opUC[MN], Parameter = Mnemonic.adFC[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3], BD[pos + 4], BD[pos + 5], BD[pos + 6], BD[pos + 7] }; //Get Parameter Count int paranz = (BD[pos + 7] / 2) - 1; List<string> tmplst = new List<string>(); for (int n = 1; n <= paranz; n++) { tmplst.Add(Helper.GetFCPointer(BD[pos + 8], BD[pos + 9], BD[pos + 10], BD[pos + 11])); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = Helper.CombineByteArray(((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7, new byte[] { BD[pos + 8], BD[pos + 9], BD[pos + 10], BD[pos + 11] }); pos += 4; } byte[] backup = ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).ExtParameter = tmplst; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = backup; pos += 8; } break; case 0x30: case 0x40: case 0x50: case 0x60: { string par = ""; switch (BD[pos + 1] & 0xf0) { case 0x30: par = Mnemonic.adMW[MN]; break; case 0x40: par = Mnemonic.adDBW[MN]; break; case 0x50: par = Mnemonic.adDIW[MN]; break; case 0x60: par = Mnemonic.adLW[MN]; break; } retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opUC[MN], Parameter = Mnemonic.adFC[MN] + "[" + par + Convert.ToString(libnodave.getU16from(BD, pos + 2)) + "]" }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3], BD[pos + 4], BD[pos + 5], BD[pos + 6], BD[pos + 7] }; //Get Parameter Count int paranz = (BD[pos + 7] / 2) - 1; List<string> tmplst = new List<string>(); for (int n = 1; n <= paranz; n++) { tmplst.Add(Helper.GetFCPointer(BD[pos + 8], BD[pos + 9], BD[pos + 10], BD[pos + 11])); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = Helper.CombineByteArray(((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7, new byte[] { BD[pos + 8], BD[pos + 9], BD[pos + 10], BD[pos + 11] }); pos += 4; } byte[] backup = ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).ExtParameter = tmplst; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = backup; pos += 8; } break; case 0x32: case 0x42: case 0x52: case 0x62: { string par = ""; switch (BD[pos + 1] & 0xf0) { case 0x30: par = Mnemonic.adMW[MN]; break; case 0x40: par = Mnemonic.adDBW[MN]; break; case 0x60: par = Mnemonic.adLW[MN]; break; case 0x50: par = Mnemonic.adDIW[MN]; break; } retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opUC[MN], Parameter = Mnemonic.adFB[MN] + "[" + par + Convert.ToString(libnodave.getU16from(BD, pos + 2)) + "]" }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x41: case 0x51: case 0x61: { string par = ""; switch (BD[pos + 1]) { case 0x61: par = Mnemonic.adLW[MN]; break; case 0x41: par = Mnemonic.adDBW[MN]; break; case 0x51: par = Mnemonic.adDIW[MN]; break; } retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opCC[MN], Parameter = Mnemonic.adFC[MN] + "[" + par + Convert.ToString(libnodave.getU16from(BD, pos + 2)) + "]" }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3], BD[pos + 4], BD[pos + 5], BD[pos + 6], BD[pos + 7] }; pos += 8; } break; case 0x43: case 0x53: case 0x63: { string par = ""; switch (BD[pos + 1] & 0xf0) { case 0x60: par = Mnemonic.adLW[MN]; break; case 0x40: par = Mnemonic.adDBW[MN]; break; case 0x50: par = Mnemonic.adDIW[MN]; break; } retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opCC[MN], Parameter = Mnemonic.adFB[MN] + "[" + par + Convert.ToString(libnodave.getU16from(BD, pos + 2)) + "]" }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x71: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opCC[MN], Parameter = Mnemonic.adFC[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3], BD[pos + 4], BD[pos + 5], BD[pos + 6], BD[pos + 7] }; pos += 8; } break; case 0x72: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opUC[MN], Parameter = Mnemonic.adFB[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x73: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opCC[MN], Parameter = Mnemonic.adFB[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x74: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opUC[MN], Parameter = Mnemonic.adSFC[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3], BD[pos + 4], BD[pos + 5], BD[pos + 6], BD[pos + 7] }; //Get Parameter Count int paranz = (BD[pos + 7] / 2) - 1; List<string> tmplst = new List<string>(); for (int n = 1; n <= paranz; n++) { tmplst.Add(Helper.GetFCPointer(BD[pos + 8], BD[pos + 9], BD[pos + 10], BD[pos + 11])); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = Helper.CombineByteArray(((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7, new byte[] { BD[pos + 8], BD[pos + 9], BD[pos + 10], BD[pos + 11] }); pos += 4; } byte[] backup = ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).ExtParameter = tmplst; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = backup; pos += 8; } break; case 0x76: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opUC[MN], Parameter = Mnemonic.adSFB[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x78: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opAUF[MN], Parameter = Mnemonic.adDB[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) }); //Result = Result + Memnoic.opAUF[MN] + Memnoic.adDB[MN] + // Convert.ToString(Helper.GetWord(BD[pos + 2], BD[pos + 3])); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x79: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opAUF[MN], Parameter = Mnemonic.adDI[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) }); //Result = Result + Memnoic.opAUF[MN] + Memnoic.adDI[MN] + // Convert.ToString(Helper.GetWord(BD[pos + 2], BD[pos + 3])); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x7C: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opTDB[MN] }); //Result = Result + Memnoic.opTDB[MN]; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x80: case 0xA0: case 0xB0: { string cmd = "", par = ""; cmd = Mnemonic.opU[MN]; if (ParaList.Count >= (libnodave.getU16from(BD, pos + 2) / 2) - 1) par = "#" + ParaList[(libnodave.getU16from(BD, pos + 2) / 2) - 1]; else par = "unkown parameter (" + Convert.ToString(libnodave.getU16from(BD, pos + 2)) + ")"; retVal.Add(new S7FunctionBlockRow() { Command = cmd, Parameter = par }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x81: case 0xA1: case 0xB1: { string cmd = "", par = ""; cmd = Mnemonic.opUN[MN]; if (ParaList.Count >= (libnodave.getU16from(BD, pos + 2) / 2) - 1) par = "#" + ParaList[(libnodave.getU16from(BD, pos + 2) / 2) - 1]; else par = "unkown parameter (" + Convert.ToString(libnodave.getU16from(BD, pos + 2)) + ")"; retVal.Add(new S7FunctionBlockRow() { Command = cmd, Parameter = par }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x82: case 0xA2: case 0xB2: { string cmd = "", par = ""; cmd = Mnemonic.opO[MN]; if (ParaList.Count >= (libnodave.getU16from(BD, pos + 2) / 2) - 1) par = "#" + ParaList[(libnodave.getU16from(BD, pos + 2) / 2) - 1]; else par = "unkown parameter (" + Convert.ToString(libnodave.getU16from(BD, pos + 2)) + ")"; retVal.Add(new S7FunctionBlockRow() { Command = cmd, Parameter = par }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x83: case 0xA3: case 0xB3: { string cmd = "", par = ""; cmd = Mnemonic.opON[MN]; if (ParaList.Count >= (libnodave.getU16from(BD, pos + 2) / 2) - 1) par = "#" + ParaList[(libnodave.getU16from(BD, pos + 2) / 2) - 1]; else par = "unkown parameter (" + Convert.ToString(libnodave.getU16from(BD, pos + 2)) + ")"; retVal.Add(new S7FunctionBlockRow() { Command = cmd, Parameter = par }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x84: case 0xA4: case 0xB4: { string cmd = "", par = ""; cmd = Mnemonic.opX[MN]; if (ParaList.Count >= (libnodave.getU16from(BD, pos + 2) / 2) - 1) par = "#" + ParaList[(libnodave.getU16from(BD, pos + 2) / 2) - 1]; else par = "unkown parameter (" + Convert.ToString(libnodave.getU16from(BD, pos + 2)) + ")"; retVal.Add(new S7FunctionBlockRow() { Command = cmd, Parameter = par }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x85: case 0xA5: case 0xB5: { string cmd = "", par = ""; cmd = Mnemonic.opXN[MN]; if (ParaList.Count >= (libnodave.getU16from(BD, pos + 2) / 2) - 1) par = "#" + ParaList[(libnodave.getU16from(BD, pos + 2) / 2) - 1]; else par = "unkown parameter (" + Convert.ToString(libnodave.getU16from(BD, pos + 2)) + ")"; retVal.Add(new S7FunctionBlockRow() { Command = cmd, Parameter = par }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x90: case 0xBB: { string cmd = "", par = ""; cmd = Mnemonic.opS[MN]; if (ParaList.Count >= (libnodave.getU16from(BD, pos + 2) / 2) - 1) par = "#" + ParaList[(libnodave.getU16from(BD, pos + 2) / 2) - 1]; else par = "unkown parameter (" + Convert.ToString(libnodave.getU16from(BD, pos + 2)) + ")"; retVal.Add(new S7FunctionBlockRow() { Command = cmd, Parameter = par }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x91: case 0xAF: case 0xBF: { string cmd = "", par = ""; cmd = Mnemonic.opR[MN]; if (ParaList.Count >= (libnodave.getU16from(BD, pos + 2) / 2) - 1) par = "#" + ParaList[(libnodave.getU16from(BD, pos + 2) / 2) - 1]; else par = "unkown parameter (" + Convert.ToString(libnodave.getU16from(BD, pos + 2)) + ")"; retVal.Add(new S7FunctionBlockRow() { Command = cmd, Parameter = par }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x92: { string cmd = "", par = ""; cmd = Mnemonic.opZUW[MN]; if (ParaList.Count >= (libnodave.getU16from(BD, pos + 2) / 2) - 1) par = "#" + ParaList[(libnodave.getU16from(BD, pos + 2) / 2) - 1]; else par = "unkown parameter (" + Convert.ToString(libnodave.getU16from(BD, pos + 2)) + ")"; retVal.Add(new S7FunctionBlockRow() { Command = cmd, Parameter = par }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x94: { string cmd = "", par = ""; cmd = Mnemonic.opFP[MN]; if (ParaList.Count >= (libnodave.getU16from(BD, pos + 2) / 2) - 1) par = "#" + ParaList[(libnodave.getU16from(BD, pos + 2) / 2) - 1]; else par = "unkown parameter (" + Convert.ToString(libnodave.getU16from(BD, pos + 2)) + ")"; retVal.Add(new S7FunctionBlockRow() { Command = cmd, Parameter = par }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x95: { string cmd = "", par = ""; cmd = Mnemonic.opFN[MN]; if (ParaList.Count >= (libnodave.getU16from(BD, pos + 2) / 2) - 1) par = "#" + ParaList[(libnodave.getU16from(BD, pos + 2) / 2) - 1]; else par = "unkown parameter (" + Convert.ToString(libnodave.getU16from(BD, pos + 2)) + ")"; retVal.Add(new S7FunctionBlockRow() { Command = cmd, Parameter = par }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0xA6: case 0xb6: case 0xc1: case 0xc2: case 0xc3: { string cmd = "", par = ""; cmd = Mnemonic.opL[MN]; if (ParaList.Count >= (libnodave.getU16from(BD, pos + 2) / 2) - 1) par = "#" + ParaList[(libnodave.getU16from(BD, pos + 2) / 2) - 1]; else par = "unkown parameter (" + Convert.ToString(libnodave.getU16from(BD, pos + 2)) + ")"; retVal.Add(new S7FunctionBlockRow() { Command = cmd, Parameter = par }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0xA8: case 0xb8: { string cmd = "", par = ""; cmd = Mnemonic.opFR[MN]; if (ParaList.Count >= (libnodave.getU16from(BD, pos + 2) / 2) - 1) par = "#" + ParaList[(libnodave.getU16from(BD, pos + 2) / 2) - 1]; else par = "unkown parameter (" + Convert.ToString(libnodave.getU16from(BD, pos + 2)) + ")"; retVal.Add(new S7FunctionBlockRow() { Command = cmd, Parameter = par }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0xA9: { string cmd = "", par = ""; cmd = Mnemonic.opLC[MN]; if (ParaList.Count >= (libnodave.getU16from(BD, pos + 2) / 2) - 1) par = "#" + ParaList[(libnodave.getU16from(BD, pos + 2) / 2) - 1]; else par = "unkown parameter (" + Convert.ToString(libnodave.getU16from(BD, pos + 2)) + ")"; retVal.Add(new S7FunctionBlockRow() { Command = cmd, Parameter = par }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0xAA: { string cmd = "", par = ""; cmd = Mnemonic.opSA[MN]; if (ParaList.Count >= (libnodave.getU16from(BD, pos + 2) / 2) - 1) par = "#" + ParaList[(libnodave.getU16from(BD, pos + 2) / 2) - 1]; else par = "unkown parameter (" + Convert.ToString(libnodave.getU16from(BD, pos + 2)) + ")"; retVal.Add(new S7FunctionBlockRow() { Command = cmd, Parameter = par }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0xAB: { string cmd = "", par = ""; cmd = Mnemonic.opSV[MN]; if (ParaList.Count >= (libnodave.getU16from(BD, pos + 2) / 2) - 1) par = "#" + ParaList[(libnodave.getU16from(BD, pos + 2) / 2) - 1]; else par = "unkown parameter (" + Convert.ToString(libnodave.getU16from(BD, pos + 2)) + ")"; retVal.Add(new S7FunctionBlockRow() { Command = cmd, Parameter = par }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0xAC: { string cmd = "", par = ""; cmd = Mnemonic.opSE[MN]; if (ParaList.Count >= (libnodave.getU16from(BD, pos + 2) / 2) - 1) par = "#" + ParaList[(libnodave.getU16from(BD, pos + 2) / 2) - 1]; else par = "unkown parameter (" + Convert.ToString(libnodave.getU16from(BD, pos + 2)) + ")"; retVal.Add(new S7FunctionBlockRow() { Command = cmd, Parameter = par }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0xAD: { string cmd = "", par = ""; cmd = Mnemonic.opSS[MN]; if (ParaList.Count >= (libnodave.getU16from(BD, pos + 2) / 2) - 1) par = "#" + ParaList[(libnodave.getU16from(BD, pos + 2) / 2) - 1]; else par = "unkown parameter (" + Convert.ToString(libnodave.getU16from(BD, pos + 2)) + ")"; retVal.Add(new S7FunctionBlockRow() { Command = cmd, Parameter = par }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0xAE: { string cmd = "", par = ""; cmd = Mnemonic.opSI[MN]; if (ParaList.Count >= (libnodave.getU16from(BD, pos + 2) / 2) - 1) par = "#" + ParaList[(libnodave.getU16from(BD, pos + 2) / 2) - 1]; else par = "unkown parameter (" + Convert.ToString(libnodave.getU16from(BD, pos + 2)) + ")"; retVal.Add(new S7FunctionBlockRow() { Command = cmd, Parameter = par }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0xBA: { string cmd = "", par = ""; cmd = Mnemonic.opZR[MN]; if (ParaList.Count >= (libnodave.getU16from(BD, pos + 2) / 2) - 1) par = "#" + ParaList[(libnodave.getU16from(BD, pos + 2) / 2) - 1]; else par = "unkown parameter (" + Convert.ToString(libnodave.getU16from(BD, pos + 2)) + ")"; retVal.Add(new S7FunctionBlockRow() { Command = cmd, Parameter = par }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0xBD: { string cmd = "", par = ""; cmd = Mnemonic.opZV[MN]; if (ParaList.Count >= (libnodave.getU16from(BD, pos + 2) / 2) - 1) par = "#" + ParaList[(libnodave.getU16from(BD, pos + 2) / 2) - 1]; else par = "unkown parameter (" + Convert.ToString(libnodave.getU16from(BD, pos + 2)) + ")"; retVal.Add(new S7FunctionBlockRow() { Command = cmd, Parameter = par }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0xC5: case 0xC6: case 0xC7: //case 0xCB: { string cmd = "", par = ""; cmd = Mnemonic.opT[MN]; if (ParaList.Count >= (libnodave.getU16from(BD, pos + 2) / 2) - 1) par = "#" + ParaList[(libnodave.getU16from(BD, pos + 2) / 2) - 1]; else par = "unkown parameter (" + Convert.ToString(libnodave.getU16from(BD, pos + 2)) + ")"; retVal.Add(new S7FunctionBlockRow() { Command = cmd, Parameter = par }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0xCA: case 0xCB: { string cmd = "", par = ""; cmd = Mnemonic.opL[MN]; if (ParaList.Count >= (libnodave.getU16from(BD, pos + 2) / 2) - 1) par = "P##" + ParaList[(libnodave.getU16from(BD, pos + 2) / 2) - 1]; else par = "unkown parameter (" + Convert.ToString(libnodave.getU16from(BD, pos + 2)) + ")"; retVal.Add(new S7FunctionBlockRow() { Command = cmd, Parameter = par }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0xD0: case 0xD2: { string cmd = "", par = ""; cmd = Mnemonic.opUC[MN]; if (ParaList.Count >= (libnodave.getU16from(BD, pos + 2) / 2) - 1) par = "#" + ParaList[(libnodave.getU16from(BD, pos + 2) / 2) - 1]; else par = "unkown parameter (" + Convert.ToString(libnodave.getU16from(BD, pos + 2)) + ")"; retVal.Add(new S7FunctionBlockRow() { Command = cmd, Parameter = par }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3], BD[pos + 4], BD[pos + 5], BD[pos + 6], BD[pos + 7] }; //Get Parameter Count int paranz = (BD[pos + 7] / 2) - 1; List<string> tmplst = new List<string>(); for (int n = 1; n <= paranz; n++) { tmplst.Add(Helper.GetFCPointer(BD[pos + 8], BD[pos + 9], BD[pos + 10], BD[pos + 11])); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = Helper.CombineByteArray(((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7, new byte[] { BD[pos + 8], BD[pos + 9], BD[pos + 10], BD[pos + 11] }); pos += 4; } byte[] backup = ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).ExtParameter = tmplst; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = backup; pos += 8; } break; case 0xD8: case 0xD9: { string cmd = "", par = ""; cmd = Mnemonic.opAUF[MN]; if (ParaList.Count >= (libnodave.getU16from(BD, pos + 2) / 2) - 1) par = "#" + ParaList[(libnodave.getU16from(BD, pos + 2) / 2) - 1]; else par = "unkown parameter (" + Convert.ToString(libnodave.getU16from(BD, pos + 2)) + ")"; retVal.Add(new S7FunctionBlockRow() { Command = cmd, Parameter = par }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0xE0: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opU[MN], Parameter = Mnemonic.adT[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) }); //Result = Result + Memnoic.opU[MN] + Memnoic.adT[MN] + // Convert.ToString(Helper.GetWord(BD[pos + 2], BD[pos + 3])); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0xE1: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opUN[MN], Parameter = Mnemonic.adT[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) }); //Result = Result + Memnoic.opUN[MN] + Memnoic.adT[MN] + // Convert.ToString(Helper.GetWord(BD[pos + 2], BD[pos + 3])); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0xE2: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opO[MN], Parameter = Mnemonic.adT[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) }); //Result = Result + Memnoic.opO[MN] + Memnoic.adT[MN] + // Convert.ToString(Helper.GetWord(BD[pos + 2], BD[pos + 3])); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0xE3: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opON[MN], Parameter = Mnemonic.adT[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) }); //Result = Result + Memnoic.opON[MN] + Memnoic.adT[MN] + // Convert.ToString(Helper.GetWord(BD[pos + 2], BD[pos + 3])); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0xE4: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opX[MN], Parameter = Mnemonic.adT[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) }); //Result = Result + Memnoic.opX[MN] + Memnoic.adT[MN] + // Convert.ToString(Helper.GetWord(BD[pos + 2], BD[pos + 3])); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0xE5: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opXN[MN], Parameter = Mnemonic.adT[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) }); //Result = Result + Memnoic.opXN[MN] + Memnoic.adT[MN] + // Convert.ToString(Helper.GetWord(BD[pos + 2], BD[pos + 3])); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0xE6: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opL[MN], Parameter = Mnemonic.adT[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) }); //Result = Result + Memnoic.opL[MN] + Memnoic.adT[MN] + // Convert.ToString(Helper.GetWord(BD[pos + 2], BD[pos + 3])); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0xE8: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opFR[MN], Parameter = Mnemonic.adT[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) }); //Result = Result + Memnoic.opFR[MN] + Memnoic.adT[MN] + // Convert.ToString(Helper.GetWord(BD[pos + 2], BD[pos + 3])); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0xE9: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opLC[MN], Parameter = Mnemonic.adT[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) }); //Result = Result + Memnoic.opLC[MN] + Memnoic.adT[MN] + // Convert.ToString(Helper.GetWord(BD[pos + 2], BD[pos + 3])); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0xEA: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opSA[MN], Parameter = Mnemonic.adT[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) }); //Result = Result + Memnoic.opSA[MN] + Memnoic.adT[MN] + // Convert.ToString(Helper.GetWord(BD[pos + 2], BD[pos + 3])); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0xEB: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opSV[MN], Parameter = Mnemonic.adT[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) }); //Result = Result + Memnoic.opSV[MN] + Memnoic.adT[MN] + // Convert.ToString(Helper.GetWord(BD[pos + 2], BD[pos + 3])); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0xEC: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opSE[MN], Parameter = Mnemonic.adT[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) }); //Result = Result + Memnoic.opSE[MN] + Memnoic.adT[MN] + // Convert.ToString(Helper.GetWord(BD[pos + 2], BD[pos + 3])); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0xED: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opSS[MN], Parameter = Mnemonic.adT[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) }); //Result = Result + Memnoic.opSS[MN] + Memnoic.adT[MN] + // Convert.ToString(Helper.GetWord(BD[pos + 2], BD[pos + 3])); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0xEE: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opSI[MN], Parameter = Mnemonic.adT[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) }); //Result = Result + Memnoic.opSI[MN] + Memnoic.adT[MN] + // Convert.ToString(Helper.GetWord(BD[pos + 2], BD[pos + 3])); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0xEF: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opR[MN], Parameter = Mnemonic.adT[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) }); //Result = Result + Memnoic.opR[MN] + Memnoic.adT[MN] + // Convert.ToString(Helper.GetWord(BD[pos + 2], BD[pos + 3])); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0xF0: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opU[MN], Parameter = Mnemonic.adZ[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) }); //Result = Result + Memnoic.opU[MN] + Memnoic.adZ[MN] + // Convert.ToString(Helper.GetWord(BD[pos + 2], BD[pos + 3])); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0xF1: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opUN[MN], Parameter = Mnemonic.adZ[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) }); //Result = Result + Memnoic.opUN[MN] + Memnoic.adZ[MN] + // Convert.ToString(Helper.GetWord(BD[pos + 2], BD[pos + 3])); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0xF2: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opO[MN], Parameter = Mnemonic.adZ[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) }); //Result = Result + Memnoic.opO[MN] + Memnoic.adZ[MN] + // Convert.ToString(Helper.GetWord(BD[pos + 2], BD[pos + 3])); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0xF3: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opON[MN], Parameter = Mnemonic.adZ[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) }); //Result = Result + Memnoic.opON[MN] + Memnoic.adZ[MN] + // Convert.ToString(Helper.GetWord(BD[pos + 2], BD[pos + 3])); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0xF4: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opX[MN], Parameter = Mnemonic.adZ[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) }); //Result = Result + Memnoic.opX[MN] + Memnoic.adZ[MN] + // Convert.ToString(Helper.GetWord(BD[pos + 2], BD[pos + 3])); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0xF5: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opXN[MN], Parameter = Mnemonic.adZ[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) }); //Result = Result + Memnoic.opXN[MN] + Memnoic.adZ[MN] + // Convert.ToString(Helper.GetWord(BD[pos + 2], BD[pos + 3])); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0xF8: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opFR[MN], Parameter = Mnemonic.adZ[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) }); //Result = Result + Memnoic.opFR[MN] + Memnoic.adZ[MN] + // Convert.ToString(Helper.GetWord(BD[pos + 2], BD[pos + 3])); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0xFA: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opZR[MN], Parameter = Mnemonic.adZ[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) }); //Result = Result + Memnoic.opZR[MN] + Memnoic.adZ[MN] + // Convert.ToString(Helper.GetWord(BD[pos + 2], BD[pos + 3])); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0xFB: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opS[MN], Parameter = Mnemonic.adZ[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) }); //Result = Result + Memnoic.opS[MN] + Memnoic.adZ[MN] + // Convert.ToString(Helper.GetWord(BD[pos + 2], BD[pos + 3])); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0xfd: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opZV[MN], Parameter = Mnemonic.adZ[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) }); //Result = Result + Memnoic.opZV[MN] + Memnoic.adZ[MN] + // Convert.ToString(Helper.GetWord(BD[pos + 2], BD[pos + 3])); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0xFF: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opR[MN], Parameter = Mnemonic.adZ[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) }); //Result = Result + Memnoic.opR[MN] + Memnoic.adZ[MN] + // Convert.ToString(Helper.GetWord(BD[pos + 2], BD[pos + 3])); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; default: retVal.Add(new S7FunctionBlockRow() { Command = "errd" }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; break; } } break; case 0xFC: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opUN[MN], Parameter = Mnemonic.adT[MN] + Convert.ToString(BD[pos + 1]) }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; break; case 0xFD: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opON[MN], Parameter = Mnemonic.adT[MN] + Convert.ToString(BD[pos + 1]) }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; break; case 0xFE: { switch (BD[pos + 1]) { case 0x01: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opLAR1[MN], Parameter = Mnemonic.adAR2[MN] }); //Result = Result + Memnoic.opLAR1[MN] + Memnoic.adAR2[MN]; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x02: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opPAR1[MN], Parameter = Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) }); //Result = Result + Memnoic.opPAR1[MN] + // Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x03: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opLAR1[MN], Parameter = Helper.GetPointer(BD, pos + 2, MN) }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3], BD[pos + 4], BD[pos + 5] }; pos += 6; } break; case 0x04: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opLAR1[MN] }); //Result = Result + Memnoic.opLAR1[MN]; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x05: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opTAR1[MN] }); //Result = Result + Memnoic.opTAR1[MN]; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x06: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opPAR1[MN] }); //Result = Result + Memnoic.opPAR1[MN]; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x08: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opTAR[MN] }); //Result = Result + Memnoic.opTAR[MN]; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x09: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opTAR1[MN], Parameter = Mnemonic.adAR2[MN] }); //Result = Result + Memnoic.opTAR1[MN] + Memnoic.adAR2[MN]; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x0A: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opPAR2[MN], Parameter = Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]) }); //Result = Result + Memnoic.opPAR2[MN] + // Helper.GetShortPointer(BD[pos + 2], BD[pos + 3]); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x0b: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opLAR2[MN], Parameter = Helper.GetPointer(BD, pos + 2, MN) }); //Result = Result + Memnoic.opLAR2[MN] + // Helper.GetPointer(BD[pos + 2], BD[pos + 3], BD[pos + 4], // BD[pos + 5]); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3], BD[pos + 4], BD[pos + 5] }; pos += 6; } break; case 0x0C: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opLAR2[MN] }); //Result = Result + Memnoic.opLAR2[MN]; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x0D: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opTAR2[MN] }); //Result = Result + Memnoic.opTAR2[MN]; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x0E: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opPAR2[MN] }); //Result = Result + Memnoic.opPAR2[MN]; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x33: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opLAR1[MN], Parameter = Mnemonic.adMD[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x37: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opTAR1[MN], Parameter = Mnemonic.adMD[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) }); //Result = Result + Memnoic.opTAR1[MN] + Memnoic.adMD[MN] + // Convert.ToString(Helper.GetWord(BD[pos + 2], BD[pos + 3])); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x3b: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opLAR2[MN], Parameter = Mnemonic.adMD[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) }); //Result = Result + Memnoic.opLAR2[MN] + Memnoic.adMD[MN] + // Convert.ToString(Helper.GetWord(BD[pos + 2], BD[pos + 3])); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x3F: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opTAR2[MN], Parameter = Mnemonic.adMD[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) }); //Result = Result + Memnoic.opTAR2[MN] + Memnoic.adMD[MN] + // Convert.ToString(Helper.GetWord(BD[pos + 2], BD[pos + 3])); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x43: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opLAR1[MN], Parameter = Mnemonic.adDBD[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) }); //Result = Result + Memnoic.opLAR1[MN] + Memnoic.adDBD[MN] + // Convert.ToString(Helper.GetWord(BD[pos + 2], BD[pos + 3])); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x47: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opTAR1[MN], Parameter = Mnemonic.adDBD[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) }); //Result = Result + Memnoic.opTAR1[MN] + Memnoic.adDBD[MN] + // Convert.ToString(Helper.GetWord(BD[pos + 2], BD[pos + 3])); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x4b: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opLAR2[MN], Parameter = Mnemonic.adDBD[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) }); //Result = Result + Memnoic.opLAR2[MN] + Memnoic.adDBD[MN] + // Convert.ToString(Helper.GetWord(BD[pos + 2], BD[pos + 3])); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x4F: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opTAR2[MN], Parameter = Mnemonic.adDBD[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) }); //Result = Result + Memnoic.opTAR2[MN] + Memnoic.adDBD[MN] + // Convert.ToString(Helper.GetWord(BD[pos + 2], BD[pos + 3])); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x53: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opLAR1[MN], Parameter = Mnemonic.adDID[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) }); //Result = Result + Memnoic.opLAR1[MN] + Memnoic.adDID[MN] + // Convert.ToString(Helper.GetWord(BD[pos + 2], BD[pos + 3])); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x57: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opTAR1[MN], Parameter = Mnemonic.adDID[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) }); //Result = Result + Memnoic.opTAR1[MN] + Memnoic.adDID[MN] + // Convert.ToString(Helper.GetWord(BD[pos + 2], BD[pos + 3])); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x5b: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opLAR2[MN], Parameter = Mnemonic.adDID[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) }); //Result = Result + Memnoic.opLAR2[MN] + Memnoic.adDID[MN] + // Convert.ToString(Helper.GetWord(BD[pos + 2], BD[pos + 3])); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x5F: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opTAR2[MN], Parameter = Mnemonic.adDID[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) }); //Result = Result + Memnoic.opTAR2[MN] + Memnoic.adDID[MN] + // Convert.ToString(Helper.GetWord(BD[pos + 2], BD[pos + 3])); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x63: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opLAR1[MN], Parameter = Mnemonic.adLD[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) }); //Result = Result + Memnoic.opLAR1[MN] + Memnoic.adLD[MN] + // Convert.ToString(Helper.GetWord(BD[pos + 2], BD[pos + 3])); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x67: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opTAR1[MN], Parameter = Mnemonic.adLD[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) }); //Result = Result + Memnoic.opTAR1[MN] + Memnoic.adLD[MN] + // Convert.ToString(Helper.GetWord(BD[pos + 2], BD[pos + 3])); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x6b: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opLAR2[MN], Parameter = Mnemonic.adLD[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) }); //Result = Result + Memnoic.opLAR2[MN] + Memnoic.adLD[MN] + // Convert.ToString(Helper.GetWord(BD[pos + 2], BD[pos + 3])); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x6F: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opTAR2[MN], Parameter = Mnemonic.adLD[MN] + Convert.ToString(libnodave.getU16from(BD, pos + 2)) }); //Result = Result + Memnoic.opTAR2[MN] + Memnoic.adLD[MN] + // Convert.ToString(Helper.GetWord(BD[pos + 2], BD[pos + 3])); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0xC0: case 0xD0: case 0xE0: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opSRD[MN], Parameter = Convert.ToString(BD[pos + 1] - 0xC0) }); //Result = Result + Memnoic.opSRD[MN] + Convert.ToString(BD[pos + 1] - 0xC0); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; break; default: switch (BD[pos + 1] & 0xf0) { case 0xC0: case 0xD0: case 0xE0: retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opSRD[MN], Parameter = Convert.ToString(BD[pos + 1] - 0xC0) }); //Result = Result + Memnoic.opSRD[MN] + Convert.ToString(BD[pos + 1] - 0xC0); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; break; default: retVal.Add(new S7FunctionBlockRow() { Command = "err 99" }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; break; } break; } } break; case 0xFF: { switch (BD[pos + 1]) { case 0x00: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opU[MN], Parameter = Mnemonic.adOS[MN] }); //Result = Result + Memnoic.opU[MN] + Memnoic.adOS[MN]; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x01: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opUN[MN], Parameter = Mnemonic.adOS[MN] }); //Result = Result + Memnoic.opUN[MN] + Memnoic.adOS[MN]; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x02: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opO[MN], Parameter = Mnemonic.adOS[MN] }); //Result = Result + Memnoic.opO[MN] + Memnoic.adOS[MN]; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x03: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opON[MN], Parameter = Mnemonic.adOS[MN] }); //Result = Result + Memnoic.opON[MN] + Memnoic.adOS[MN]; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x04: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opX[MN], Parameter = Mnemonic.adOS[MN] }); //Result = Result + Memnoic.opX[MN] + Memnoic.adOS[MN]; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x05: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opXN[MN], Parameter = Mnemonic.adOS[MN] }); //Result = Result + Memnoic.opXN[MN] + Memnoic.adOS[MN]; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x08: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opSPS[MN], JumpWidth = libnodave.getS16from(BD, pos + 2) }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x10: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opU[MN], Parameter = Mnemonic.adOV[MN] }); //Result = Result + Memnoic.opU[MN] + Memnoic.adOV[MN]; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x11: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opUN[MN], Parameter = Mnemonic.adOV[MN] }); //Result = Result + Memnoic.opUN[MN] + Memnoic.adOV[MN]; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x12: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opO[MN], Parameter = Mnemonic.adOV[MN] }); //Result = Result + Memnoic.opO[MN] + Memnoic.adOV[MN]; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x13: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opON[MN], Parameter = Mnemonic.adOV[MN] }); //Result = Result + Memnoic.opON[MN] + Memnoic.adOV[MN]; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x14: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opX[MN], Parameter = Mnemonic.adOV[MN] }); //Result = Result + Memnoic.opX[MN] + Memnoic.adOV[MN]; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x15: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opXN[MN], Parameter = Mnemonic.adOV[MN] }); //Result = Result + Memnoic.opXN[MN] + Memnoic.adOV[MN]; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x18: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opSPO[MN], JumpWidth = libnodave.getS16from(BD, pos + 2) }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x20: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opU[MN], Parameter = ">0" }); //Result = Result + Memnoic.opU[MN] + ">0"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x21: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opUN[MN], Parameter = ">0" }); //Result = Result + Memnoic.opUN[MN] + ">0"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x22: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opO[MN], Parameter = ">0" }); //Result = Result + Memnoic.opO[MN] + ">0"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x23: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opON[MN], Parameter = ">0" }); //Result = Result + Memnoic.opON[MN] + ">0"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x24: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opX[MN], Parameter = ">0" }); //Result = Result + Memnoic.opX[MN] + ">0"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x25: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opXN[MN], Parameter = ">0" }); //Result = Result + Memnoic.opXN[MN] + ">0"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x28: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opSPP[MN], JumpWidth = libnodave.getS16from(BD, pos + 2) }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x40: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opU[MN], Parameter = "<0" }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x41: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opUN[MN], Parameter = "<0" }); //Result = Result + Memnoic.opUN[MN] + "<0"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x42: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opO[MN], Parameter = "<0" }); //Result = Result + Memnoic.opO[MN] + "<0"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x43: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opON[MN], Parameter = "<0" }); //Result = Result + Memnoic.opON[MN] + "<0"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x44: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opX[MN], Parameter = "<0" }); //Result = Result + Memnoic.opX[MN] + "<0"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x45: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opXN[MN], Parameter = "<0" }); //Result = Result + Memnoic.opXN[MN] + "<0"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x48: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opSPM[MN], JumpWidth = libnodave.getS16from(BD, pos + 2) }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x50: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opU[MN], Parameter = Mnemonic.adUO[MN] }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x51: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opUN[MN], Parameter = Mnemonic.adUO[MN] }); //Result = Result + Memnoic.opUN[MN] + Memnoic.adUO[MN]; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x52: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opO[MN], Parameter = Mnemonic.adUO[MN] }); //Result = Result + Memnoic.opO[MN] + Memnoic.adUO[MN]; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x53: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opON[MN], Parameter = Mnemonic.adUO[MN] }); //Result = Result + Memnoic.opON[MN] + Memnoic.adUO[MN]; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x54: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opX[MN], Parameter = Mnemonic.adUO[MN] }); //Result = Result + Memnoic.opX[MN] + Memnoic.adUO[MN]; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x55: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opXN[MN], Parameter = Mnemonic.adUO[MN] }); //Result = Result + Memnoic.opXN[MN] + Memnoic.adUO[MN]; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x58: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opSPU[MN], JumpWidth = libnodave.getS16from(BD, pos + 2) }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x60: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opU[MN], Parameter = "<>0" }); //Result = Result + Memnoic.opU[MN] + "<>0"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x61: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opUN[MN], Parameter = "<>0" }); //Result = Result + Memnoic.opUN[MN] + "<>0"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x62: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opO[MN], Parameter = "<>0" }); //Result = Result + Memnoic.opO[MN] + "<>0"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x63: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opON[MN], Parameter = "<>0" }); //Result = Result + Memnoic.opON[MN] + "<>0"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x64: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opX[MN], Parameter = "<>0" }); //Result = Result + Memnoic.opX[MN] + "<>0"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x65: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opXN[MN], Parameter = "<>0" }); //Result = Result + Memnoic.opXN[MN] + "<>0"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x68: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opSPN[MN], JumpWidth = libnodave.getS16from(BD, pos + 2) }); //Result = Result + Memnoic.opSPN[MN] + "(Springe " + // Helper.JumpStr(Helper.GetInt(BD[pos + 2], BD[pos + 3])) + " W)"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x78: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opSPBIN[MN], JumpWidth = libnodave.getS16from(BD, pos + 2) }); //Result = Result + Memnoic.opSPBIN[MN] + "(Springe " + // Helper.JumpStr(Helper.GetInt(BD[pos + 2], BD[pos + 3])) + " W)"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x80: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opU[MN], Parameter = "==0" }); //Result = Result + Memnoic.opU[MN] + "==0"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x81: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opUN[MN], Parameter = "==0" }); //Result = Result + Memnoic.opUN[MN] + "==0"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x82: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opO[MN], Parameter = "==0" }); //Result = Result + Memnoic.opO[MN] + "==0"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x83: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opON[MN], Parameter = "==0" }); //Result = Result + Memnoic.opON[MN] + "==0"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x84: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opX[MN], Parameter = "==0" }); //Result = Result + Memnoic.opX[MN] + "==0"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x85: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opXN[MN], Parameter = "==0" }); //Result = Result + Memnoic.opXN[MN] + "==0"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0x88: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opSPZ[MN], JumpWidth = libnodave.getS16from(BD, pos + 2) }); //Result = Result + Memnoic.opSPZ[MN] + "(Springe " + // Helper.JumpStr(Helper.GetInt(BD[pos + 2], BD[pos + 3])) + " W)"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0x98: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opSPBNB[MN], JumpWidth = libnodave.getS16from(BD, pos + 2) }); //Result = Result + Memnoic.opSPBNB[MN] + "(Springe " + // Helper.JumpStr(Helper.GetInt(BD[pos + 2], BD[pos + 3])) + " W)"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0xA0: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opU[MN], Parameter = ">=0" }); //Result = Result + Memnoic.opU[MN] + ">=0"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0xA1: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opUN[MN], Parameter = ">=0" }); //Result = Result + Memnoic.opUN[MN] + ">=0"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0xA2: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opO[MN], Parameter = ">=0" }); //Result = Result + Memnoic.opO[MN] + ">=0"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0xA3: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opON[MN], Parameter = ">=0" }); //Result = Result + Memnoic.opON[MN] + ">=0"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0xA4: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opX[MN], Parameter = ">=0" }); //Result = Result + Memnoic.opX[MN] + ">=0"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0xA5: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opXN[MN], Parameter = ">=0" }); //Result = Result + Memnoic.opXN[MN] + ">=0"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0xA8: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opSPPZ[MN], JumpWidth = libnodave.getS16from(BD, pos + 2) }); //Result = Result + Memnoic.opSPPZ[MN] + "(Springe " + // Helper.JumpStr(Helper.GetInt(BD[pos + 2], BD[pos + 3])) + " W)"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0xB8: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opSPBN[MN], JumpWidth = libnodave.getS16from(BD, pos + 2) }); //Result = Result + Memnoic.opSPBN[MN] + "(Springe " + // Helper.JumpStr(Helper.GetInt(BD[pos + 2], BD[pos + 3])) + " W)"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0xC0: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opU[MN], Parameter = "<=0" }); //Result = Result + Memnoic.opU[MN] + "<=0"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0xC1: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opUN[MN], Parameter = "<=0" }); //Result = Result + Memnoic.opUN[MN] + "<=0"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0xC2: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opO[MN], Parameter = "<=0" }); //Result = Result + Memnoic.opO[MN] + "<=0"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0xC3: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opON[MN], Parameter = "<=0" }); //Result = Result + Memnoic.opON[MN] + "<=0"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0xC4: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opX[MN], Parameter = "<=0" }); //Result = Result + Memnoic.opX[MN] + "<=0"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0xC5: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opXN[MN], Parameter = "<=0" }); //Result = Result + Memnoic.opXN[MN] + "<=0"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0xC8: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opSPMZ[MN], JumpWidth = libnodave.getS16from(BD, pos + 2) }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0xD8: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opSPBB[MN], JumpWidth = libnodave.getS16from(BD, pos + 2) }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0xE0: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opU[MN], Parameter = Mnemonic.adBIE[MN] }); //Result = Result + Memnoic.opU[MN] + Memnoic.adBIE[MN]; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0xE1: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opUN[MN], Parameter = Mnemonic.adBIE[MN] }); //Result = Result + Memnoic.opUN[MN] + Memnoic.adBIE[MN]; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0xE2: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opO[MN], Parameter = Mnemonic.adBIE[MN] }); //Result = Result + Memnoic.opO[MN] + Memnoic.adBIE[MN]; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0xE3: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opON[MN], Parameter = Mnemonic.adBIE[MN] }); //Result = Result + Memnoic.opON[MN] + Memnoic.adBIE[MN]; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0xE4: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opX[MN], Parameter = Mnemonic.adBIE[MN] }); //Result = Result + Memnoic.opX[MN] + Memnoic.adBIE[MN]; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0xE5: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opXN[MN], Parameter = Mnemonic.adBIE[MN] }); //Result = Result + Memnoic.opXN[MN] + Memnoic.adBIE[MN]; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0xE8: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opSPBI[MN], JumpWidth = libnodave.getS16from(BD, pos + 2) }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0xF8: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opSPB[MN], JumpWidth = libnodave.getS16from(BD, pos + 2) }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; } break; case 0xF1: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opUNO[MN], }); //Result = Result + Memnoic.opUNO[MN]; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0xF3: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opONO[MN], }); //Result = Result + Memnoic.opONO[MN]; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0xF4: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opXO[MN], }); //Result = Result + Memnoic.opXO[MN]; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0xF5: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opXNO[MN], }); //Result = Result + Memnoic.opXNO[MN]; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; case 0xFF: { retVal.Add(new S7FunctionBlockRow() { Command = Mnemonic.opNOP[MN], Parameter = "1" }); //Result = Result + Memnoic.opNOP[MN] + "1"; ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; } break; default: retVal.Add(new S7FunctionBlockRow() { Command = "errf" }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1], BD[pos + 2], BD[pos + 3] }; pos += 4; break; } } break; default: retVal.Add(new S7FunctionBlockRow() { Command = "err7" }); ((S7FunctionBlockRow)retVal[retVal.Count - 1]).MC7 = new byte[] { BD[pos], BD[pos + 1] }; pos += 2; break; } //Result = Result + "\r\n"; } if (Networks != null) NetWork.NetworkCheck(ref Networks, ref retVal, ref counter, oldpos, pos, ref NWNr); //Go throug retval and add Symbols... /*if (prjBlkFld != null) { if (prjBlkFld.SymbolTable != null) { foreach (S7FunctionBlockRow awlRow in retVal) { string para = awlRow.Parameter.Replace(" ", ""); awlRow.SymbolTableEntry = prjBlkFld.SymbolTable.GetEntryFromOperand(para); } } }*/ //Go throug retval and add Symbols... { foreach (S7FunctionBlockRow awlRow in retVal) { awlRow.Parent = block; } } /* //Use the Jump-Marks from the Step7 project.... string[] jumpNames = null; int cntJ = 0; if (JumpMarks!=null) { string aa = System.Text.Encoding.GetEncoding("ISO-8859-1").GetString(JumpMarks); int anzJ = JumpMarks[4] + JumpMarks[5]*0x100; jumpNames = new string[anzJ]; for (int n = 6; n < JumpMarks.Length; n++) { if (JumpMarks[n] != 0 && cntJ < anzJ) { if (jumpNames[cntJ] == null) jumpNames[cntJ] = ""; jumpNames[cntJ] = jumpNames[cntJ] + (char) JumpMarks[n]; } else cntJ++; } cntJ = 0; } */ //Build the Jumps: Create a List with the Addresses, Look for Jumps, Add Jump Marks int JumpCount = 0; int akBytePos = 0; Dictionary<int, S7FunctionBlockRow> ByteAdressNumerPLCFunctionBlocks = new Dictionary<int, S7FunctionBlockRow>(); foreach (S7FunctionBlockRow tmp in retVal) { if (tmp.ByteSize > 0) { ByteAdressNumerPLCFunctionBlocks.Add(akBytePos, tmp); akBytePos += tmp.ByteSize; } } akBytePos = 0; foreach (S7FunctionBlockRow tmp in retVal) { if (Helper.IsJump(tmp, MN)) { int jmpBytePos = 0; if (tmp.Command == Mnemonic.opSPL[MN]) jmpBytePos = akBytePos + ((tmp.JumpWidth + 1) * 4); else jmpBytePos = akBytePos + (tmp.JumpWidth * 2); if (ByteAdressNumerPLCFunctionBlocks.ContainsKey(jmpBytePos)) { var target = ByteAdressNumerPLCFunctionBlocks[jmpBytePos]; if (target.Label == "") { target.Label = "M" + JumpCount.ToString().PadLeft(3, '0'); JumpCount++; } //Backup the MC7 Code, because the MC7 Code is always deleted when the command or parameter changes! byte[] backup = tmp.MC7; tmp.Parameter = target.Label; tmp.MC7 = backup; } else { byte[] backup = tmp.MC7; tmp.Parameter = "Error! JumpWidth :" + tmp.JumpWidth; tmp.MC7 = backup; } } akBytePos += tmp.ByteSize; } //End Building of the Jumps.*/ return retVal; }