![]() ![]() ![]() ![]() ![]() ![]() |
||
![]() |
||
![]() ![]() ![]() ![]() This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc. |
||
![]() |
![]() |
#1 |
Member
![]() ![]() Join Date: Aug 2019
Location: Istanbul
Posts: 85
|
STL bit and byte numbers
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.
|
![]() |
![]() |
#2 |
Lifetime Supporting Member
![]() ![]() Join Date: Nov 2006
Location: UK
Posts: 6,537
|
When you say you tried it, it works, what do you mean by that as your code is not writing the output_bit?
__________________
S7-300 to 1500 conversions done - email (minus the spam) to spams7conversions@hotmail.com |
![]() |
![]() |
#3 |
Member
![]() ![]() Join Date: Nov 2016
Location: Fields of corn
Posts: 2,451
|
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.
|
![]() |
![]() |
#4 |
Member
![]() ![]() Join Date: Nov 2016
Location: Fields of corn
Posts: 2,451
|
Also, STL is on its way out, I'd instead look at pointing to an IO buffer instead.
|
![]() |
![]() |
#5 |
Member
![]() ![]() Join Date: Aug 2019
Location: Istanbul
Posts: 85
|
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.
|
![]() |
![]() |
#6 |
Member
![]() ![]() Join Date: Nov 2016
Location: Fields of corn
Posts: 2,451
|
I understood what you wanted to do perfectly. You'd want a box to write the byte number and another box to write the bit number. and then return the value at that memory position.
And the way to do this is via addressing with a pointer. Check here: https://www.fleaplc.it/index.php/tut...nput-parameter Search the help for: Format of the Parameter Type Pointer |
![]() |
![]() |
#7 |
Lifetime Supporting Member
![]() ![]() Join Date: Nov 2006
Location: UK
Posts: 6,537
|
Your example code already does what you want. Change the values in DB10 via the HMI to address a different byte/bit.
__________________
S7-300 to 1500 conversions done - email (minus the spam) to spams7conversions@hotmail.com |
![]() |
![]() |
#8 |
Member
![]() ![]() Join Date: Aug 2019
Location: Istanbul
Posts: 85
|
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.
|
![]() |
![]() |
#9 |
Lifetime Supporting Member
![]() ![]() Join Date: Nov 2006
Location: UK
Posts: 6,537
|
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.
__________________
S7-300 to 1500 conversions done - email (minus the spam) to spams7conversions@hotmail.com |
![]() |
![]() |
#10 | |
Member
![]() ![]() Join Date: Jul 2007
Location: Lancashire
Posts: 1,272
|
Quote:
|
|
![]() |
![]() |
#11 |
Member
![]() ![]() Join Date: Aug 2019
Location: Istanbul
Posts: 85
|
|
![]() |
![]() |
#12 |
Member
![]() ![]() Join Date: Aug 2019
Location: Istanbul
Posts: 85
|
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 |
![]() |
![]() |
#13 |
Lifetime Supporting Member
![]() ![]() Join Date: Nov 2006
Location: UK
Posts: 6,537
|
You are doing nothing wrong. What is the purpose of writing the area pointer to the OUTPUT?
__________________
S7-300 to 1500 conversions done - email (minus the spam) to spams7conversions@hotmail.com |
![]() |
![]() |
#14 |
Member
![]() ![]() Join Date: Jul 2007
Location: Lancashire
Posts: 1,272
|
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?
|
![]() |
![]() |
#15 |
Member
![]() ![]() Join Date: Aug 2019
Location: Istanbul
Posts: 85
|
|
![]() |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Loading .Pre in an array of timers? | dginbuffalo | LIVE PLC Questions And Answers | 24 | March 11th, 2016 06:44 PM |
S7 STL Dword to Byte | rikcando | LIVE PLC Questions And Answers | 5 | May 21st, 2012 05:06 PM |
bit from byte IEC61131-3 | hapetter | LIVE PLC Questions And Answers | 2 | March 4th, 2011 06:25 AM |
Dectect morethan 1 bit set in a byte. | Darbs003 | LIVE PLC Questions And Answers | 20 | August 12th, 2010 10:18 AM |
Siemens Addressing Fun | james-0000 | LIVE PLC Questions And Answers | 4 | August 9th, 2008 12:58 AM |