SmartLCD-LuaFunction-ReferenceNote
17Pages

{{requestButtons}}

Catalog excerpts

SmartLCD-LuaFunction-ReferenceNote - 1

SMART LCD Lua Functions Reference Note

Open the catalog to page 1
SmartLCD-LuaFunction-ReferenceNote - 3

Reference Note 1 Basic Lua script is supported in some of the TOPWAY Smart LCD to enhance the flexibility. Engineer may refine the Smart LCD functionality with script. The provided Lua functionality support most of the features of Lua 5.3 except OS operation and file I/O. (please refer to lua.net for Lua 5.3 details) It also extended with hmt library for Smart LCD variables access, function control and value return etc. 2 TOPWAY Smart LCD script and variable 2.1 Lua Scrip structure Basic structure -- define variable(s) Script_Variable01 = 0x00 Advance structure with hooks -- define...

Open the catalog to page 3
SmartLCD-LuaFunction-ReferenceNote - 4

Reference Note 3 hmt library 3.1 hmt functions Summary Category VP read/write Function Name hmt.readvpstr(addr) hmt.writevpstr(addr, string) hmt.readvp16(addr) hmt.writevp16(addr, value) hmt.readvp32(addr) hmt.readvp32f(addr) hmt.writevp32(addr, value) hmt.readvp64(addr) hmt.readvp64f(addr) hmt.writevp64(addr, value) hmt.readvpreg(addr) hmt.writevpreg(addr, value) hmt.changepage(pageid) hmt.readpage() hmt.gettick() hmt.delayms(time) hmt.runcmd(table, num) hmt.bypass(is) hmt.uartclearbuf() hmt.getchar() hmt.putchar(char) hmt.uartsendbytes(table, num) hmt.uartlock() hmt.uartunlock()...

Open the catalog to page 4
SmartLCD-LuaFunction-ReferenceNote - 5

Reference Note 3.2.1 hmt.readvpstr Function hmt.readvpstr(addr) Description Read VP_STR value Parameter addr is the VP_STR address (*1) Return Value String Example Lua script local strvalue = ““ strvalue = hmt.readvpstr(0x000080) print(“strvalue=”, strvalue) Descriptions Put “TOPWAY” into VP_STR 0x000080 via SmartLCD UI define a local variable strvalue and put ““ inside copy value in VP_STR at 0x000080 to strvalue print to UART0 it should find the following at the UART0 strvalue=TOPWAY 3.2.2 hmt.writevpstr Function hmt.writevpstr(addr, string) Description Write a value to VP_STR Parameter...

Open the catalog to page 5
SmartLCD-LuaFunction-ReferenceNote - 6

Reference Note 3.2.5 hmt.readvp32 Function hmt.readvp32(addr) Description Read VP_N32 value Parameter addr is the VP_N32 address (*1) Return Value Integer Example Lua script local N32value = 0 N32value = hmt.readvp32(0x020004) print(“N32value:”, N32value) Descriptions Put 1108410368 into VP_N32 0x020004 via SmartLCD UI define a local variable N32value and put 0 inside copy value in VP_N32 at 0x020004 to N32value print to UART0 it should find the following at the UART0 N32value:1108410368 3.2.6 hmt.readvp32f Function hmt.readvp32f(addr) Description Read VP_N32 value with floating value...

Open the catalog to page 6
SmartLCD-LuaFunction-ReferenceNote - 7

Reference Note 3.2.9 hmt.readvp64f Function hmt.readvp64f(addr) Description Read VP_N64 value with floating value inside Parameter addr is the VP_N64 address (*1) Return Value Floating point Example Lua script local N64value = 0.0 N64value = hmt.readvp64f(0x030000) print(“N64value:”, N64value) Descriptions Put a floating point value 118.37 into VP_N64 0x030000 via SmartLCD UI define a local variable N64value and put 0.0 inside copy floating point value in VP_N64 at 0x030000 to N64value print to UART0 it should find the following at the UART0 N64value:118.37 3.2.10 hmt.writevp64 Function...

Open the catalog to page 7
SmartLCD-LuaFunction-ReferenceNote - 8

Reference Note 3.3 System Functions 3.3.1 hmt.changepage Function hmt.changepage(pageid) Description Change the Smart LCD UI display PAGE Parameter pageid is the target display PAGE to be shown Return Value Nil Example Lua script hmt.changepage(0x02) Descriptions UI show up the PAGE 2 3.3.2 hmt.readpage Function hmt.readpage() Description Read the current display page id Parameter Nil Return Value Integer Example Lua script local pageid = 0 pageid = hmt.readpage() print(“pageid:”, pageid) Descriptions SmartLCD UI is showing PAGE 3 define a local variable pageid and put 0 inside copy the...

Open the catalog to page 8
SmartLCD-LuaFunction-ReferenceNote - 9

Reference Note 3.3.5 hmt.runcmd Function hmt.runcmd(table, num) Description Send a command directly as sending command to the Smart LCD terminal (no command head and command tail) Parameter table is the command byte array to be send num is the number of byte to be send Return Value Nil Example Lua script local cmdtab = {0x5F, 0x04} hmt.runcmd(cmdtab, 2) Descriptions define a local variable array and put 0x5F, 0x04 inside use hmt.runcmd to send 2 byte of local variable array to Smart LCD it will adjust the backlight of the display to dim down Note. 0xF5 is backlight control command; please...

Open the catalog to page 9
SmartLCD-LuaFunction-ReferenceNote - 10

Reference Note UART0 functions UART0 is the default command terminal of the Smart LCD. It may be RS-232C or UART(3.3V) depends on model. Lua print function also using UART0 for default output. Some of the Smart LCD equipped with a second terminal UART1. It may be RS-232C or UART(3.3V) depends on model. 3.4.1 hmt.uartisempty Function hmt.uartisempty() Description Check the UART0 buffer status Parameter Nil Return Value Integer Return 1 for buffer empty; 0 for data in buffer Example Lua script local Uart0state = 0 Uart0state = hmt.uartisempty() print(“Uart0state:”, Uart0state) Descriptions...

Open the catalog to page 10
SmartLCD-LuaFunction-ReferenceNote - 11

Reference Note 3.4.4 hmt.putchar Function hmt.putchar(char) Description Send one byte of data to UART0 Parameter char is the byte of data to be sent (it should be a byte value, not string char) Return Value Integer Example Lua script hmt.putchar(0x41) hmt.putchar(66) Descriptions it should find the following at the UART0 0x41 0x42 (in hex) or AB (in ASCII) 3.4.5 hmt.uartsendbytes Function hmt.uartsendbytes(table, num) Description Send bytes of data to UART0 Parameter table is the data byte array to be send num is the number of byte to be send Return Value Nil Example Lua script local...

Open the catalog to page 11
SmartLCD-LuaFunction-ReferenceNote - 12

Reference Note UART1 functions UART1 is the extend terminal of some of the Smart LCD. It may be RS-232C or UART(3.3V) depends on model. 3.5.1 hmt.uart1isempty Function hmt.uart1isempty() Description Check the UART1 buffer status Parameter Nil Return Value Integer Return 1 for buffer empty; 0 for data in buffer Example Lua script local Uart1state = 0 Uart1state = hmt.uart1isempty() print(“Uart1state:”, Uart1state) Descriptions define a local variable Uart1state and put 0 inside copy the current UART is empty result to Uart1state print to UART0 it should find the following at the UART0...

Open the catalog to page 12

All TOPWAY LCD catalogs and technical brochures

  1. MONO Product

    2 Pages

  2. LMT080TDGP01

    16 Pages

  3. HKT035BTB-1D

    36 Pages

  4. HMT050AMC-C

    17 Pages

  5. HMT043ATA-6C

    31 Pages

  6. TM035PDHG09

    42 Pages

  7. TM035PDHG03

    31 Pages

  8. TM028HDZP01

    28 Pages

  9. LM256160DCW-1

    14 Pages

  10. LM12896FCW-1

    17 Pages

  11. LM12832KCW

    13 Pages

  12. LM2088EFW-9

    12 Pages

  13. LM3122AGG-2

    12 Pages

  14. LM240160YCW

    18 Pages

  15. LM6093ACW

    14 Pages

  16. HMT104ATA-C

    11 Pages

  17. HMT101ATA-D

    36 Pages

  18. HKT080ATA-C

    1 Pages

  19. HMT080ATA

    1 Pages

  20. HKT070DTA-1C

    11 Pages

  21. HMT070DTA-D

    1 Pages

  22. HKT070DMC-2C

    19 Pages

  23. HMT070ETD-C

    31 Pages

  24. HMT070ETD-1D

    34 Pages

  25. HMT056ATA-C

    1 Pages

  26. HMT050CB-1C

    31 Pages

  27. HMT050DTA-D

    1 Pages

  28. HKT050ATA-C

    1 Pages

  29. HMT043ATA-7C

    32 Pages

  30. HMT043GTA-1D

    37 Pages

  31. HKT043BMC-2C

    17 Pages

  32. HMT043ATA-3C

    11 Pages

  33. HMT043BMC-C

    1 Pages

  34. HMT043ATA-4C

    11 Pages

  35. HKT043BMC-C

    1 Pages

  36. HKT043ATA-1C

    12 Pages

  37. HMT035ATA-D

    13 Pages

  38. HMT028ATB-C

    12 Pages

  39. HKT104ATA-C

    31 Pages

  40. HMT068BTA-C

    33 Pages

  41. HMT070ATA-1C

    32 Pages

  42. HMT080ATA-C

    33 Pages

  43. HMT090ATA-C

    30 Pages

  44. HMT101ATA-C

    33 Pages

  45. HMT050ATA-2C

    31 Pages

  46. HMT043ATA-2C

    32 Pages

  47. HMT035ATA-1C

    1 Pages

  48. HMT043FC-1C

    1 Pages