0% found this document useful (0 votes)
58 views

FC7 - : Name Data Typ Address Comment

This document contains the code for a program that parses string data from commands. It takes incoming strings, identifies substrings separated by commas, copies the substrings to variables, and adjusts counters to track string lengths. The program contains code to parse strings from three commands - GID, GLE and GSV - by identifying substrings like UNIT_ID, FIRM_REV, CNTL_ERR, SPEED and TORQUE.

Uploaded by

sivasubramanianM
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
58 views

FC7 - : Name Data Typ Address Comment

This document contains the code for a program that parses string data from commands. It takes incoming strings, identifies substrings separated by commas, copies the substrings to variables, and adjusts counters to track string lengths. The program contains code to parse strings from three commands - GID, GLE and GSV - by identifying substrings like UNIT_ID, FIRM_REV, CNTL_ERR, SPEED and TORQUE.

Uploaded by

sivasubramanianM
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

Siemens S7

S79/15/2006 12:09:01 PM CRI\CRI_PLC\CPU 314C-2 PtP\...\FC7 - <offline>

FC7 - <offline>
"String Parsing" Name: STRNG_P Author: CJG Parse Incoming Strings Family: CP_BSP Version: 1.0 Block version: 2 3/1/2006 9:17:48 AMAM Time stamp Code: 2/24/2006 2:49:20 PMPM Interface: Lengths (block/logic/data): 04042 03690 00030
Name IN OUT IN_OUT TEMP Length MovErr Count Over RETURN RET_VA Data Typ Address 0.0 0.0 0.0 0.0 0.0 2.0 4.0 6.0 0.0 0.0 Comment

Int Int Int Int Bool

Done Parsi

Block: FC7

Parse Incoming String into Variables

Network: 1

Go to the Command to be Parsed

Go to the Command to be Parsed SET A JC SET A JC SET A JC JU Network: 2 "GID_Done" GID "GLE_Done" GLE "GSV_Done" GSV END Start Parsing the GID Command

Start Parsing the GID Command GID: SET

Network: 3

Bring in the Received GID String

Bring in the Received GID String, starting at 4 to ignore the command and first comma "BLKMOV" EN P#DB20. DBX4.0 BYTE 74 SRCBLK ENO

RET_VAL #MovErr P#DB4. DBX126.0 DSTBLK BYTE 74

Page 1 of 17

Siemens S7

S79/15/2006 12:09:01 PM CRI\CRI_PLC\CPU 314C-2 PtP\...\FC7 - <offline>

Network: 4

Set the Original length for Strings.Working to 74.

Set the Original length for Strings.Working to 74. SET OPN L T L L T T "Strings" 74 DB4.DBB 125 DB4.DBD 0 #Length #Over 124 // Start at 0

// Start String.Working Length at 74

Network: 5

Find First Comma for UNIT_ID

Find Comma in Received String and Subtract 1 from length to account for comma. "FIND" EN "Strings". Working IN1 "Strings". Comma IN2 ENO RET_VAL #Length 1 IN2 EN SUB_I ENO OUT #Length

#Length IN1

Network: 6

Set Max String Length to 8 for Displaying on HMI

Set Max String Length to 8 for Displaying on HMI CMP >I EN #Length IN1 16 IN2 SUB_I ENO OUT #Over

#Length IN1 16 IN2

Network: 7

Set Max and Actual lengths for UNIT_ID

Set Max and Actual lengths for UNIT_ID SET OPN L T L L >I JC L T T JU OVR7: L T T JU DON7: L NOP "Strings" 16 DB4.DBB #Over 0 OVR7 #Length DB4.DBB #Over DON7 16 DB4.DBB #Over DON7 DB4.DBD 0 1 // Length of UNIT_ID // Put in UNIT String // For Copy Length to String // Length of 16 // Put in UNIT String // For Copy Length to String

// Max Length for UNIT_ID 0

Page 2 of 17

Siemens S7

S79/15/2006 12:09:01 PM CRI\CRI_PLC\CPU 314C-2 PtP\...\FC7 - <offline>

Network: 8

Move out UNIT_ID

Copy out the UNIT_ID "LEFT" EN "Strings". Working IN #Over L ENO "Strings". RET_VAL Unit

Network: 9

Adjust Length for UNIT_ID

Add 1 to Length to Delete Comma, and subtract length from original ADD_I ENO OUT #Length SUB_I ENO OUT #Count

EN

EN

#Length IN1 1 IN2

74 IN1 #Length IN2

Network: 10

Delete the UNIT_ID Length from Strings.Working

Delete the UNIT_ID Length from Strings.Working left side, starting at 1st character. "DELETE" EN "Strings". Working IN #Length L 1 P ENO "Strings". RET_VAL Working

Network: 11

Set the Actual New length for Strings.Working

Set the New Actual Length of Strings.Working and Reset Length to 0. SET OPN L T L L T T "Strings" #Count DB4.DBB 125 DB4.DBD 0 #Length #Over 124 // Reset to 0

// Current length of // String.Working

Page 3 of 17

Siemens S7

S79/15/2006 12:09:01 PM CRI\CRI_PLC\CPU 314C-2 PtP\...\FC7 - <offline>

Network: 12

Find Second Comma for FIRM_REV

Find Comma in Received String and Subtract 1 from length to account for comma "FIND" EN "Strings". Working IN1 "Strings". Comma IN2 ENO RET_VAL #Length 1 IN2 EN SUB_I ENO OUT #Length

#Length IN1

Network: 13

Set Max String Length to 8 for Displaying on HMI

Set Max String Length to 8 for Displaying on HMI CMP >I EN #Length IN1 8 IN2 SUB_I ENO OUT #Over

#Length IN1 8 IN2

Network: 14

Set Max and Actual lengths for FIRM_REV

Set Max and Actual lengths for FIRM_REV SET OPN L T L L >I JC L T T JU OVR8: L T T JU DON8: L NOP Network: 15 "Strings" 10 DB4.DBB 18 #Over 0 OVR8 #Length DB4.DBB #Over DON8 8 DB4.DBB #Over DON8 DB4.DBD 0 19 // Length of FIRM_REV // Put in FIRMREV String // For Copy Length to String // Length of 8 // Put in FIRMREV String // For Copy Length to String

// Max Length for FIRM_REV

19

18

Move out FIRM_REV

Copy out the FIRM_REV "LEFT" EN "Strings". Working IN #Over L ENO "Strings". RET_VAL FirmRev

Page 4 of 17

Siemens S7

S79/15/2006 12:09:01 PM CRI\CRI_PLC\CPU 314C-2 PtP\...\FC7 - <offline>

Network: 16

Completed Parsing the GID Command

Completed Parsing the GID Command END JMP

Network: 17

Start Parsing the GLE Command

Start Parsing the GLE Command GLE: SET

Network: 18

Bring in the Received GLE String

Bring in the Received GLE String, starting at 204 to ignore the command and first comma "BLKMOV" EN P#DB20. DBX204.0 BYTE 74 SRCBLK ENO

RET_VAL #MovErr P#DB4. DBX126.0 DSTBLK BYTE 74

Network: 19

Set the Original length for Strings.Working to 74.

Set the Original length for Strings.Working to 74. SET OPN L T L L T T "Strings" 74 DB4.DBB 125 DB4.DBD 0 #Length #Over 124 // Start at 0

// Start String.Working Length at 74

Network: 20

Find First Comma for CNTL_ERR

Find Comma in Received String and Subtract 1 from length to account for comma. "FIND" EN "Strings". Working IN1 "Strings". Comma IN2 ENO RET_VAL #Length 1 IN2 EN SUB_I ENO OUT #Length

#Length IN1

Page 5 of 17

Siemens S7

S79/15/2006 12:09:01 PM CRI\CRI_PLC\CPU 314C-2 PtP\...\FC7 - <offline>

Network: 21

Set Max String Length to 8 for Displaying on HMI

Set Max String Length to 8 for Displaying on HMI CMP >I EN #Length IN1 8 IN2 SUB_I ENO OUT #Over

#Length IN1 8 IN2

Network: 22

Set Max and Actual lengths for CNTL_ERR

Set Max and Actual lengths for CNTL_ERR SET OPN L T L L >I JC L T T JU OVR9: L T T JU DON9: L NOP Network: 23 "Strings" 20 DB4.DBB 30 #Over 0 OVR9 #Length DB4.DBB #Over DON9 8 DB4.DBB #Over DON9 DB4.DBD 0 31 // Length of CNTL_ERR // Put in ERR String // For Copy Length to String // Length of 8 // Put in ERR String // For Copy Length to String

// Max Length for CNTL_ERR

31

30

Move out CNTL_ERR

Copy out the CNTL_ERR "LEFT" EN "Strings". Working IN #Over L ENO "Strings". RET_VAL Err

Network: 24

Completed Parsing the GLE Command

Completed Parsing the GLE Command END JMP

Page 6 of 17

Siemens S7

S79/15/2006 12:09:01 PM CRI\CRI_PLC\CPU 314C-2 PtP\...\FC7 - <offline>

Network: 25

Start Parsing the GSV Command

Start Parsing the GSV Command GSV: SET

Network: 26

Bring in the Received GSV String

Bring in the Received GSV String, starting at 604 to ignore the command and first comma "BLKMOV" EN P#DB20. DBX604.0 BYTE 74 SRCBLK ENO

RET_VAL #MovErr P#DB4. DBX126.0 DSTBLK BYTE 74

Network: 27

Set the Original length for Strings.Working to 74.

Set the Original length for Strings.Working to 74. SET OPN L T L L T T "Strings" 74 DB4.DBB 125 DB4.DBD 0 #Length #Over 124 // Start at 0

// Start String.Working Length at 74

Network: 28

Find First Comma for SPEED

Find Comma in Received String and Subtract 1 from length to account for comma. "FIND" EN "Strings". Working IN1 "Strings". Comma IN2 ENO RET_VAL #Length 1 IN2 EN SUB_I ENO OUT #Length

#Length IN1

Network: 29

Set Max String Length to 8 for Displaying on HMI

Set Max String Length to 8 for Displaying on HMI CMP >I EN #Length IN1 8 IN2 SUB_I ENO OUT #Over

#Length IN1 8 IN2

Page 7 of 17

Siemens S7

S79/15/2006 12:09:02 PM CRI\CRI_PLC\CPU 314C-2 PtP\...\FC7 - <offline>

Network: 30

Set Max and Actual lengths for SPEED

Set Max and Actual lengths for SPEED SET OPN L T L L >I JC L T T JU OVR1: L T T JU DON1: L NOP Network: 31 "Strings" 10 DB4.DBB 52 #Over 0 OVR1 #Length DB4.DBB #Over DON1 8 DB4.DBB #Over DON1 DB4.DBD 0 53 // Length of SPEED // Put in SPD String // For Copy Length to String // Length of 8 // Put in SPD String // For Copy Length to String

// Max Length for SPEED

53

52

Move out SPEED

Copy out the SPEED "LEFT" EN "Strings". Working IN #Over L ENO "Strings". RET_VAL Spd

Network: 32

Adjust Length for SPEED

Add 1 to Length to Delete Comma, and subtract length from original ADD_I ENO OUT #Length SUB_I ENO OUT #Count

EN

EN

#Length IN1 1 IN2

74 IN1 #Length IN2

Network: 33

Delete the SPEED Length from Strings.Working

Delete the SPEED Length from Strings.Working left side, starting at 1st character. "DELETE" EN "Strings". Working IN #Length L 1 P ENO "Strings". RET_VAL Working

Page 8 of 17

Siemens S7

S79/15/2006 12:09:02 PM CRI\CRI_PLC\CPU 314C-2 PtP\...\FC7 - <offline>

Network: 34

Set the Actual New length for Strings.Working

Set the New Actual Length of Strings.Working and Reset Length to 0. SET OPN L T L L T T Network: 35 "Strings" #Count DB4.DBB 125 DB4.DBD 0 #Length #Over 124 // Reset to 0

// Current length of // String.Working

Find Second Comma for TORQUE

Find Comma in Received String and Subtract 1 from length to account for comma "FIND" EN "Strings". Working IN1 "Strings". Comma IN2 ENO RET_VAL #Length 1 IN2 EN SUB_I ENO OUT #Length

#Length IN1

Network: 36

Set Max String Length to 8 for Displaying on HMI

Set Max String Length to 8 for Displaying on HMI CMP >I EN #Length IN1 8 IN2 SUB_I ENO OUT #Over

#Length IN1 8 IN2

Network: 37

Set Max and Actual lengths for TORQUE

Set Max and Actual lengths for TORQUE SET OPN L T L L >I JC L T T JU OVR2: L T T JU DON2: L NOP "Strings" 10 DB4.DBB 64 #Over 0 OVR2 #Length DB4.DBB #Over DON2 8 DB4.DBB #Over DON2 DB4.DBD 0 65 // Length of TORQUE // Put in TRQ String // For Copy Length to String // Length of 8 // Put in TRQ String // For Copy Length to String

// Max Length for TORQUE

65

64

Page 9 of 17

Siemens S7

S79/15/2006 12:09:02 PM CRI\CRI_PLC\CPU 314C-2 PtP\...\FC7 - <offline>

Network: 38

Move out TORQUE

Copy out the TORQUE "LEFT" EN "Strings". Working IN #Over L ENO "Strings". RET_VAL Trq

Network: 39

Adjust Length for TORQUE

Add 2 to Length to Delete Comma, and subtract length from original ADD_I ENO OUT #Length SUB_I ENO OUT #Count

EN

EN

#Length IN1 1 IN2

#Count IN1 #Length IN2

Network: 40

Delete the TORQUE Length from Strings.Working

Delete the TORQUE Length from Strings.Working left side, starting at 1st character. "DELETE" EN "Strings". Working IN #Length L 1 P ENO "Strings". RET_VAL Working

Network: 41

Set the Actual New length for Strings.Working

Set the New Actual Length of Strings.Working and Reset Length to 0. SET OPN L T L L T T "Strings" #Count DB4.DBB 125 DB4.DBD 0 #Length #Over 124 // Reset Length to 0

// Current length of // String.Working

Page 10 of 17

Siemens S7

S79/15/2006 12:09:02 PM CRI\CRI_PLC\CPU 314C-2 PtP\...\FC7 - <offline>

Network: 42

Find Third Comma for MOTOR ERROR

Find Comma in Received String and Subtract 1 from length to account for comma "FIND" EN "Strings". Working IN1 "Strings". Comma IN2 ENO RET_VAL #Length 1 IN2 EN SUB_I ENO OUT #Length

#Length IN1

Network: 43

Set Max String Length to 8 for Displaying on HMI

Set Max String Length to 8 for Displaying on HMI CMP >I EN #Length IN1 8 IN2 SUB_I ENO OUT #Over

#Length IN1 8 IN2

Network: 44

Set Max and Actual lengths for MOTOR ERROR

Set Max and Actual lengths for MOTOR ERROR SET OPN L T L L >I JC L T T JU OVR3: L T T JU DON3: L NOP Network: 45 "Strings" 10 DB4.DBB 76 #Over 0 OVR3 #Length DB4.DBB #Over DON3 8 DB4.DBB #Over DON3 DB4.DBD 0 77 // Length of MOTOR ERROR // Put in MTRERR String // For Copy Length to String // Length of 8 // Put in MTRERR String // For Copy Length to String

// Max Length for MOTOR ERROR

77

76

Move out MOTOR ERROR

Copy out the MOTOR ERROR "LEFT" EN "Strings". Working IN #Over L ENO "Strings". RET_VAL MtrErr

Page 11 of 17

Siemens S7

S79/15/2006 12:09:02 PM CRI\CRI_PLC\CPU 314C-2 PtP\...\FC7 - <offline>

Network: 46

Adjust Length for MOTOR ERROR

Add 1 to Length to Delete Comma, and subtract length from original ADD_I ENO OUT #Length SUB_I ENO OUT #Count

EN

EN

#Length IN1 1 IN2

#Count IN1 #Length IN2

Network: 47

Delete the MOTOR ERROR Length from Strings.Working

Delete the MOTOR ERROR Length from Strings.Working left side, starting at 1st character. "DELETE" EN "Strings". Working IN #Length L 1 P ENO "Strings". RET_VAL Working

Network: 48

Set the Actual New length for Strings.Working

Set the New Actual Length of Strings.Working and Reset Length to 0. SET OPN L T L L T T Network: 49 "Strings" #Count DB4.DBB 125 DB4.DBD 0 #Length #Over 124 // Reset Length to 0

// Current length of // String.Working

Find Fifth Comma for SHEAR RATE

Find Comma in Received String and Subtract 1 from length to account for comma "FIND" EN "Strings". Working IN1 "Strings". Comma IN2 ENO RET_VAL #Length 1 IN2 EN SUB_I ENO OUT #Length

#Length IN1

Page 12 of 17

Siemens S7

S79/15/2006 12:09:02 PM CRI\CRI_PLC\CPU 314C-2 PtP\...\FC7 - <offline>

Network: 50

Set Max String Length to 8 for Displaying on HMI

Set Max String Length to 8 for Displaying on HMI CMP >I EN #Length IN1 8 IN2 SUB_I ENO OUT #Over

#Length IN1 8 IN2

Network: 51

Set Max and Actual lengths for SHEAR RATE

Set Max and Actual lengths for SHEAR RATE SET OPN L T L L >I JC L T T JU OVR4: L T T JU DON4: L NOP Network: 52 "Strings" 10 DB4.DBB 88 #Over 0 OVR4 #Length DB4.DBB #Over DON4 8 DB4.DBB #Over DON4 DB4.DBD 0 89 // Length of SHEAR RATE // Put in SRATE String // For Copy Length to String // Length of 8 // Put in SRATE String // For Copy Length to String

// Max Length for SHEAR RATE

89

88

Move out SHEAR RATE

Copy out the SHEAR RATE "LEFT" EN "Strings". Working IN #Over L ENO "Strings". RET_VAL SRate

Network: 53

Adjust Length for SHEAR RATE

Add 2 to Length to Delete Comma, and subtract length from original ADD_I ENO OUT #Length SUB_I ENO OUT #Count

EN

EN

#Length IN1 1 IN2

#Count IN1 #Length IN2

Page 13 of 17

Siemens S7

S79/15/2006 12:09:02 PM CRI\CRI_PLC\CPU 314C-2 PtP\...\FC7 - <offline>

Network: 54

Delete the SHEAR RATE Length from Strings.Working

Delete the SHEAR RATE Length from Strings.Working left side, starting at 1st character. "DELETE" EN "Strings". Working IN #Length L 1 P ENO "Strings". RET_VAL Working

Network: 55

Set the Actual New length for Strings.Working

Set the New Actual Length of Strings.Working and Reset Length to 0. SET OPN L T L L T T Network: 56 "Strings" #Count DB4.DBB 125 DB4.DBD 0 #Length #Over 124 // Reset Length to 0

// Current length of // String.Working

Find Sixth Comma for SHEAR STRESS

Find Comma in Received String and Subtract 1 from length to account for comma "FIND" EN "Strings". Working IN1 "Strings". Comma IN2 ENO RET_VAL #Length 1 IN2 EN SUB_I ENO OUT #Length

#Length IN1

Network: 57

Set Max String Length to 8 for Displaying on HMI

Set Max String Length to 8 for Displaying on HMI CMP >I EN #Length IN1 8 IN2 SUB_I ENO OUT #Over

#Length IN1 8 IN2

Network: 58

Set Max and Actual lengths for SHEAR STRESS

Set Max and Actual lengths for SHEAR STRESS SET OPN L T L "Strings" 10 DB4.DBB 100 #Over

// Max Length for SHEAR STRESS

Page 14 of 17

Siemens S7

S79/15/2006 12:09:02 PM CRI\CRI_PLC\CPU 314C-2 PtP\...\FC7 - <offline>

L >I JC L T T JU OVR5: L T T JU DON5: L NOP Network: 59

0 OVR5 #Length DB4.DBB #Over DON5 8 DB4.DBB #Over DON5 DB4.DBD 0 101 // Length of SHEAR STRESS // Put in SSTRS String // For Copy Length to String // Length of 8 // Put in SSTRS String // For Copy Length to String

101

100

Move out SHEAR STRESS

Copy out the SHEAR STRESS "LEFT" EN "Strings". Working IN #Over L ENO "Strings". RET_VAL SStrs

Network: 60

Adjust Length for SHEAR STRESS

Add 2 to Length to Delete Comma, and subtract length from original ADD_I ENO OUT #Length SUB_I ENO OUT #Count

EN

EN

#Length IN1 1 IN2

#Count IN1 #Length IN2

Network: 61

Delete the SHEAR STRESS Length from Strings.Working

Delete the SHEAR STRESS Length from Strings.Working left side, starting at 1st character. "DELETE" EN "Strings". Working IN #Length L 1 P ENO "Strings". RET_VAL Working

Network: 62

Set the Actual New length for Strings.Working

Set the New Actual Length of Strings.Working and Reset Length to 0. SET OPN L T L "Strings" #Count DB4.DBB 125 DB4.DBD 124

// Current length of // String.Working

Page 15 of 17

Siemens S7

S79/15/2006 12:09:02 PM CRI\CRI_PLC\CPU 314C-2 PtP\...\FC7 - <offline>


// Reset Length to 0

L T T Network: 63

0 #Length #Over

Find Seventh Comma for VISCOSITY

Find Comma in Received String and Subtract 1 from length to account for comma "FIND" EN "Strings". Working IN1 "Strings". Comma IN2 ENO RET_VAL #Length 1 IN2 EN SUB_I ENO OUT #Length

#Length IN1

Network: 64

Set Max String Length to 8 for Displaying on HMI

Set Max String Length to 8 for Displaying on HMI CMP >I EN #Length IN1 8 IN2 SUB_I ENO OUT #Over

#Length IN1 8 IN2

Network: 65

Set Max and Actual lengths for VISCOSITY

Set Max and Actual lengths for VISCOSITY SET OPN L T L L >I JC L T T JU OVR6: L T T JU DON6: L NOP Network: 66 "Strings" 10 DB4.DBB 112 #Over 0 OVR6 #Length DB4.DBB #Over DON6 8 DB4.DBB #Over DON6 DB4.DBD 0 113 // Length of VISCOSITY // Put in VISC String // For Copy Length to String // Length of 8 // Put in VISC String // For Copy Length to String

// Max Length for VISCOSITY

113

112

Move out VISCOSITY

Copy out the VISCOSITY "LEFT" EN "Strings". Working IN #Over L ENO "Strings". RET_VAL Visc

Page 16 of 17

Siemens S7

S79/15/2006 12:09:02 PM CRI\CRI_PLC\CPU 314C-2 PtP\...\FC7 - <offline>

Network: 67

Completed Parsing the GSV Command

Completed Parsing the GSV Command END JMP

Network: 68

Set the Return Value to show String Parsing was Completed.

Set the Return Value to show String Parsing was Completed. END: S BE #RET_VAL

Page 17 of 17

You might also like