I'm not sure where to even look for an answer on this. I googled around a little but didn't see anything that helps.
In my SCL code I have " IF (tmpString1 = tmpString2) THEN"
When i do a compile i get an error "Cannot find /copy block EQ_STRNG"
Now I know when you use the "=" it automaticlly uses the FC10 for string compare, I believe that it searches for it by name "EQ_STRNG" in the project. Our company standard is that any FC's or FB's that are general system functions must start with SYS, so the name of the FC now is "SYS_EQ_STRNG".
Is there anyway I can associate the "=" with the symbolic name "SYS_EQ_STRNG". Or will I have to call the function a different way?
Regards,
Joel
Here is my code for reference:
I am assuming I cannot change the symbolic name it automaticlly uses and will have to go the route of:
IF SYS_EQ_STRNG(S1 := tmpString1 ,tmpString2 ) THEN
In my SCL code I have " IF (tmpString1 = tmpString2) THEN"
When i do a compile i get an error "Cannot find /copy block EQ_STRNG"
Now I know when you use the "=" it automaticlly uses the FC10 for string compare, I believe that it searches for it by name "EQ_STRNG" in the project. Our company standard is that any FC's or FB's that are general system functions must start with SYS, so the name of the FC now is "SYS_EQ_STRNG".
Is there anyway I can associate the "=" with the symbolic name "SYS_EQ_STRNG". Or will I have to call the function a different way?
Regards,
Joel
Here is my code for reference:
Code:
(*##############################################################################
################################################################################
Revision History
################################################################################
YYYY MM DD
(2011-06-08 v0.1) Creation of the routine.
##############################################################################*)
FUNCTION SYS_TraceArray : INT // set up attributes that will be displayed in the 'Blocks' section
TITLE = ''
VERSION : '1.0'
AUTHOR : 'JW'
NAME : ''
FAMILY : 'TRACE'
(*##############################################################################
Inputs -- Discrete Inputs or other Constant Values
##############################################################################*)
VAR_INPUT
TraceNumber : STRING[10];
Side_in : INT; // This is the side the trace number was welded on 1=A, 2=B
Selection : INT; // 1 = find this trace number, 2 = delete this trace number, 3 = add this trace number
END_VAR
(*##############################################################################
Outputs -- Discrete Outputs
##############################################################################*)
VAR_OUTPUT
Side_out : INT;
END_VAR
(*##############################################################################
Inputs Passed by References (may be modified apart from this routine)
##############################################################################*)
VAR_IN_OUT
TraceBuffer : ARRAY[1..100] OF TraceAndSide;
END_VAR
(*##############################################################################
Static Variables
##############################################################################*)
VAR
i : INT ; // iterator
Match : BOOL;
Move : BOOL;
tmpString1:STRING[10];
tmpString2:STRING[10];
END_VAR
BEGIN
SYS_TraceArray := -1;
Move := 1;
tmpString2 := TraceNumber;
CASE Selection OF
1: // search for the trace number and return the Side number
FOR i := 1 TO 100 DO
tmpString1 := TraceBuffer[i].TraceNum;
IF (tmpString1 = tmpString2) THEN
//IF (tmpString1 = tmpString2 ) THEN
SYS_TraceArray := i;
Side_out := TraceBuffer[i].Side;
EXIT;
END_IF;
END_FOR;
2: // find and delete this trace number, then bump the remaining items to close the gaps
FOR i := 1 TO 100 DO
tmpString1 := TraceBuffer[i].TraceNum;
//If trace number is found clear it out
IF (tmpString1 = tmpString2 ) THEN
SYS_TraceArray := i;
TraceBuffer[i].TraceNum := '0000000000';
TraceBuffer[i].Side := 0;
//After trace number is deleted close the gap by bumping up the rest of the entries
WHILE i <= 99 AND Move DO
tmpString1 := TraceBuffer[i].TraceNum;
tmpString2 := TraceBuffer[i+1].TraceNum;
//If the next trace is not equal to zero bump it up
IF tmpString2 <> '0000000000' THEN
TraceBuffer[i].TraceNum :=TraceBuffer[i+1].TraceNum;
TraceBuffer[i].Side :=TraceBuffer[i+1].Side;
//If next trace is equal to zero then zero out current trace and set Move to zero to finish loop
ELSE
TraceBuffer[i].TraceNum := '0000000000';
TraceBuffer[i].Side := 0;
Move:=0;
END_IF;
i:= i+1;
END_WHILE ;
EXIT;
END_IF;
END_FOR;
3: // first see if this number already exists, if it does then use this spot and just update the user Side
// if it doesn't exist then find an empty spot and add this trace number end Side
// if the new trace occupied position 99 then clear out the first 10 entries and shift the remaining data up
FOR i := 1 TO 100 DO //If trace number is already in the DB update the side then exit
tmpString1 := TraceBuffer[i].TraceNum;
IF (tmpString1 = tmpString2 ) THEN
SYS_TraceArray := i;
TraceBuffer[i].Side := Side_in;
EXIT;
END_IF;
END_FOR;
IF SYS_TraceArray = -1 THEN // didn't find the number in the current list so look for an empty spot to enter it
FOR i := 1 TO 100 DO
tmpString1 := TraceBuffer[i].TraceNum;
IF (tmpString1 = '0000000000' ) THEN
SYS_TraceArray := i;
TraceBuffer[i].TraceNum := TraceNumber;
TraceBuffer[i].Side := Side_in;
EXIT;
END_IF;
END_FOR;
END_IF;
IF SYS_TraceArray >= 99 OR SYS_TraceArray = -1 THEN // If number was entered in position 99 then re-organize
FOR i := 1 TO 99 DO //Move data from 11 thru 99 up 10 positions into 1 thru 89 then clear out 90 - 99
IF i<90 THEN
TraceBuffer[i].TraceNum :=TraceBuffer[i+10].TraceNum;
TraceBuffer[i].Side :=TraceBuffer[i+10].Side;
ELSE
TraceBuffer[i].TraceNum := '0000000000';
TraceBuffer[i].Side := 0;
END_IF;
END_FOR;
END_IF;
END_CASE;
END_FUNCTION
I am assuming I cannot change the symbolic name it automaticlly uses and will have to go the route of:
IF SYS_EQ_STRNG(S1 := tmpString1 ,tmpString2 ) THEN
Last edited: