Re: [foxboro] Converting Integers to strings?

  • From: "Joe Sanguinetti" <Joe.Sanguinetti@xxxxxxxxxxxx>
  • To: <foxboro@xxxxxxxxxxxxx>
  • Date: Fri, 4 Apr 2003 16:22:38 -0600

Thanks!!

-----Original Message-----
From: Loupe, Rory (RJ) [mailto:RJLoupe@xxxxxxx]=20
Sent: Friday, April 04, 2003 4:03 PM
To: 'foxboro@xxxxxxxxxxxxx'
Subject: Re: [foxboro] Converting Integers to strings?



Here is what I created, like Alex said it is LONG and UGLY.

Note: Alpha characters were converted to upper case to make the code
less "LONG".  Case sensitivity was not important.

Regards,
Rory Loupe

{Subroutine IntToChar has three arguments: Integer which} {represents
two ASCII characters, high byte indicator} {and a string output } {which
is a single ASCII character.  The first step is} {to parse the two
characters and then convert any} {lower case letters to upper case.
Then} {a large if statement is used to set the string output} {variable
to the ASCII character that the integer } {represents.  For unknown
characters a space is used.} SUBROUTINE IntToChar (
IN     CHARIN     : I
IN     HIBYTE     : I
INOUT  CHAR_OUT   : S6)
STATEMENTS

   IF HIBYTE =3D 1 THEN
      CHAR :=3D TRUNC(CHARIN / 256);
   ELSE
      CHAR :=3D CHARIN MOD 256;
   ENDIF;

   {If the character is lower case "a" through "z"}
   {then convert to upper case "A" through "Z"}
   IF ((CHAR >=3D 97) AND (CHAR <=3D 122)) THEN
      CHAR :=3D CHAR - 32;
   ENDIF;

   IF (CHAR =3D 32) THEN
      CHAR_OUT :=3D " ";
   ELSEIF (CHAR =3D 33) THEN
      CHAR_OUT :=3D "!";
   ELSEIF (CHAR =3D 34) THEN
      CHAR_OUT :=3D """";
   ELSEIF (CHAR =3D 35) THEN
      CHAR_OUT :=3D "#";
   ELSEIF (CHAR =3D 36) THEN
      CHAR_OUT :=3D "$";
   ELSEIF (CHAR =3D 37) THEN
      CHAR_OUT :=3D "%";
   ELSEIF (CHAR =3D 38) THEN
      CHAR_OUT :=3D "&";
   ELSEIF (CHAR =3D 39) THEN
      CHAR_OUT :=3D "'";
   ELSEIF (CHAR =3D 40) THEN
      CHAR_OUT :=3D "(";
   ELSEIF (CHAR =3D 41) THEN
      CHAR_OUT :=3D ")";
   ELSEIF (CHAR =3D 42) THEN
      CHAR_OUT :=3D "*";
   ELSEIF (CHAR =3D 43) THEN
      CHAR_OUT :=3D "+";
   ELSEIF (CHAR =3D 44) THEN
      CHAR_OUT :=3D ",";
   ELSEIF (CHAR =3D 45) THEN
      CHAR_OUT :=3D "-";
   ELSEIF (CHAR =3D 46) THEN
      CHAR_OUT :=3D ".";
   ELSEIF (CHAR =3D 47) THEN
      CHAR_OUT :=3D "/";
   ELSEIF (CHAR =3D 48) THEN
      CHAR_OUT :=3D "0";
   ELSEIF (CHAR =3D 49) THEN
      CHAR_OUT :=3D "1";
   ELSEIF (CHAR =3D 50) THEN
      CHAR_OUT :=3D "2";
   ELSEIF (CHAR =3D 51) THEN
      CHAR_OUT :=3D "3";
   ELSEIF (CHAR =3D 52) THEN
      CHAR_OUT :=3D "4";
   ELSEIF (CHAR =3D 53) THEN
      CHAR_OUT :=3D "5";
   ELSEIF (CHAR =3D 54) THEN
      CHAR_OUT :=3D "6";
   ELSEIF (CHAR =3D 55) THEN
      CHAR_OUT :=3D "7";
   ELSEIF (CHAR =3D 56) THEN
      CHAR_OUT :=3D "8";
   ELSEIF (CHAR =3D 57) THEN
      CHAR_OUT :=3D "9";
   ELSEIF (CHAR =3D 58) THEN
      CHAR_OUT :=3D ":";
   ELSEIF (CHAR =3D 59) THEN
      CHAR_OUT :=3D ";";
   ELSEIF (CHAR =3D 60) THEN
      CHAR_OUT :=3D "<";
   ELSEIF (CHAR =3D 61) THEN
      CHAR_OUT :=3D "=3D";
   ELSEIF (CHAR =3D 62) THEN
      CHAR_OUT :=3D ">";
   ELSEIF (CHAR =3D 63) THEN
      CHAR_OUT :=3D "?";
   ELSEIF (CHAR =3D 64) THEN
      CHAR_OUT :=3D "@";
   ELSEIF (CHAR =3D 65) THEN
      CHAR_OUT :=3D "A";
   ELSEIF (CHAR =3D 66) THEN
      CHAR_OUT :=3D "B";
   ELSEIF (CHAR =3D 67) THEN
      CHAR_OUT :=3D "C";
   ELSEIF (CHAR =3D 68) THEN
      CHAR_OUT :=3D "D";
   ELSEIF (CHAR =3D 69) THEN
      CHAR_OUT :=3D "E";
   ELSEIF (CHAR =3D 70) THEN
      CHAR_OUT :=3D "F";
   ELSEIF (CHAR =3D 71) THEN
      CHAR_OUT :=3D "G";
   ELSEIF (CHAR =3D 72) THEN
      CHAR_OUT :=3D "H";
   ELSEIF (CHAR =3D 73) THEN
      CHAR_OUT :=3D "I";
   ELSEIF (CHAR =3D 74) THEN
      CHAR_OUT :=3D "J";
   ELSEIF (CHAR =3D 75) THEN
      CHAR_OUT :=3D "K";
   ELSEIF (CHAR =3D 76) THEN
      CHAR_OUT :=3D "L";
   ELSEIF (CHAR =3D 77) THEN
      CHAR_OUT :=3D "M";
   ELSEIF (CHAR =3D 78) THEN
      CHAR_OUT :=3D "N";
   ELSEIF (CHAR =3D 79) THEN
      CHAR_OUT :=3D "O";
   ELSEIF (CHAR =3D 80) THEN
      CHAR_OUT :=3D "P";
   ELSEIF (CHAR =3D 81) THEN
      CHAR_OUT :=3D "Q";
   ELSEIF (CHAR =3D 82) THEN
      CHAR_OUT :=3D "R";
   ELSEIF (CHAR =3D 83) THEN
      CHAR_OUT :=3D "S";
   ELSEIF (CHAR =3D 84) THEN
      CHAR_OUT :=3D "T";
   ELSEIF (CHAR =3D 85) THEN
      CHAR_OUT :=3D "U";
   ELSEIF (CHAR =3D 86) THEN
      CHAR_OUT :=3D "V";
   ELSEIF (CHAR =3D 87) THEN
      CHAR_OUT :=3D "W";
   ELSEIF (CHAR =3D 88) THEN
      CHAR_OUT :=3D "X";
   ELSEIF (CHAR =3D 89) THEN
      CHAR_OUT :=3D "Y";
   ELSEIF (CHAR =3D 90) THEN
      CHAR_OUT :=3D "Z";
   ELSEIF (CHAR =3D 91) THEN
      CHAR_OUT :=3D "[";
   ELSEIF (CHAR =3D 92) THEN
      CHAR_OUT :=3D "\";
   ELSEIF (CHAR =3D 93) THEN
      CHAR_OUT :=3D "]";
   ELSEIF (CHAR =3D 94) THEN
      CHAR_OUT :=3D "^";
   ELSEIF (CHAR =3D 95) THEN
      CHAR_OUT :=3D "_";
   ELSEIF (CHAR =3D 96) THEN
      CHAR_OUT :=3D "'";
   ELSEIF (CHAR =3D 123) THEN
      CHAR_OUT :=3D "{";
   ELSEIF (CHAR =3D 124) THEN
      CHAR_OUT :=3D "|";
   ELSEIF (CHAR =3D 125) THEN
      CHAR_OUT :=3D "}";
   ELSEIF (CHAR =3D 126) THEN
      CHAR_OUT :=3D "~";
   ELSE
      CHAR_OUT :=3D " ";
   ENDIF;
ENDSUBROUTINE




-----Original Message-----
From: Johnson, Alex (Foxboro) [mailto:ajohnson@xxxxxxxxxxx]
Sent: Friday, April 04, 2003 3:14 PM
To: foxboro@xxxxxxxxxxxxx
Subject: Re: [foxboro] Converting Integers to strings?



I've used a sequence block in the past. I don't have the code anymore,
but it was long and ugly.



Alex Johnson
Invensys Systems, Inc.
10707 Haddington
Houston, TX 77043
713.722.2859 (office)
713.722.2700 (switchboard)
713.932.0222 (fax)
ajohnson@xxxxxxxxxxx
For the latest information on ArchestrA, go to
www.invensys.com/Archestra.html.

 -----Original Message-----
From:   Joe Sanguinetti [mailto:Joe.Sanguinetti@xxxxxxxxxxxx]=20
Sent:   Friday, April 04, 2003 11:31 AM
To:     foxboro@xxxxxxxxxxxxx
Subject:        [foxboro] Converting Integers to strings?

I am messaging a group of integers that represent ASCII chars that I
want to display in Foxboro.  Allen Bradley interchange does not support
the messaging of string or ASCII type data.  Has anyone have any
experience in converting integers to ASCII characters?  DO I need to use
a sequence block???


Any help or comments would be appreciated.

Joe

=20
=20
_______________________________________________________________________
This mailing list is neither sponsored nor endorsed by Invensys Process
Systems (formerly The Foxboro Company). Use the info you obtain here at
your own risks. Read http://www.thecassandraproject.org/disclaimer.html
=20
foxboro mailing list:             //www.freelists.org/list/foxboro
to subscribe:         =
mailto:foxboro-request@xxxxxxxxxxxxx?subject=3Djoin
to unsubscribe:      =
mailto:foxboro-request@xxxxxxxxxxxxx?subject=3Dleave
=20
=20
=20
_______________________________________________________________________
This mailing list is neither sponsored nor endorsed by Invensys Process
Systems (formerly The Foxboro Company). Use the info you obtain here at
your own risks. Read http://www.thecassandraproject.org/disclaimer.html
=20
foxboro mailing list:             //www.freelists.org/list/foxboro
to subscribe:         =
mailto:foxboro-request@xxxxxxxxxxxxx?subject=3Djoin
to unsubscribe:      =
mailto:foxboro-request@xxxxxxxxxxxxx?subject=3Dleave
=20
=20
=20
_______________________________________________________________________
This mailing list is neither sponsored nor endorsed by Invensys Process
Systems (formerly The Foxboro Company). Use the info you obtain here at
your own risks. Read http://www.thecassandraproject.org/disclaimer.html
=20
foxboro mailing list:             //www.freelists.org/list/foxboro
to subscribe:         =
mailto:foxboro-request@xxxxxxxxxxxxx?subject=3Djoin
to unsubscribe:      =
mailto:foxboro-request@xxxxxxxxxxxxx?subject=3Dleave
=20
 
 
_______________________________________________________________________
This mailing list is neither sponsored nor endorsed by Invensys Process
Systems (formerly The Foxboro Company). Use the info you obtain here at
your own risks. Read http://www.thecassandraproject.org/disclaimer.html
 
foxboro mailing list:             //www.freelists.org/list/foxboro
to subscribe:         mailto:foxboro-request@xxxxxxxxxxxxx?subject=join
to unsubscribe:      mailto:foxboro-request@xxxxxxxxxxxxx?subject=leave
 

Other related posts: