Extern Read

Target Category: Arduino, Cortex M3, Delfino, F280x, F281X, Generic MCU, Linux AMD64 and Raspberry Pi, MSP430, Piccolo, STM32

Target Sub-Category: Extern

Description: The Extern Read block lets you read an external variable from another C code module into the diagram. If, for the Data Type, you choose hardware register, you can enter a hardware peripheral register name and the block output will produce the value of that register when compiled.

The Extern Read block only allows built-in C data types. This means, for example, that you would specify the unsigned short data type in the Extern Read block to match a uint16 user-defined data type.

When you have a combination of Extern Read and Extern Write blocks, and you require a specific execution order, use the execOrder block to control execution.

You can also use the Extern Read block to integrate handwritten code with generated code.

A screenshot of a computer

Description automatically generated

Assign Address: Assigns the variable a specific address. Specify the address in hexadecimal notation. For MSP430 target only.

Data Type: Specifies the data type of the variable. If you choose hardware register, Embed will only create a reference in the code and not an external declaration. The remaining data types are described below:

<32-bit hardware register>: Accesses predefined 32-bit integer. Typically, the name of a device register.
<16-bit hardware register>: Accesses predefined 16-bit integer. Typically, the name of a device register.
char: Smallest addressable unit. On the MSP430, it is 8 bits; on the C2000, it is 16 bits.
char*: Pointer to a character.
double:
64-bit floating point number.
float: 32-bit floating point number.
int: The natural word length for a given architecture.
long: 32 bits.
MATRIX: Pointer to Embed MATRIX data type. The MATRIX structure is defined in VSUSER.H.
SCALED_INT: 16- or 32-bit depending on word size, which is specified separately.
short: 16 bits.
unsigned: Basic unsigned integer type. Contains at least the [0, 65, 535] range.
unsigned char:
Smallest addressable unsigned unit. On the MSP430, it is 8 bits; on the C2000, it is 16 bits.
unsigned long: Non-negative 32 bits.
unsigned short: Non-negative 16 bits.

Declare This Variable: Forces Embed to declare the variable during code generation.

Declare This Variable as CONST: Adds the const property to the variable declaration.

Define This Variable: If activated, Embed provides global definition for the variable.

External Name: Specifies the name of the variable in the C code module. If you do not enter a name, it defaults to ref.

Radix Point: Sets the binary point.

Word Size: Specifies the word size in bits.