NVEM0 Directive [D>=15]
The NVEM0 directive is used to mark the boundary between executable code and NVEM0 memory space. SPLat/PC uses it to recognise where to start looking for and processing data for pre-loading into the NVEM0 memory.
There must be only one instance of the NVEM0 directive in your file and it must occur at the END of your program code. NVEM data using the NV0Byte, NV0Ptr, NVfNum directive can then be placed AFTER the NVEM0 directive.
Here's an example:
RTCPushDN
NVSetPtr NLpDays ;point to the string pointer table
NVSetRecLen 2 ;load the pointer..
NVPopRecNum
NVReadToPtr 0 ;..to the string
NVSetRecLen 3 ;there are 3 chars to print
NVSetRecNum 0
OBLCD_NVText 0 ;display them
.. more code ..
NVEM0 ;tell SPLat/PC NVEM data follows
;you cannot have program instructions from here onwards
NLpMon NV0Byte "Mon"
NLpTue NV0Byte "Tue"
NLpWed NV0Byte "Wed"
NLpThr NV0Byte "Thr"
NLpFri NV0Byte "Fri"
NLpSat NV0Byte "Sat"
NLpSun NV0Byte "Sun"
NLpDays
NV0Ptr NLpMon
NV0Ptr NLpTue
NV0Ptr NLpWed
NV0Ptr NLpThr
NV0Ptr NLpFri
NV0Ptr NLpSat
NV0Ptr NLpSun
Using SPLat/PC Builder with multiple files, it's no trouble to ensure you've got just one NVEM0 directive. Just put the NVEM0 directive in its own section and ask builder to include ONLYONE. Here's an example:
-- In your builder.b1d file --
NVEM0DIR ONEONLY ;Marker for the start of non-volatile memory
NVEM0MODBUSDATA ;MODBUS NVEM data goes FIRST!
NVEM0DATA
-- in each of your.spt files --
;<NVEM0DIR>
NVEM0 ;Start of non-volatile memory
;<NVEM0DATA> ;Non-volatile memory data
pXwireMaster
NV0Byte 0,M2SabBuffer,M2SkBufLen,0,0
NV0Byte 255
Source in the NVEM0DIR section will occur just once, then everything in all NVEM0DATA will sections will follow.
For SPLat/PC versions after build 329
From this version of SPLat/PC the NVEM0 directive has become optional. You may now have NVEM page 0 data directives such as NV0Byte, NV0Ptr, NV0fNUM
anywhere in your program. This is particularly handy for supporting a modular style of programming, say with multiple files using #Include.
However there is one restriction: The line label for a NVEM page 0 data line must be on the same line - you can't have the label on one line and the NVEM0 data (or whatever) on the lines below.
Note that from SPLat/PC build 329 you may place NVEM directives anywhere in your code. If you do this, then the line label for an NV0Byte directive must be on the same line. The following is not allowed:
MyTable: **** ILLEGAL!!! *****
NV0Byte 45
NV0Byte 12
Instead, you must say this
MyTable: NV0Byte 45
NV0Byte 12
Please refer to the NVEM0 documentation for more details.