Extra Development Blocks

From NewEagleWiki
Jump to navigation Jump to search

A

MotoHawk:Blocks:Absolute Time

This MotoHawk® block outputs the current time since reset. If Output Mode is set to Seconds, the output will be a double data type, and the precision will be in floating point. This means that as time progresses, the exponent will grow and the precision of the mantissa will shift toward more significant bits.

NOTE: Be aware that, if set to Microseconds, after 4294967296 microseconds (the largest 32-bit value, a little under 72 minutes), the time value starts over at zero. Prepare to handle this accordingly.

B

MotoHawk:Blocks:Build Time/Date Stamp

This MotoHawk® block adds probes for the current build time and date, so that the model version information is visible in MotoTune.

C

MotoHawk:Blocks:Code Coverage

Placing this MotoHawk® block in a subsystem creates a MotoTune interface that will contain a bit that is set whenever this subsystem is run. This is useful for performing code coverage testing. In MotoTune, under the group 'Code Coverage', will be a list of all of these bits. The enumeration shown in MotoTune will be the model path if the subsystem has not run, and a '-' if it has. Any subsystem displaying its path in MotoTune therefore has not been executed.

MotoHawk:Blocks:Code Coverage Manager

Placing this MotoHawk® block in a model allows you to control the generation of code coverage instrumentation code.

MotoHawk:Blocks:Critical Buffer

This MotoHawk® block implements a Critical Region around the buffering of a pass-through signal.

D

MotoHawk:Blocks:Debug Counter

This MotoHawk® block drops in a simple counter, visible from MotoTune, to see if the current subsystem is executing.

MotoHawk:Blocks:Debug Counter Evaluated

This MotoHawk® block drops in a simple counter, visible from MotoTune, to see if the current subsystem is executing. The default expression for the Probe Name uses the name of the current subsystem (without spaces).

MotoHawk:Blocks:Debug Counter Evaluated Triggered

This MotoHawk® block drops in a simple counter, visible from MotoTune, to see if the given trigger is executing. The default expression for the Probe Name uses the name of the current subsystem (without spaces).

MotoHawk:Blocks:Debug Counter Triggered

This MotoHawk® block drops in a simple counter, visible from MotoTune, to see if the given trigger is executing.

MotoHawk:Blocks:Delta Time

This MotoHawk® block outputs the delta time since the last time this block was called (in seconds).

If a positive 'Sample Time' is entered, this constant value will be output every time. The output data type will be the same as the 'Sample Time' parameter. In this case, the 'Initial Value' parameter is unused.

If a zero or negative 'Sample Time' is entered, the block will calculate the delta time, and the block will output 'Initial Value' the first time it is called.

Using a constant sample time is more efficient than an inherited sample time, because it does not generate extra code and RAM to dynamically calculate the delta time. Note that the block still runs with inherited sample-time in the Simulink environment, regardless of what is entered. It is legal to insert a 'wrong' value into the Sample Time (a value that doesn't actually represent the number of seconds between executions), and the block will happily output that value.

MotoHawk:Blocks:Display Variable Event Boolean

This MotoHawk® block creates a Display variable in MotoTune which causes the output event boolean to be true for one tick, when the popup is set. The Display variable will automatically clear.

MotoHawk:Blocks:Display Variable Event Function Call

Creates a Display variable in MotoTune which causes the output event function-call to occur when the popup is set. The Display variable will automatically clear.

F

MotoHawk:Blocks:Find

This MotoHawk® block, given a set of booleans, finds the first one that is set to true, and outputs the index, starting with 0.

If no input is set to true, outputs -1.

The option, 'Input as Vector', performs the same operation on a vector of booleans, instead of individual ports. When 'Input as Vector' is unchecked, the operation can be vectorized. When 'Input as Vector' is checked, set 'Number of Inputs' to -1, to let the vector width be dynamically determined by downstream blocks, or provide a number to constrain the size.

MotoHawk:Blocks:Force Module Reset

This MotoHawk® block forces a Module Reset.

MotoHawk:Blocks:Function Call Collector

This MotoHawk® block sits in an inherited subsystem, and it triggers the downstream subsystem once every 'count' times this block is processed. It acts like a function call clock divider.

MotoHawk:Blocks:Function Call Collector 2 Optimized

This MotoHawk® block sits in an inherited subsystem, and it triggers the downstream subsystem once every second time this block is processed. It acts like a function call clock divider.

MotoHawk:Blocks:Function Call Collector Input

This MotoHawk® block sits in an inherited subsystem, and it triggers the downstream subsystem once every 'count' times this block is processed. It acts like a function call clock divider.

I

MotoHawk:Blocks:Injector Diagnostics

This MotoHawk® block monitors the output of the Injector Sequence block, and checks for open/short conditions. It outputs vectors for the Open and Short status, appropriate for demuxing and connecting to Fault Definition blocks.

MotoHawk:Blocks:Inline Code

This MotoHawk® block provides for simple inlining of C statements into the generated code. The Include section will be inserted at the top of the main include file The Start section will be inserted into the mdlStart function The Output section will be inserted into the mdlOutput function

Note that each of these parameters is evaluated, so strings must be enclosed in single quotes. This allows workspace variables be evaluated for code generation.

M

MotoHawk:Blocks:Main Power Relay Control

This MotoHawk® block provides basic control of the main power relay, by following the ECUP voltage input pin. Regardless of where the block is placed in a design, the strategy will execute every 50ms with background priority.

Note that this block is simply composed of other primitive MotoHawk blocks and may be used as a starting point for a more complicated strategy.

On Delay: Once the ECU power goes high, after this period, the Main Power Relay will be turned on. Off Delay: Once the ECU power goes low, after this period, the Main Power Relay will be turned off.

Note that one tick before MPRD is turned off, non-volatile variables will be stored, and the Shutdown event will be posted. It is not necessary to use the Shutdown event.

MotoHawk:Blocks:Model Number

This block outputs this control module's Model or Serial Number that is permanently programmed at time of manufacture. Outputs a vector of 8 uint8s, which are in ASCII format.

MotoHawk:Blocks:Model Version Requirements

This MotoHawk® block allows requirements for the MATLAB version and MotoHawk version to be placed into a model.

P

MotoHawk:Blocks:Pack

This MotoHawk® block packs signals into an array of bytes, according to a pack specification function. The given function must be on the MATLAB path.

MotoHawk:Blocks:Print String

This MotoHawk® block provides standard sprintf() functionality for formatting a string. After formatting the string, it calls the "trigger" output for each character, after setting the "character" output to the corresponding uint8 ASCII value. This block can be directly connected to the Serial Transmit block.

Number of Variables: The number of variables that appear in the format string.

Format String: The format string used to generate the output string. This string may contain the standard sprintf() formats: %d, %h, %s, %f, etc.

This block does not work with current versions of MotoHawk and the powerpc-eabispe 4.4.0 compiler, which is used for the MPC55xx based controllers. It will compile with the Green Hills compiler and the GCC PowerPC EABI 4.4.0 SP1. This issue will be fixed in upcoming versions of MotoHawk by adding support for the GCC 4.6.0 SPE, which can use the block.

R

MotoHawk:Blocks:Random Number

This MotoHawk® block outputs a 32 bit random number generated by ControlCore.

MotoHawk:Blocks:Read Global Expression Evaluated

This MotoHawk® block inserts a stub to call an arbitrary global function or expression returning a scalar variable. Title and Port Label are only used to label the block.

Include Statement inserts code at the top of the generated C code file, to import declarations from a header file. Signature inserts a line directly preceding the expression. This can be used to extern functions or variables. Expression in inserted inline, to update the signal value. Return Data Type must be selected to declare the signal data type in Simulink.

The values placed into this block are not checked. A compiler or linker error will occur if there are errors.

MotoHawk:Blocks:Real Time Clock Definition

This MotoHawk® block sets up the Real Time Clock resource.

Name: Name given to the resource and used in set and read blocks to reference this resource.

Resource: Module resource this block is associated with.

MotoHawk:Blocks:Real Time Clock Read

This MotoHawk® block reads the current date and time from the real time clock.

Name: Name specified in Real Time Clock Definition block that this block references.

minute offset from utc: Time differential in minutes from UTC

year: year

month: 0-11 = January-December

week number: 1-52

day of week: 0-6 = Sun-Sat

hour of day: hour

minute of hour: minute

second of minute: seconds

milliseconds of the second: milliseconds

day light saving: 1=DST

Day since Jan1 of the year: day of the year

MotoHawk:Blocks:Real Time Clock Set

This MotoHawk® block sets the current date and time from the real time clock.

Name: Name specified in Real Time Clock Definition block that this block references.

minute offset from utc: Time differential in minutes from UTC

year: year

month: 0-11 = January-December

week number: 1-52

day of week: 0-6 = Sun-Sat

hour of day: hour

minute of hour: minute

second of minute: seconds

milliseconds of the second: milliseconds

day light saving: 1=DST

Day since Jan1 of the year: day of the year

MotoHawk:Blocks:Replicate

This MotoHawk® block replicates the input signal value across all output signals. Given a scalar as input and a vector as output, it will copy the input value to each of its outputs. The block will also work with non-scalar inputs, as long as the output width is a multiple of the input width. Set 'Output Signal Width' to -1 to let the width be dynamically determined by downstream blocks.

MotoHawk:Blocks:Restore to Factory Default

This MotoHawk® block creates a MotoTune display variable to restore the given Nonvolatile Data Store via an event popup.

S

MotoHawk:Blocks:Same Data Type

This MotoHawk® block causes all inputs to use the same data type. It has no code generation or simulation overhead.

This block is very similar to the block in the Fixed-Point blockset provided by the MathWorks or in the native palette of Simulink R14. It is provided here as a convenience to users of older versions of Simulink.

MotoHawk:Blocks:Shutdown Power

For the ECU565-128 module, execute this MotoHawk® block to turn off the power supply to the microprocessor. This block has no effect on other modules.

U

MotoHawk:Blocks:Unpack

This MotoHawk® block unpacks an array of bytes into signals, according to a pack specification function. The given function must be on the MATLAB path.

Example of Pack/Unpack File

function [names, packed_data_types, start_bits, widths, endians, packed_bytes, scales, offsets, signal_data_types] = motohawk_pack_example()

packed_bytes = 8;

names = {
'ain00'
'ain01'
'ain02'
'ain03'
};

%    SS_DOUBLE  =  0,    /* real64_T  */
%    SS_SINGLE  =  1,    /* real32_T  */
%    SS_INT8    =  2,    /* int8_T    */
%    SS_UINT8   =  3,    /* uint8_T   */
%    SS_INT16   =  4,    /* int16_T   */
%    SS_UINT16  =  5,    /* uint16_T  */
%    SS_INT32   =  6,    /* int32_T   */
%    SS_UINT32  =  7,    /* uint32_T  */
%    SS_BOOLEAN =  8     /* boolean_T */
packed_data_types  = [
5
5
5
5
];

%    SS_DYNAMICALLY_TYPED  =  -1,    /* real_T    */
signal_data_types  = [
0
0
0
0
];

start_bits  = [
48
32
16
0
];

widths      = [
16
16
16
16
];

% 0 - Big Endian
% 1 - Little Endian
endians     = [
0
0
0
0
];

scales     = [
5/1024
5/1024
5/1024
5/1024
];

offsets     = [
0
0
0
0
];