Structure Text Array Declaration

Or if the range is [0:63), so [2,4,5,3,1] ≡ [B,D,E,C,A], then perhaps this

Code:
char the_data[] = { "BDECA YWVXZ " };
char *p = the_data;
int index;
int array[2][5];

for (p=the_data+(index=0); *p; ++p)
{
  if (*p & 64) { *(array[0]+index++) = *p;
}

could be ported to structured text (without the pointers, of course).

Unfortunately not all AB processors support defining a string in structured text. I think I'll have a string like that for the User input custom build order but will keep the array of SINTs on the background, both for size and ease of use

Code:
	//For loop for basic build order, pull values out for custom build order
	for i := 1 to PP.PattData[1].NumCases do
		PP.PattData[1].BuildOrderC[i] := i;		//As Drawn Build order
		PP.PattData[1].BuildOrderR[i] := PP.PattData[1].NumCases - (1-i); //Reverse Build order
	end_for;
	
	//Flipped Build order				//Mirrored Build order
	PP.PattData[1].BuildOrderF[1] := 3; PP.PattData[1].BuildOrderM[1] := 2; 
	PP.PattData[1].BuildOrderF[2] := 4; PP.PattData[1].BuildOrderM[2] := 1; 
	PP.PattData[1].BuildOrderF[3] := 2; PP.PattData[1].BuildOrderM[3] := 4; 
	PP.PattData[1].BuildOrderF[4] := 1; PP.PattData[1].BuildOrderM[4] := 3;

Still a rough draft but might make some tags more acronym like.
 

Similar Topics

I'm working with a project that contains some routines in ST but mostly in ladder. Am I correct in assuming this 'rung': DB1001DO._01AV55_OPEN :=...
Replies
4
Views
114
I have quite a large number of recipes in CASE form that I'm writing in structured text. I'm hoping to keep things clean and efficient when...
Replies
13
Views
1,490
Hello Experts, I hope everyone is safe and healthy!! Below mentioned Siemens code is in STL i have to write it in Structure text in Allen...
Replies
4
Views
1,658
Hello everyone, I am a beginner in PLC programming. I want to acquire pressure data from the sensor (water pressure) which give output value 0-5V...
Replies
4
Views
1,700
Hi there, I am currently working on a C# software tool that needs to compile RSLogix 5000 structure text (ST) language (IEC61131-3 + additional...
Replies
11
Views
5,362
Back
Top Bottom