2/11/2010 5:34 PM | |
Posts: 54 Rating:
|
Hi Allan, Now I found the time to give you the example. It based on the solution one where no reference variable has been assigned. I also added the properties minimal and maximal to allow the values 0 or 1 only. The base idea is: Add a local variable that receives the last value of an edit control Compare both variables within the timer tag at begin of the timer tag block Do nothing if they are identical Calculate the PLC bit if they are different and set the local variable with edit control value … … <let name="old_edit7_value">0</let> … … <control name= "edit7" xpos = "260" ypos="100"> <!-- set input range--> <property min="0" /> <property max="1" /> </control> … … … <op> plc_byte_m158 = "PLC/mb158" </op> <!-- ---------------------------------------------------- --> <if> <condition>old_edit7_value != edit7</condition> <then> <if> <condition>edit7 == 1</condition> <then> <!-- set bit 1 --> <op> plc_byte_m158 = plc_byte_m158 | 1</op> </then> <else> <!-- reset bit 1 --> <op> plc_byte_m158 = plc_byte_m158 & (255 -1)</op> </else> </if> <op> old_edit7_value = edit7 </op> <!-- copy the current value into the save (compare) variable --> <op> field_changed = 1 </op> <!-- mark the modification --> </then> </if> <!-- ---------------------------------------------------- --> … … Part two of the timer block Read the byte and calculate the display values like before File: xmldial_read_write.xml Additional I created an example using a subroutine to calculate the PLC byte value. It keeps the timer tag more readable. File: xmldial_read_write_with_func.xml Attachmentexample.zip (276 Downloads) |
This contribution was helpful to
1 thankful Users |
2/11/2010 6:32 PM | |
Joined: 2/20/2007 Last visit: 4/12/2024 Posts: 7 Rating:
|
Drill_easy , thanks a lot.You have helped me a lot. Learning XML is like trying to speak another language. |
Follow us on