Data Storage Blocks: Difference between revisions
(Created page with '==C== ===MotoHawk:Blocks:Convert Reference to Integer=== This MotoHawk® block converts the custom reference_T data type, which is output by a MotoHawk Data Storage Definition …') |
No edit summary |
||
Line 88: | Line 88: | ||
==R== | ==R== | ||
===MotoHawk:Blocks:Restore All NonVolatile Data from Factory Defaults=== | |||
When this MotoHawk® block is triggered, all original NonVolatile definitions are reloaded from FLASH. These are the values provided in the 'Initial Value' field of the MotoHawk Data Definition block. | |||
[[Image: RestoreBlock.JPG]] | |||
===MotoHawk:Blocks:Restore NonVolatile Data from Factory Default=== | |||
When triggered, the named NonVolatile Data Store definition will be reloaded from FLASH. This is the value provided in the 'Initial Value' field of the MotoHawk Data Definition block. | |||
[[Image: RestoreBlock2.JPG]] | |||
==S== | |||
===MotoHawk:Blocks:Size Of Block=== | |||
This MotoHawk® block will return the size of the specified VarDec. It will output either the number of bytes, the total number of elements (rows * columns), number of rows, or the number of columns based on the output format. The output port data type is selected via the output data type parameter. | |||
[[Image:SizeBlock.JPG]] | |||
===MotoHawk:Blocks:Store NonVolatile Data=== | |||
When this MotoHawk® block is triggered, all NonVolatile definitions are saved to EEPROM, for later restoration. Note that if your model contains a Main Power Relay block from the Extra Development Blocks library, it will perform this action at controlled shutdown, prior to switching off the relay. | |||
[[Image:StoreBlock.JPG]] | |||
===MotoHawk:Blocks:Structure Declaration=== | |||
This MotoHawk® block defines the fields for a structure, the default values for those fields, and what enumeration should be used for each field. | |||
[[Image:StructDeclareBlock.JPG]] |
Revision as of 12:55, 17 June 2010
C
MotoHawk:Blocks:Convert Reference to Integer
This MotoHawk® block converts the custom reference_T data type, which is output by a MotoHawk Data Storage Definition Block, into a uint32. Note that using the value of a raw pointer is highly unpredictable, and not recommended. This is here primarily for debugging references, because Probes cannot be directly connected to a reference_T type.
D
MotoHawk:Blocks:Data Definition Block
This MotoHawk® block defines data to be accessed via a MotoHawk Data Read or Data Write block. The 'Data Name' provides a globally unique name, accessible from anywhere in the model. It is illegal to have duplicate names. 'Storage Class' identifies the behavior of the data on the target. Volatile data will return to its 'Initial Value' on every startup. NonVolatile data will be saved in EEPROM, and return to the last written value on startup. An additional signal output will be present when 'Output Data Reference' is checked, which is of data type 'reference_T'. This is a pointer to the data, and may be used by the Data Read and Write blocks, to perform pointer-based access to data structures.
Checking 'Attach a VarDec for visibility in MotoTune' will show similar parameters as the Calibration block. If unchecked, the variable will not be available from MotoTune. A Structure Instance can be defined with the data type "struct". A structure name must be provided and must match the structure name specified in a "Structure Declaration" block. MotoTune VarDecs for structures are not specified in this block, but can be specified with the "Create Structure VarDec" block.
MotoHawk:Blocks:Data Read Block
This MotoHawk® block reads a value from data defined by a MotoHawk Data Definition Block. The 'Data Source' may be resolved by name, or by explicitly providing a dynamic reference signal. If "Structure Name" is selected, then the name of the structure instance must be specified along with the name of the field. If "Structure Reference" is selected, then the field is selected and a structure reference is provided as an input. The 'Data Structure' may be a Scalar, Vector, or Matrix. If Vector or Matrix is selected, an option is available to either output the entire data structure as a vector or matrix signal, or to use zero-based index inputs to determine the appropriate item within a larger data structure. The selection for 'Data Structure' and 'Data Type' must match the definition. An error is given if this does not match when the data source is by name. However, if the source is by input reference, the tool will not provide static error checking.
If 'No operation when null reference is input' is checked, an explicit check for a null pointer will be done, and zero will be output from the block. If this is unchecked, null pointers will cause a crash on the target. Note that no type, bounds, or data structure checking is ever provided on the target. Such issues will be caught by simulation, with explicit warnings.
MotoHawk:Blocks:Data Reference
This MotoHawk® block outputs reference(s) to the given data by name(s), using the signal data type 'reference_T'. It may be used by the MotoHawk Data Read or Data Write blocks, to perform pointer-based access to data structures.
MotoHawk:Blocks:Data Write Block
This MotoHawk® block writes a value to data defined by a MotoHawk Data Definition Block. The 'Data Source' may be resolved by name, or by explicitly providing a dynamic reference signal. If "Structure Name" is selected, then the name of the structure instance must be specified along with the name of the field. If "Structure Reference" is selected, then the field is selected and a structure reference is provided as an input. The 'Data Structure' may be a Scalar, Vector, or Matrix. If Vector or Matrix is selected, an option is available to either output the entire data structure as a vector or matrix signal, or to use zero-based index inputs to determine the appropriate item within a larger data structure. The selection for 'Data Structure' and 'Data Type' must match the definition. An error is given if this does not match when the data source is by name. However, if the source is by input reference, the tool will not provide static error checking.
If 'No operation when null reference is input' is checked, an explicit check for a null pointer will be done, and zero will be output from the block. If this is unchecked, null pointers will cause a crash on the target. Note that no type, bounds, or data structure checking is ever provided on the target. Such issues will be caught by simulation, with explicit warnings.
MotoHawk:Blocks:Data Storage
This block describes MotoHawk® data storage.
F
MotoHawk:Blocks:Fixed NonVolatile Manager
This MotoHawk® block allows placement of data stores with a known order in the Nonvolatile portion of your controller’s memory. This block may be used when particular variable(s) of the controller software must be maintained, even through various controller software upgrades.
N
MotoHawk:Blocks:NonVolatile Definition Block
This MotoHawk® block configures the behavior of the Non-Volatile data in the module after programming. On shutdown (or when the Store NonVolatile Data block is used), the RAM copy of Non-Volatile data is stored in Serial EEPROM. On the next startup, the module will use the previously saved values.
When the module is started the first time after programming with a new .srz, there are two options:
- Try to use the previously stored values from the previous program
- Use the factory default values as stored in the .srz file
Note that the previously stored values may only be used if the same NonVolatile variables are available in the new program as in the old one. If the stored NonVolatile variables do not match up with those expected by the new program, they will be restored from factory defaults, regardless of this setting.
Changing the model name, adding or removing any NonVolatile variables, or modifying the name, data type or size of any NonVolatile variables will force reloading from factory defaults. Any other changes to the model will not force reloading from factory defaults, and may therefore be used by the new program.
MotoHawk:Blocks:NonVolatile Status
This MotoHawk® block outputs the current status of the NonVolatile memory. Note that there is always a Display variable indicating this status available in MotoTune called NonVolatileStatus.
0: NV Currently Loading from Factory FLASH to RAM - This is set while performing the copy from factory defaults in FLASH to the working copy in RAM
1: NV Currently Loading from EEPROM to RAM - This is set while performing the copy from stored EEPROM values to the working copy in RAM
2: NV Currently Storing from RAM to EEPROM - This is set while performing the copy from the working area in RAM to the serial EEPROM
3: NV Loaded Factory FLASH due to change Format ID - This occurs when the stored EEPROM values do not match the structure expected by the model.
4: NV Loaded Factory FLASH due to CRC Failure - This occurs if the last stored values are corrupt, due to a power failure during write or bad memory
5: NV Loaded Factory FLASH due to User Request - This occurs if the user requested that factory defaults be reloaded into RAM, even though the values in EEPROM are OK.
6: NV Loaded Last Stored Values from EEPROM - This normally occurs when the model restarts, and no errors occur
R
MotoHawk:Blocks:Restore All NonVolatile Data from Factory Defaults
When this MotoHawk® block is triggered, all original NonVolatile definitions are reloaded from FLASH. These are the values provided in the 'Initial Value' field of the MotoHawk Data Definition block.
MotoHawk:Blocks:Restore NonVolatile Data from Factory Default
When triggered, the named NonVolatile Data Store definition will be reloaded from FLASH. This is the value provided in the 'Initial Value' field of the MotoHawk Data Definition block.
S
MotoHawk:Blocks:Size Of Block
This MotoHawk® block will return the size of the specified VarDec. It will output either the number of bytes, the total number of elements (rows * columns), number of rows, or the number of columns based on the output format. The output port data type is selected via the output data type parameter.
MotoHawk:Blocks:Store NonVolatile Data
When this MotoHawk® block is triggered, all NonVolatile definitions are saved to EEPROM, for later restoration. Note that if your model contains a Main Power Relay block from the Extra Development Blocks library, it will perform this action at controlled shutdown, prior to switching off the relay.
MotoHawk:Blocks:Structure Declaration
This MotoHawk® block defines the fields for a structure, the default values for those fields, and what enumeration should be used for each field.