Data Blocks in Siemens Posted 28 Dec 2015 Hi, I am relative new to plc, and was wondering in anyone could explain the data block adressing below? If you use #IndexDB = 50 and #IndexByte = 226. L #IndexDB //Load first DB number in data area T #DB_Source L 200 //The start byte number in Workspace DB T #Word_Dest L 20 T #DB_Dest L 10 //10 DB is to be copied MrkA: T #Loop_Counter L #IndexByte T #Source_Word L #Source_Word SLD 3 T #Source_Word L #Word_Dest T #Dest_Word L #Dest_Word SLD 3 T #Dest_Word L 2 next: T #Loop_Counter1 OPN DB[#DB_Source] L DBW[#Source_Word] OPN DB[#DB_Dest] T DBW[#Dest_Word] L #Source_Word L P#2.0 +D T #Source_Word L #Dest_Word L P#2.0 +D T #Dest_Word L #Loop_Counter1 LOOP next L #DB_Source //Increment Active DB number by one L 1 +I T #DB_Source L #Word_Dest //Increment Active Word number by Length L 2 //(2 x Length because off Byte number) +I L 2 +I T #Word_Dest L #Loop_Counter LOOP MrkA //Loop 10 times for 10 DB´s Thank you.
Data Blocks
in Siemens
Posted
Hi,
I am relative new to plc, and was wondering in anyone could explain the data block adressing below?
If you use #IndexDB = 50 and #IndexByte = 226.
L #IndexDB //Load first DB number in data area
T #DB_Source
L 200 //The start byte number in Workspace DB
T #Word_Dest
L 20
T #DB_Dest
L 10 //10 DB is to be copied
MrkA: T #Loop_Counter
L #IndexByte
T #Source_Word
L #Source_Word
SLD 3
T #Source_Word
L #Word_Dest
T #Dest_Word
L #Dest_Word
SLD 3
T #Dest_Word
L 2
next: T #Loop_Counter1
OPN DB[#DB_Source]
L DBW[#Source_Word]
OPN DB[#DB_Dest]
T DBW[#Dest_Word]
L #Source_Word
L P#2.0
+D
T #Source_Word
L #Dest_Word
L P#2.0
+D
T #Dest_Word
L #Loop_Counter1
LOOP next
L #DB_Source //Increment Active DB number by one
L 1
+I
T #DB_Source
L #Word_Dest //Increment Active Word number by Length
L 2 //(2 x Length because off Byte number)
+I
L 2
+I
T #Word_Dest
L #Loop_Counter
LOOP MrkA //Loop 10 times for 10 DB´s
Thank you.