Memory & Ranges

From Smart LCD
Revision as of 13:04, 20 October 2025 by Usr255 (talk | contribs) (Created page with "== Memory area == * TOPWAY Smart LCD provide RAM area for variables VP_N16, VP_N32, VP_N64, VP_STR, … * Be aware that data in RAM dissipates when Smart LCD power is cut. * There are multiple storage areas within Smart LCD. * Table below explains those areas and ways to access them. {| class="wikitable" |+ !Int RAM |'''HW RAM area''' * VP_N16/32/64 * VP_STR * VP_G16 | | |- !Int Flash |'''HW Flash area''' * cmd 0x94 W/R * cmd 0x90 W * cmd 0x91 R |'''Partition0''' * Di...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Memory area

  • TOPWAY Smart LCD provide RAM area for variables VP_N16, VP_N32, VP_N64, VP_STR, …
  • Be aware that data in RAM dissipates when Smart LCD power is cut.
  • There are multiple storage areas within Smart LCD.
  • Table below explains those areas and ways to access them.
Int RAM HW RAM area
  • VP_N16/32/64
  • VP_STR
  • VP_G16
Int Flash HW Flash area
  • cmd 0x94 W/R
  • cmd 0x90 W
  • cmd 0x91 R
Partition0
  • Display Project
  • cmd 0x95 R usr.bin
  • Lua R/(W)
Partition2
  • Lua R/W
Ext U-Drv Partition1
  • Lua R/W
Hardware File System

HW RAM area (on-board internal RAM)

  • It is for VP variables (VP_N16, VP_N32, VP_N64, VP_STR, VP_G16,…)
  • VP variables' default values are either 0s or “blank” at startup
  • TRAM is volatile memory
  • VP variables can be accessed by Project Elements, Lua Commands, Serial commands

HW Flash area (on-board internal flash)

  • It can be directly accessed by serial command
  • Serial command 0x94: provides backup or restore function
  • Serial command 0x90: write a data to Hardware Flash area
  • Serial command 0x91: read a from Hardware Flash area
  • Lua access via “hmt.runcmd” that by execute the above commands

Partition 0 (on-board internal flash)

  • Display Project files are stored in this partition
  • Constant data is stored in usr.bin file at design-time. User can use serial command 0x95 to retrieve that.
  • Lua io.open, io.read commands can be used to access the partition (named as “disk0”). For data safety, DON’T use Lua io.write command in Partition 0.

Partition1 (External U-Drv)

  • External USB storage is defined as partition 1.
  • This partition (named as “disk1”) can be accessed by Lua io.open, io.read commands
  • In most of the case, it is for backing up the internal stored data (with Lua script)

Partition2 (on-board internal flash)

  • This partition can be config in SGTools (project config)
  • This partition (named as “disk2”) can be access by Lua io.open, io.read command

Note

We can assign a default value at run-time, by using "Page Function". The function will run before the host page is loaded.

PAGEs, Image-Resources and VP-Variables Ranges

icon Mnemonic Name Linked VP. Linked IMG Editor Limit Memory Limit Address range
PAGE Page -- IMG_BKG ≤1000/project 256M byte (*4) PG0000 ~ PG0999
IMG_BKG Background Image -- -- ≤10000/project

(*1)

DP0000 ~ DP9999
IMG_ICO Icon -- -- ≤10000/project

(*2)

DI0000 ~ DI9999
IMG_ANI Animation -- -- ≤1000/project

(*2)(*3)

ANI000 ~ ANI999
VP_STR String Variable -- -- ≤1024 / project 1024(MAX) x (127+1)byte 0x000000 ~ 0x01FF80
VP_N16 16bit Variable -- -- ≤32512 / project 32512(MAX) x (2)byte 0x080000 ~ 0x08FDFE
VP_N32 32bit Variable -- -- ≤16128 / project 16128(MAX) x (4)byte 0x020000 ~ 0x02FBFC
VP_N64 64bit Variable -- -- ≤7936 / project 7936(MAX) x (8)byte 0x030000 ~ 0x03F7F8
VP_G16 16bit Graph Variable -- -- ≤16384 / project 16384(MAX) x (8)byte

(dynamic array allocation)

0x060000 ~ 0x07FFF8
VP_BP1 Bitmap Variable -- -- ≤2048 / project 2048(MAX) x (64)byte

(dynamic array allocation)

0x060000 ~ 0x05FFBF
VP_REG Register Variable -- -- -- -- 0xFFFF00 ~ 0xFFFFFF
VP_TMR Timer Variable -- -- ≤8 / project -- 0x02FFE0 ~ 0x02FFFC

Note:

*1. IMG_BKG must >1/2 of Full-Screen (SGTools auto resize to fit screen)

*2. IMG_ICON and IMG_ANI Size Limit

Project resolution Size Limit
320x240 320x240 max. (Full-Screen)
480x272 480x272 max. (Full-Screen)
640x480 131072pixels (42% of Full Screen)
800x480 131072pixels (34% of Full Screen)
800x600 131072pixels (27% of Full Screen)
1366X480 131072pixels (20% of Full Screen)

*3. 1~128frame max.

*4. Memory Size may vary by model.

Elements in PAGE Limitation

icon Mnemonic Name Linked VP. Linked IMG Editor Limit Memory Limit ID range
TPK Touch Key -- 1x IMG_ICO or

1x IMG_BKG (*1)

≤256 / PAGE -- 0 ~ 255 (each page)
VPK Virtual Key VP_N16 (*2)

VP_N32 (*2)

-- ≤64 / PAGE -- 0 ~ 63 (each page)
STS Static String -- -- ≤128 / PAGE -- 0 ~ 127 (each page)
STR String Element VP_STR -- ≤128 / PAGE -- 0 ~ 127 (each page)
N16

N32

N64

Number Element VP_N16

VP_N32

VP_V64

-- ≤120 / PAGE --

--

--

0 ~ 119 (each page)
TMR Timer Display VP_N32

(timer only)

-- ≤8 / PAGE -- 0 ~ 7 (each page)
RTC Real Time Clock -- -- ≤8 / PAGE -- 0 ~ 7 (each page)
ICO Static Icon -- 1x IMG_ICO ≤128 / PAGE -- 0 ~ 127 (each page)
ANI Animation Element -- 1x IMG_ANI ≤8 / PAGE -- 0 ~ 7 (each page)
IDX_BIT Bit Icon VP_N16

VP_N32

2(MAX) x IMG_ICON ≤64 / PAGE -- 0 ~ 63 (each page)
IDX Indexed Icon VP_N16 10000(MAX) x IMG_ICON ≤64 / PAGE -- 0 ~ 63 (each page)
TCM Tachometer VP_N16 181(MAX) x IMG_ICON --
I16

I32

Decimal Icon VP_N16

VP_N32

12x IMG_ICON

(0~9,”.”,”-“)

≤32 / PAGE -- 0 ~ 31 (each page)
B16 Progress Bar VP_N16 1x IMG_ICON ≤32 / PAGE -- 0 ~ 31 (each page)
G16 Graph Element VP_G16 -- ≤8 / PAGE -- 0 ~ 7 (each page)
BP1 Bitmap Element VP_BP1 -- ≤32 / PAGE -- 0 ~ 31 (each page)
QRC QR Code Element VP_STR

VP_N16 (in seq.)

-- ≤4 / PAGE -- 0 ~ 3 (each page)
DPD Draw Pad VP_N16 (in seq.) -- ≤4 / PAGE -- 0 ~ 3 (each page)

Note:

*1. IMG_ICO for key-down display, IMG_BKG will be cropped to key size for key-down display

*2. Monitoring values

*3. Element display Size: 8x8 (MIN), except Bitmap Element

*4. The above limitation is to ensure the display performance, though it can be override by the “config.ini” in the SGTools installation folder. (Remember to backup the file before edit!)

System Registers

Address System Register Descriptions Note
0xFFFF00

:

0xFFFF07

Timer_Ctrl0

:

Timer_Ctrl7

D[0]=0 : stop the timer

D[0]=1 : start the timer

D[1]=0 : count down, time down to 0x00000000

D[1]=1 : count up, time up to 0x7fffffff

D[7:2]=000000 : reserved

(*1)
0xFFFF10 RTC_Year Value=0~99 0xffff10~0xffff16

should be written at the same time

0xFFFF11 RTC_Month Value=1~12
0xFFFF12 RTC_Day Value=1~31
0xFFFF13 RTC_Hour Value=0~23
0xFFFF14 RTC_Minute Value=0~59
0xFFFF15 RTC_Second Value=0~59
0xFFFF16 RTC_Set Value=1 : sync the time
0xFFFF20 Buzzer Value=0~63; buzzer beeping duration (*1) See Project Setting for details
0xFFFF21 Backlight Value=0~63; Real time backlight brightness setting (*1)
0xFFFF22 ScreenSaverBacklight Value=0~63; Screen Saver Backlight Brightness (*1) see Screen Saver section for details
0xFFFF23 ScreenSaverPage_H Value=0~999; Screen Saver display Page (*2)
0xFFFF24 ScreenSaverPage_L
0xFFFF25 ScreenSaver Timer1_H Value=0~65535; Screen saver delay time 1 (*2)
0xFFFF26 ScreenSaver Timer1_L
0xFFFF27 ScreenSaver Timer2_H Value=0~65535; Screen saver delay time 2 (*2)
0xFFFF28 ScreenSaver Timer2_L
0xFFFF30 Font_CodePage Font Code Page index value (*1) (*3)
0xFFFF31 Font_Country Font Country index value (*1) (*4)

Note:

*1. Value can be update by command System_register_write (0xb3) to access the register

*2. Value should be written at the same time by command Sucesstive_write (0x82)

*3. Code Page index value

index Code Page .......... index Code Page
1 437(OEM United States) 12 1252(ANSI Latin I)
2 737(OEM Greek437G) 13 1253(ANSI Greek)
3 852(OEM Latin II) 14 1254(ANSI Turkish)
4 860(OEM Portuguese) 15 1255(ANSI Hebrew)
5 863(OEM Canadian French) 16 1256(ANSI Arabic)
6 865(OEM Nordic) 17 1257(ANSI Baltic)
7 866(OEM Russian) 18 1258(ANSI/OEM Viet Nam)
8 874(ANSI/OEM Thai) 19 GB2312 (Simplified Chinese)
9 932(ANSI/OEM Japanese Shift JIS) 20 GBK (Simplified Chinese)
10 1250(ANSI Central Europe) 21 ECU-KR ( Korea )
11 1251(ANSI Cyrillic) 22 BIG5 (Traditional Chinese)
0 uni-code (with font config <3> TTF)

*4. Country index value

index Code Page .......... index Code Page
1 USA 7 DenmarkⅡ
2 France 8 Sweden
3 Germany 9 Italy
4 UK 10 Spain
5 DenmarkⅠ 11 Japan
6 DenmarkⅡ