Character - lower case to upper case, SCL? or STL?

rpop91

Member
Join Date
Mar 2012
Location
Detroit, Mi
Posts
44
Hey guys,

Back again. I'm having trouble finding a simple way to convert each character in an array from lower case to upper-case.

I can't seem to find a simple solution. Would it be a good idea to write this in SCL or is there a SFB or something I don't know about?

Any help would be greatly appreciated.

Thanks!
 
Hey guys,

Back again. I'm having trouble finding a simple way to convert each character in an array from lower case to upper-case.

I can't seem to find a simple solution. Would it be a good idea to write this in SCL or is there a SFB or something I don't know about?

Any help would be greatly appreciated.

Thanks!
Generally one would subtract 32 Dec. from the lower case character's value to get the Upper Case character equivalent.
 
Here's upper to lower...

Code:
FUNCTION fc112:VOID

VAR_in_out
   ac:ARRAY[1..100] OF CHAR; 
END_VAR    
VAR_temp
i:INT;
x:INT;
ct AT x:ARRAY[1..2] OF CHAR;
END_VAR 
   
BEGIN
x:=0;
FOR i:=1 TO 100 DO
ct[2]:=ac[i];    
IF(x>=65 and x<=90) THEN 
 x:=x+32;
 ac[i]:=ct[2];
END_IF;
END_FOR;
END_FUNCTION;
 
Here's upper to lower...

Code:
FUNCTION fc112:VOID

VAR_in_out
   ac:ARRAY[1..100] OF CHAR; 
END_VAR    
VAR_temp
i:INT;
x:INT;
ct AT x:ARRAY[1..2] OF CHAR;
END_VAR 
   
BEGIN
x:=0;
FOR i:=1 TO 100 DO
ct[2]:=ac[i];    
IF(x>=65 and x<=90) THEN 
 x:=x+32;
 ac[i]:=ct[2];
END_IF;
END_FOR;
END_FUNCTION;

Thanks a lot, changed a few things in that code and worked perfectly.
 

Similar Topics

So I had an odd request from a customer for the above. I have written the logic and tested it all in one PLC with only using 7 outputs and 7...
Replies
15
Views
427
This may or may not be the right fit for this forum, but I'm hoping someone can recognize my issue and help me sort this out. I'm working to...
Replies
1
Views
2,164
This is for editing HMI texts en masse in Excel. My problem is that in my HMI texts, some are in multiple lines, even if they are single texts...
Replies
26
Views
9,120
Hi. I migrated panelbuilder32 hmi to factorytalk view. However character array is not supported in ftview. Appreciate your help how to map the plc...
Replies
2
Views
1,753
Hi All, have a quick one new enough to this type of programming, I am using a Allen Bradley point IO with 1734-232ASC card to send out data, I...
Replies
5
Views
2,571
Back
Top Bottom