×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

what does this mean?

what does this mean?

what does this mean?

(OP)
i have this Function from SIMATIC S7 and am trying so hard to understand what its meant to do.

network 1: Int to ASCII

     L #input
     L B#16#FO
     AW
     SRW  4
     L   9
     <=I
     TAK
     SPB  goo1
     +  7
goo1:  + 48
       SLW 8
       T #output

      L #input
      L B#16#F
      AW
      L 9
      <=I
      TAK
      SPB goo2
      + 7
goo2: + 48
      L #output
      +I
      T #output

Cheers

RE: what does this mean?

Hi,

It convert a interger value between 0 to 255 dec
( or HEX 0 to FF ) to ASCII
If #input = 100 dec  then  #output = 3634 = '64',
that is the Hex value of dec 100 in ASCII


network 1: Int to ASCII
    
sample #input is decimal 72 = hex 48
                        
// left digit first                          

L.#input..//.01001000 = 72 dec   
L.B#16#FO.//.11110000 = 240 (mask left nibble)
AW........//.01000000 = 64
SRW..4....//.00000100 = 4
L....9....//.00001001 = 9
<=I.......//.is 4 <= 9 ? (yes RLO =1)
TAK.......//.mov ACCU2->ACCU1= 4-> ACCU1
SPB..goo1.//.RLO = 1 so jump
+..7......//.if RLO=0 ( add offset +7;
..........//.left digit becomes a character from A - F )  
goo1:+ 48// add dec 48 = 48 + 4 = 52
..........//.= HEX 34 (48 = Hex 30 = ASCII '0' )
SLW.8.....//. mov it to the right place ( left digit )
T.#output.//.0010001000000000 = HEX 3400
 
..........//.right digit next
L.#input..//.01001000 = 72 dec
L.B#16#F..//.00001111 = 15 ( mask right nibble )
AW........//.00001000 = 8
L.9.......//.00001001 = 9
<=I.......//.IS 8 <= 9 ? ( YES RLO = 1 )
..........//.;this means  a digit between 0 - 9
TAK.......//.mov ACCU2 -> ACCU1 = 8 --> ACCU1
SPB.goo2..//.RLO = 1 so jump ; else Accu1 is at least 10!
+.7.......//.this means a character between A - F ;
..........//.so add offset for ASCII
..........//.ie. 10 + 7 + 48 = 65 = ASCII 'A'  
goo2:+ 48// add dec 48 = 48 + 8 = 56 = HEX 38    
L.#output.//.0010001000000000 = 13312 = HEX3400
+I........//.0000000000100110 =    56 = HEX0038
T.#output.//.0010001000100110 = 13368 = HEX3438
       
and this is in ASCII '48'


HTH
Rolf

RE: what does this mean?

(OP)
Thanks a heap!

Cheers

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources