Changes for page 01 Lua Functions

Last modified by Theodore Xu on 2023/10/26 10:51

From version 20.1
edited by Theodore Xu
on 2023/08/25 09:49
Change comment: There is no comment for this version
To version 21.1
edited by Theodore Xu
on 2023/10/26 10:51
Change comment: There is no comment for this version

Summary

Details

Page properties
Content
... ... @@ -1356,186 +1356,14 @@
1356 1356  {{/code}}
1357 1357  
1358 1358  (((
1359 -= **8 Internal register** =
1359 +
1360 1360  )))
1361 1361  
1362 -The internal registers of the box are divided into bit addresses and word addresses, which can be accessed in two ways (taking HDW as an example):
1363 -
1364 -**Access by word, prefix @W_HDW.**
1365 -
1366 -For example: @W_HDW0 represents the first word of the system data area, @W_HDW1 represents the second word of the system data area.
1367 -
1368 -**Access in bit mode, the prefix is @B_HDX, the number in front of "." indicates the number of the word, and the number behind is the bit number of the word.**
1369 -
1370 -**For example:** @B_HDX1020.12, its meaning is to access the system data area in bit mode, the specific location is the 13th bit of the 1020th word.
1371 -
1372 -(% class="box infomessage" %)
1373 1373  (((
1374 -**✎Note: **
1375 -
1376 -* The address in @B_HDX is taken from the word in @W_HDW, so pay special attention when using the address.
1377 -** For example, @B_HDX1020.12 is to access the 13th bit of the 1020th word. The value of this bit is the same as the word obtained by @W_HDW001020. The 13th bit of this word is actually the same bit as @B_HDX1020.12.
1378 -* The address of the bit address @B_HDX has a decimal point, while the word address is an integer.
1363 += **8 General Functions** =
1379 1379  )))
1380 1380  
1381 -
1382 1382  (((
1383 -== **Data storage area(HDW/HDX)** ==
1384 -)))
1385 -
1386 -The system storage area (HDW) of the V-BOX is used to store temporary data:
1387 -
1388 -1. Access by word, the number range is: "@W_HDW0"-"@W_HDW299999".
1389 -1. Access in bit mode, the number range is: "@B_HDX0.0"-"@B_HDX299999.15".
1390 -
1391 -(((
1392 -== **Special data area (HSW/HSX)** ==
1393 -
1394 -(% class="box infomessage" %)
1395 -(((
1396 -**✎Note: **
1397 -
1398 -* //HSW// is a system special register, so please refer to the system special register table during use. Do not use addresses that are not mentioned in the table, and use the addresses stated in the table with caution (example: restart ("@W_HSW0") Writing a value of 1 will cause V-BOX to restart).
1399 -* //Without any conditions. Direct use ("@W_HSW0") will cause the V-BOX to restart continuously.// When using ("@W_HSW0") address, please add judgment conditions, such as: connection to MQTT fails, there is no network, the value of a PLC address meets the condition or counts to a certain value.
1400 -)))
1401 -)))
1402 -
1403 -The system data area (HSW) of the box is used for system special registers (system reserved). Use //addr_getword// to obtain the following register information:
1404 -
1405 -(% class="table-bordered" %)
1406 -|=(% style="width: 151px;" %)address|=(% style="width: 169px;" %)function|=(% style="width: 456px;" %)Read and write status: read only, write only, read and write
1407 -|(% style="width:151px" %)@W_HSW0|(% style="width:169px" %)restart|(% style="width:456px" %)read and write
1408 -|(% style="width:151px" %)@W_HSW1|(% style="width:169px" %)Box time: year|(% style="width:456px" %)read and write
1409 -|(% style="width:151px" %)@W_HSW2|(% style="width:169px" %)Box time: month|(% style="width:456px" %)read and write
1410 -|(% style="width:151px" %)@W_HSW3|(% style="width:169px" %)Box time: day|(% style="width:456px" %)read and write
1411 -|(% style="width:151px" %)@W_HSW4|(% style="width:169px" %)Box time: hour|(% style="width:456px" %)read and write
1412 -|(% style="width:151px" %)@W_HSW5|(% style="width:169px" %)Box time: minute|(% style="width:456px" %)read and write
1413 -|(% style="width:151px" %)@W_HSW6|(% style="width:169px" %)Box time: second|(% style="width:456px" %)read and write
1414 -|(% style="width:151px" %)@W_HSW7|(% style="width:169px" %)Box time: week|(% style="width:456px" %)read and write
1415 -|(% style="width:151px" %)@W_HSW8|(% style="width:169px" %)Ethernet IP1|(% style="width:456px" %)read only
1416 -|(% style="width:151px" %)@W_HSW9|(% style="width:169px" %)Ethernet IP2|(% style="width:456px" %)read only
1417 -|(% style="width:151px" %)@W_HSW10|(% style="width:169px" %)Ethernet IP3|(% style="width:456px" %)read only
1418 -|(% style="width:151px" %)@W_HSW11|(% style="width:169px" %)Ethernet IP4|(% style="width:456px" %)read only
1419 -|(% style="width:151px" %)@W_HSW12|(% style="width:169px" %)Ethernet Mask 1|(% style="width:456px" %)read only
1420 -|(% style="width:151px" %)@W_HSW13|(% style="width:169px" %)Ethernet Mask 2|(% style="width:456px" %)read only
1421 -|(% style="width:151px" %)@W_HSW14|(% style="width:169px" %)Ethernet Mask 3|(% style="width:456px" %)read only
1422 -|(% style="width:151px" %)@W_HSW15|(% style="width:169px" %)Ethernet Mask 4|(% style="width:456px" %)read only
1423 -|(% style="width:151px" %)@W_HSW16|(% style="width:169px" %)Ethernet Gateway 1|(% style="width:456px" %)read only
1424 -|(% style="width:151px" %)@W_HSW17|(% style="width:169px" %)Ethernet Gateway 2|(% style="width:456px" %)read only
1425 -|(% style="width:151px" %)@W_HSW18|(% style="width:169px" %)Ethernet Gateway 3|(% style="width:456px" %)read only
1426 -|(% style="width:151px" %)@W_HSW19|(% style="width:169px" %)Ethernet Gateway 4|(% style="width:456px" %)read only
1427 -|(% style="width:151px" %)@W_HSW21|(% style="width:169px" %)Ethernet MAC1|(% style="width:456px" %)read only
1428 -|(% style="width:151px" %)@W_HSW22|(% style="width:169px" %)Ethernet MAC2|(% style="width:456px" %)read only
1429 -|(% style="width:151px" %)@W_HSW23|(% style="width:169px" %)Ethernet MAC3|(% style="width:456px" %)read only
1430 -|(% style="width:151px" %)@W_HSW24|(% style="width:169px" %)Ethernet MAC4|(% style="width:456px" %)read only
1431 -|(% style="width:151px" %)@W_HSW25|(% style="width:169px" %)Ethernet MAC3|(% style="width:456px" %)read only
1432 -|(% style="width:151px" %)@W_HSW26|(% style="width:169px" %)Ethernet MAC4|(% style="width:456px" %)read only
1433 -|(% style="width:151px" %)@W_HSW128|(% style="width:169px" %)WIFI IP1|(% style="width:456px" %)read only
1434 -|(% style="width:151px" %)@W_HSW129|(% style="width:169px" %)WIFI IP2|(% style="width:456px" %)read only
1435 -|(% style="width:151px" %)@W_HSW130|(% style="width:169px" %)WIFI IP3|(% style="width:456px" %)read only
1436 -|(% style="width:151px" %)@W_HSW131|(% style="width:169px" %)WIFI IP4|(% style="width:456px" %)read only
1437 -|(% style="width:151px" %)@W_HSW132|(% style="width:169px" %)WIFI Mask 1|(% style="width:456px" %)read only
1438 -|(% style="width:151px" %)@W_HSW133|(% style="width:169px" %)WIFI Mask 2|(% style="width:456px" %)read only
1439 -|(% style="width:151px" %)@W_HSW134|(% style="width:169px" %)WIFI Mask 3|(% style="width:456px" %)read only
1440 -|(% style="width:151px" %)@W_HSW135|(% style="width:169px" %)WIFI Mask 4|(% style="width:456px" %)read only
1441 -|(% style="width:151px" %)@W_HSW136|(% style="width:169px" %)WIFI Gateway 1|(% style="width:456px" %)read only
1442 -|(% style="width:151px" %)@W_HSW137|(% style="width:169px" %)WIFI Gateway 2|(% style="width:456px" %)read only
1443 -|(% style="width:151px" %)@W_HSW138|(% style="width:169px" %)WIFI Gateway 3|(% style="width:456px" %)read only
1444 -|(% style="width:151px" %)@W_HSW139|(% style="width:169px" %)WIFI Gateway 4|(% style="width:456px" %)read only
1445 -|(% style="width:151px" %)@W_HSW140|(% style="width:169px" %)WIFI MAC1|(% style="width:456px" %)read only
1446 -|(% style="width:151px" %)@W_HSW141|(% style="width:169px" %)WIFI MAC2|(% style="width:456px" %)read only
1447 -|(% style="width:151px" %)@W_HSW142|(% style="width:169px" %)WIFI MAC3|(% style="width:456px" %)read only
1448 -|(% style="width:151px" %)@W_HSW143|(% style="width:169px" %)WIFI MAC4|(% style="width:456px" %)read only
1449 -|(% style="width:151px" %)@W_HSW144|(% style="width:169px" %)WIFI MAC5|(% style="width:456px" %)read only
1450 -|(% style="width:151px" %)@W_HSW145|(% style="width:169px" %)WIFI MAC6|(% style="width:456px" %)read only
1451 -|(% style="width:151px" %)@W_HSW146|(% style="width:169px" %)WIFI Signal value|(% style="width:456px" %)read only
1452 -|(% style="width:151px" %)@W_HSW148|(% style="width:169px" %)4G IP1|(% style="width:456px" %)read only
1453 -|(% style="width:151px" %)@W_HSW149|(% style="width:169px" %)4G IP2|(% style="width:456px" %)read only
1454 -|(% style="width:151px" %)@W_HSW150|(% style="width:169px" %)4G IP3|(% style="width:456px" %)read only
1455 -|(% style="width:151px" %)@W_HSW151|(% style="width:169px" %)4G IP4|(% style="width:456px" %)read only
1456 -|(% style="width:151px" %)@W_HSW152|(% style="width:169px" %)4G Mask 1|(% style="width:456px" %)read only
1457 -|(% style="width:151px" %)@W_HSW153|(% style="width:169px" %)4G Mask 2|(% style="width:456px" %)read only
1458 -|(% style="width:151px" %)@W_HSW154|(% style="width:169px" %)4G Mask 3|(% style="width:456px" %)read only
1459 -|(% style="width:151px" %)@W_HSW155|(% style="width:169px" %)4G Mask 4|(% style="width:456px" %)read only
1460 -|(% style="width:151px" %)@W_HSW156|(% style="width:169px" %)4G Gateway 1|(% style="width:456px" %)read only
1461 -|(% style="width:151px" %)@W_HSW157|(% style="width:169px" %)4G Gateway 2|(% style="width:456px" %)read only
1462 -|(% style="width:151px" %)@W_HSW158|(% style="width:169px" %)4G Gateway 3|(% style="width:456px" %)read only
1463 -|(% style="width:151px" %)@W_HSW159|(% style="width:169px" %)4G Gateway 4|(% style="width:456px" %)read only
1464 -|(% style="width:151px" %)@W_HSW160|(% style="width:169px" %)4G MAC1|(% style="width:456px" %)read only
1465 -|(% style="width:151px" %)@W_HSW161|(% style="width:169px" %)4G MAC2|(% style="width:456px" %)read only
1466 -|(% style="width:151px" %)@W_HSW162|(% style="width:169px" %)4G MAC3|(% style="width:456px" %)read only
1467 -|(% style="width:151px" %)@W_HSW163|(% style="width:169px" %)4G MAC4|(% style="width:456px" %)read only
1468 -|(% style="width:151px" %)@W_HSW164|(% style="width:169px" %)4G MAC5|(% style="width:456px" %)read only
1469 -|(% style="width:151px" %)@W_HSW165|(% style="width:169px" %)4G MAC6|(% style="width:456px" %)read only
1470 -|(% style="width:151px" %)@W_HSW166|(% style="width:169px" %)4G Signal value|(% style="width:456px" %)read only
1471 -
1472 -**Others**
1473 -
1474 -* Access password: addr_getstring("@W_HSW27", 16)
1475 -* Machine code: addr_getstring("@W_HSW60", 64)
1476 -* Positioning method (@W_HSW167): (read only)
1477 -** Latitude and longitude
1478 -*** Longitude: addr_getdouble("@W_HSW168") (read only)
1479 -*** Latitude: addr_getdouble("@W_HSW172") (read only)
1480 -** Base station positioning
1481 -*** LAC: addr_getdword("@W_HSW168") (read only)
1482 -*** CI: addr_getdword("@W_HSW172") (read only)
1483 -* Convert base station to latitude and longitude via API
1484 -** Longitude: addr_getdouble("@W_HSW187") (read only)
1485 -** Latitude: addr_getdouble("@W_HSW183") (read only)
1486 -* Operator information: addr_getdword("@W_HSW181") (read only)
1487 -* Networking mode: addr_getword("@W_HSW177") (read only)
1488 -** 0: Ethernet
1489 -** 1: WIFI
1490 -** 2: 4G
1491 -** 3: 2G
1492 -* Map fence flag: addr_getword("@W_HSW178") (read only)
1493 -** 0: No map fence is drawn
1494 -** 1: Draw a map fence and the box is in the fence
1495 -** 2: Draw a map fence and the box is not in the fence
1496 -* SIM card status addr_getword("@W_HSW179") (read only)
1497 -** 1: No card detected
1498 -** 2: Card insertion detected
1499 -** 3: The card status is abnormal
1500 -* MQTT status addr_getword("@W_HSW180") (read only)
1501 -** 1: online, 2: offline
1502 -* IO interface, X is read only, Y is read and write (H series)
1503 -** addr_getbit(addr1), addr_setbit(addr2)
1504 -** addr1:"@B_Y0" "@B_Y1" "@B_X0" "@B_X1"
1505 -** addr2:"@B_Y0" "@B_Y1"
1506 -* Obtaining IMEI (read only)
1507 -** addr_getstring("@W_HSW191",17)
1508 -* Obtaining ICCID (read only)
1509 -** addr_getstring("@W_HSW225",15)
1510 -* (((
1511 -TSAP settings of Siemens LOGO PLC*
1512 -
1513 -(((
1514 -addr_setword("@W_0#HSW1200",8192) means set the Local TSAP as 20.00
1515 -)))
1516 -
1517 -* (((
1518 -addr_setword("@W_0#HSW1201",4096) means set the Remote TSAP as 10.00
1519 -)))
1520 -)))
1521 -
1522 -(((
1523 -== **Power-down storage area (HAW/HAX)** ==
1524 -
1525 -The system storage area (HAW) is used for the system power-down hold registers:
1526 -
1527 -1. Accessed as a word, numbered in the range: "@W_HAW0"-"@W_HAW199999".
1528 -1. Accessed by bit, the numbering range is: "@B_HAX0.0"-"@B_HAX199999.15".
1529 -
1530 -(% class="box infomessage" %)
1531 -(((
1532 -**✎Note:** HAW/HAX is a power-down hold, that is, the registers of this type can retain the data before power-down in case of power-down.
1533 -)))
1534 -
1535 -= **9 General Functions** =
1536 -)))
1537 -
1538 -(((
1539 1539  == **send_sms_ira(string number, string message)** ==
1540 1540  )))
1541 1541  
... ... @@ -1801,7 +1801,7 @@
1801 1801  end
1802 1802  {{/code}}
1803 1803  
1804 -= **10 Special function for V-NET** =
1632 += **9 Special function for V-NET** =
1805 1805  
1806 1806  == **normal_get_alldata()** ==
1807 1807  
... ... @@ -1872,7 +1872,7 @@
1872 1872  
1873 1873  Failed: nil
1874 1874  
1875 -= **11 Message summary algorithm** =
1703 += **10 Message summary algorithm** =
1876 1876  
1877 1877  == **hmac(string hash_func, string key, string message)** ==
1878 1878