STL bit and byte numbers

What I don't understand is: Why can't I see these 0.0 or 0.1 values, so what can I do to see 0.0 instead of -2130706432?


Whe you monitor the FC, the Siemens monitoring software converts the value in AR1 to a string so it shows, for example, I0.1


If you want to see that on the output of your FC you will have to use a string type and write the code to convert the value in AR1 to a string.
 
Code:
 L     #db_number
      T     #DB_num
      OPN   DB [#DB_num]

//Access byte.bit x of DB selected
      L     #byte_number
      SLD   3
      T     #x_byte
      L     #bit_number
      T     #x_bit
      L     #x_byte
      OW    
      T     #x_varible
      A     DBX [#x_variable]
      = #Output_Status

#byte_number and #bit_number are variables passed into the FC via the HMI.

Make sure to include code to ensure the input byte and bit number are within valid limits or it will cause the CPU to fault.
 
I'm very weak in STL, I got the code snippet from the internet, so I don't know exactly what it does?

I suspect that in your oginal code snippet the the last statement was = #Output (boolean) rather than T #Output. The two preceeding AND statements set the state of the binary result bit (BR) in the Condition Code Register (CCR) and this then governs the status of the output.

While monitoring FC2 you see the I11.7 in the Address register (AR1). The T #Output statement moves the contents of Accumulator1 (Standard) to the output. What you see is the numeric representation of the address as a signed DINT

Nick
 

Similar Topics

Hi All, I'm trying to write (STL) a function(blok) in S7 I just want to in-output a "byte" and use it in my function as "byte.bit" format. I...
Replies
14
Views
3,588
Hi all, I was under the impression that Load and Transfer operate independantly of the RLO ? If this is the case the following code shouldn't...
Replies
10
Views
9,112
Hi I wondered if anyone could help translate the following two networks into Lad as they don't directly translate. I've had a go myself but need...
Replies
20
Views
7,635
Hi all, Wondered if someone could help translate the following bit of STL into LAD in S7. Here is the STL... AN M215.2 ON M214.0 A M150.0 O M 4.6...
Replies
6
Views
3,361
I have alarms from Input I8.0 until I9.6 I9.7 is something else I wrote this as code, M20.0 is a horn. L IW 8 CAW SLW 1...
Replies
7
Views
3,465
Back
Top Bottom