Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ public Block GetBlock(string BlockName)

internal S5ProjectBlockInfo GetBlockInfo(string BlockName)
{
var nm = BlockName.Replace(" ", "");
//Callers pass both "FB1" and "S5_FB1"; the comparison below is without the "S5_" prefix
var nm = BlockName.Replace(" ", "").Replace("S5_", "");

lock (step5BlocksinfoList)
{
Expand Down
2 changes: 1 addition & 1 deletion LibNoDaveConnectionLibrary/PLCs/S5/MC5/MC5LIB_SYMTAB.cs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ static class MC5LIB_SYMTAB
new object[] {0x5B80, 0x0000, 9, 7, 0xff80, 0x007f, "T", "AD", "PrintNummer",ReferenceDataAccessMode.Write},
new object[] {0x5C00, 0x0000, 8, 8, 0xff00, 0x00ff, "S", "Z", "PrintNummer",ReferenceDataAccessMode.Write},
new object[] {0x5D00, 0x0000, 8, 8, 0xff00, 0x00ff, "SPB", "SB", "PrintNummer",ReferenceDataAccessMode.Call},
new object[] {0x5F00, 0x0000, 8, 6, 0xff00, 0x00ff, "L", "QB", "PrintNummer",ReferenceDataAccessMode.Read},
new object[] {0x5F00, 0x0000, 8, 8, 0xff00, 0x00ff, "L", "QB", "PrintNummer",ReferenceDataAccessMode.Read},
new object[] {0x6000, 0x0000, 16, 0, 0xffff, 0x0000, ":F", null, null,ReferenceDataAccessMode.None},
new object[] {0x6003, 0x0000, 16, 0, 0xffff, 0x0000, ":G", null, null,ReferenceDataAccessMode.None},
new object[] {0x6004, 0x0000, 16, 0, 0xffff, 0x0000, "xF", null, null,ReferenceDataAccessMode.None},
Expand Down
2 changes: 2 additions & 0 deletions LibNoDaveConnectionLibrary/PLCs/S5/MC5/MC5toDB.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ public static S5DataBlock GetDB(ProjectPlcBlockInfo blkInfo, byte[] block, byte[
{
s7DataRow = new S7DataRow(string.Empty, S7DataRowType.S5_KH, retVal);
main.Add(s7DataRow);
//Rows not described by a pre-header are still referenced by line number in the comment block
zeilenListe.Add(s7DataRow);
}

switch (s7DataRow.DataType)
Expand Down
8 changes: 8 additions & 0 deletions LibNoDaveConnectionLibrary/Projectfiles/Step5Project.cs
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,16 @@ protected override void LoadProject()
int len = 0;

ByteAddressOFExistingBlocks.Add(n);
int blockStart = n;
var tmp = AddBlockInfo(s5ProjectByteArray, ref n, blkFld,
bstHeaders[akanz - 1]);

//Comment blocks (PK, FK, DK, ...) can carry the type byte of their parent block (PB, FB, DB, ...),
//so they would be read as a second PB, FB, DB. The type of the section they are stored in is the real one.
int blockTypeByte = s5ProjectByteArray[blockStart] == 0x70 ? s5ProjectByteArray[blockStart + 2] : s5ProjectByteArray[blockStart];
if (tmp != null && blockTypeByte != section_header_type)
tmp.BlockType = (PLCBlockType)(section_header_type | 0xf00);

if (tmp != null)
blkFld.step5BlocksinfoList.Add(tmp);

Expand Down
Loading