STL bit and byte numbers

Avatar_41

Member
Join Date
Aug 2019
Location
Istanbul
Posts
96
Hello everyone, friends. I need help with something. I want to read and change Bit and Byte numbers via HMI. I found a code snippet for this as below. I tried, it works, but I don't know how to transfer the values ​​like "I 10.7" that I marked in red here to another address and read and change it. I need your support on this.

IMG_20230523_020421.jpg 1.JPG 1_1.JPG
 

Attachments

  • 1_FC1.pdf
    4 KB · Views: 23
When you say you tried it, it works, what do you mean by that as your code is not writing the output_bit?
 
There's a document from Siemens laying out how the pointer is formed, and the memory area it points to is a number in the address formed. I reckon it's the 810000000 number that commands this. search the help for pointer and it's likely there the explanation.
 
I may not have explained exactly what I want to do. Translation problems may occur. Bit and Byte numbers appear in LAR1, for example I 10.7. I want to transfer the 10.7 value here to a DataBlock address and change it whenever I want via the HMI. However, I don't know how to pass this value to DataBlock and I need help with this.

When you say you tried it, it works, what do you mean by that as your code is not writing the output_bit?
 
Your example code already does what you want. Change the values in DB10 via the HMI to address a different byte/bit.

bitbyte.jpg
 
Here's the problem, I'm writing as 11.7 on the HMI, but I can't see this value as 11.7. However, if in the Watt table; If I choose Out Variable display format as Pointer, I can read it, but if I set the data type as Pointer in FC1, Out Variable turns red, so it goes into error. I couldn't understand how I could solve this.
Your example code already does what you want. Change the values in DB10 via the HMI to address a different byte/bit.
 
Here's your code with byte number=11 and bit number=7, I can see I11.7 in the FC.


You need to post some screen shots to explain what you are looking at.

bitbyte1.jpg
 
Here's the problem, I'm writing as 11.7 on the HMI, but I can't see this value as 11.7. However, if in the Watt table; If I choose Out Variable display format as Pointer, I can read it, but if I set the data type as Pointer in FC1, Out Variable turns red, so it goes into error. I couldn't understand how I could solve this.

There are two different types of pointer in S7. What you are creating is a byte pointer which is 4 bytes (DWORD). The other type of pointer is an ANY POINTER which is 10 bytes and has a complex structure.
 
I'm sorry to bother you all the time, but I think I'm doing something wrong. When I change the values via hmi, for example, when I type 0.0, the decimal value changes to -2130706432. When you do 0.1, it changes to -2130706431. Do I need to divide this number by another number to get ("I0.0")? Or do I need to do something else?
ss_030754.JPG

Here's your code with byte number=11 and bit number=7, I can see I11.7 in the FC.


You need to post some screen shots to explain what you are looking at.
 
Also, the two AND statements prior to the Transfer instruction have no effect on the Transfer so they serve no purpose. What was the intent for those instructions?
 

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,579
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,096
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,622
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,358
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,460
Back
Top Bottom