7 ee memory, 8 long unsigned integer math, Ee memory – High Country Tek emc-3L User Manual

Page 54: Long unsigned integer math

Advertising
background image

4.7 EE Memory

Electronically erasable memory (EE Memory) is memory that is maintained (non volatile) when there is no
power to the DVC710. The DVC710 has 512 usable EE memory locations. EEmemory locations can be used
to interface to the compiled, running DVC program. For instance, if, during troubleshooting, the user wanted to
change between different virtual display screens, the programmer may create an EEmem variable named
‘virtual_screen’. By programming the DVC, the contents of the variable ‘virtual_screen’ could be monitored to
determine which virtual display screen is active. EE memory locations are all unsigned 16-bit values that can
store any number from 0 to 65535. EE memory names can be 32 characters in length. The actual EE memory
is not used while the program is running. A mirror copy in DVC710’s program memory is used to prevent over
usage of the EE memory. There is a special command to save the mirror copy to the EE memory and another
one to copy the EE memory to the program memory location. The EE memory has an approximate 1 million
writes guarantee. If a new value where to be stored every minute, the DVC710 would be guaranteed to run for
1.9 Years.

To save new values to the EE memory, execute this line of code in your application: “EECommand = EEWrite”.
In between writes you will need to reset the EEcommand, “EEcommand = 0”. Also, note that the EE memory
will only be written to if one or more of the EE memory variables has changed. So if you insert the EEcommand
= EEwrite in your always bubble or some other frequently executed logic bubble you are very unlikely to exceed
the 1 million writes limit of the memory chips. A typical sequence of code to update EE memory might look like
the following:

Dim

eememory_update_timer

as

timer

EEcommand = 0

If

(eememory_update_timer = 0s)

then

eememory_update_timer = 2s

' timer set to > 10ms needed to insure at least one EEcommand = 0

' executed between EEcommand = EEwrite commands

EEcommand = EEwrite

End

if


To declare an EE memory variable use this line of code: “Dim VarName as EEmem”

To save all of the EE memory uses this command: “EECommand = EEWrite”

To restore actual EEmemory values to program memory use this line of code: “EECommand = EERead”
EERead (is rarely used but) would be used if you had changed an EE memory variable in your application but
had not saved it to permanent memory and wished to reset the variable to the permanent EE memory value.

Note: When the DVC710 powers up the program memory copy of EE memory is automatically initialized to the
values stored in permanent EE memory. Therefore, you do not need to start your program with an EEread
command.

4.8 Long Unsigned Integer Math

All numeric calculations in the DVC application code is executed with 32 bit resolution. Intermediate values are
stored as 32 bit unsigned integers. However, only the lower 16 bits of the numeric result can be stored into the
applicable variable’s memory location. This allows for intermediate values to temporally grow larger than 65k to
about 4 billion. However, your final result will be restricted to be less than or equal to 65535.

The DVC does only integer math calculations with division resulting in truncation. When you perform division in
a calculation the result will be an integer value with no fractional part or remainder saved. For instance

P/N: 021-00163, Rev. A.0 - for V5.2 Tools

Page | 54

Advertising
This manual is related to the following products: