Moog Animatics SmartMotor™ Developer's Guide,Rev. L
Page 160 of 909
l
Always structure the program to minimize writing of the cam table to the EEPROM.
CAUTION: When writing a cam table to EEPROM, structure the program
so that the cam table is not frequently rewritten or written from a loop.
Repeated erasing and rewriting can burn bits and corrupt data.
There are various ways to achieve this—refer to the following code snippet for one
example:
C123 'Example of using EEPROM to flag code that has been run
EPTR=100 'set pointer to EEPROM
VLD(a,1) 'load value
IF a!=123 'if value does not equal 123
'do something here that you want to do only once
'such as write a cam table to nonvolatile memory
EPTR=100 'set EEPROM pointer
a=123 '
VST(a,1) 'write value to EEPROM
ELSE
'something was already done
ENDIF
RETURN
Part 1: Programming: Electronic Camming Notes and Best Practices