Changes for page 05 Lua Script
Last modified by Devin Chen on 2025/03/04 14:07
From version 24.1
edited by Hunter
on 2023/03/01 12:01
on 2023/03/01 12:01
Change comment:
There is no comment for this version
To version 28.1
edited by Theodore Xu
on 2023/04/11 17:24
on 2023/04/11 17:24
Change comment:
There is no comment for this version
Summary
-
Page properties (2 modified, 0 added, 0 removed)
Details
- Page properties
-
- Author
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki. Hunter1 +XWiki.AiXia - Content
-
... ... @@ -229,13 +229,18 @@ 229 229 230 230 = **11 High-Low Byte Switch** = 231 231 232 -**{{code language="Lua"}}local lowByte = val & 0x00ff 233 ---take the lower 8 bits from address 234 -local shiftHigh = lowByte << 8 235 ---left shift 8 bits 236 -local highByte = val & 0xff00 237 ---take the higher 8 bits from address 238 -local shiftLow = highByte >> 8 239 ---right shift 8 bits 240 -local newVal = shiftHigh|shiftLow 241 ---bit or calculation{{/code}}** 232 +The example shows how to convert high bytes and low bytes for one 16bit address. Main function is like following: 233 + 234 +{{code language="lua"}} 235 +local lowByte = val & 0x00ff 236 +local shiftHigh = lowByte << 8 237 +local highByte = val & 0xff00 238 +local shiftLow = highByte >> 8 239 +local newVal = shiftHigh|shiftLow 240 +{{/code}} 241 + 242 +[[Download link>>https://ftp.we-con.com.cn/Download/WIKI/PI%20HMI/Demo/Lua%20Script/byteswitch.zip]] 243 + 244 += **12 Week time setting** = 245 + 246 +[[Download link>>https://ftp.we-con.com.cn/Download/WIKI/PI%20HMI/Demo/Lua%20Script/week%20time.zip]]