| Contents | Index |
xPC Target supports reflective (shared) memory boards manufactured by GE Fanuc Embedded Systems (http://www.gefanucembedded.com/) – formerly VMIC.
| On this page… |
|---|
The xPC Target software uses a model for reflective memory (also known as shared memory) that includes Simulink blocks for shared memory driver functions and MATLAB structures to define node initialization and shared memory partitions. This topic describes the xPC Target support of the GE Fanuc Embedded Systems VMIPCI-5565 (formerly from VMIC) and PCI-5565PIORC boards. Both the VMIPCI-5565 and PCI-5565PIORC boards are fully supported and will be collectively referenced as PCI-5565 in the documentation. The xPC Target library supports these boards with the same set of blocks.
To use the xPC Target PCI-5565 shared memory blocks, you must define shared memory partition structures. A partition structure describes how you want to allocate (partition) the shared memory. The xPC Target software allocates shared memory as segments of data that are packed into memory regions or partitions. Along with the Shared Memory Pack and Shared Memory Unpack blocks, the following PCI-5565 blocks use shared memory partition structures:
After defining the shared memory partitions, you can add PCI-5565 shared memory driver blocks to your Simulink model. See Shared Memory Partition Structure for the complete list of fields in a partition.
The following description refers to the completepartitionstruct command. Type
help completepartitionstruct
for more information.
Create a partition structure in one of the following ways. Using the completepartitionstruct command at the MATLAB Command Window, create a default partition structure. For example, type
Partition = completepartitionstruct([],'5565')
Partition =
Address: '0x0'
Type: 'uint32'
Size: '1'
Alignment: '4'
Internal: [1x1 struct]
At the MATLAB Command Window, create a user-defined partition structure. The easiest way to do this is to create a script file, partially define a structure, load that script into the MATLAB workspace, and supplement the resulting structure with a call to the completepartitionstruct function. For example
Partition(1).Address='0x5000'; Partition(1).Type='int8'; Partition(1).Size='10'; Partition(2).Type='uint16'; Partition(2).Size='5'; Partition(3).Type='uint8'; Partition(3).Size='1'; Partition(3).Alignment='8'; Partition(4).Type='double'; Partition(4).Size='3';
This example defines a partition with four segments.
The Address field is optional. Only specify this field for the first segment of a partition. The elements of a partition are defined as a continuous memory block from the first address. The function extrapolates segment addresses from the first segment definition. If you have or require fragmented memory, use multiple partitions.
The Type and Size fields are required for all segments in the partition structure.
The Alignment value is optional. It is '4' by default, which forces segments that do not have alignment specifications to start on 4 byte (32 bit) boundaries. In the preceding partition definition, the third segment (Partition(3)) has an alignment of '8'.
The base addresses of subsequent segments are defined by the data type, size, and alignment of the preceding segment.
Call the completepartitionstruct() command to fully populate the partition structure.
Partition = completepartitionstruct(Partition,'5565');
In addition to shared memory partitions, you must also define a node initialization structure before using the PCI-5565 shared memory blocks. A node initialization structure describes the shared memory partitions (see Create Shared Memory Partitions) and the PCI-5565 board configuration, including any interrupt settings if used. The following PCI-5565 block requires a shared memory node initialization structure.
After defining the node initialization structure, you can add PCI-5565 shared memory driver blocks to your Simulink model. See Shared Memory Node Initialization Structure for the complete list of fields in a node initialization structure.
The following description refers to the completenodestruct command. Type
help completenodestruct
for more information.
Create a node initialization structure in one of the following ways. Using the completenodestruct command at the MATLAB Command Window, create a default node initialization structure. For example, type
node=completenodestruct([],'5565')
node =
Interface: [1x1 struct]
Partitions: [1x1 struct]Now modify the structure fields to meet your requirements. For example:
node.Interface.NodeID = '128'; node.Partitions = Partition;
A user-defined node structure, created with MATLAB code or from the MATLAB Command Window and supplement the resulting structure with a call to the completenodestruct function. For example:
node.Interface.NodeID = '128'; node.Partitions = Partition; node.completenodestruct(node,'5565');
You do not need to use all the fields of a partition initialization structure. However, knowing the possible structure fields will be helpful when you are setting up to use shared memory.
A shared memory partition structure has the following fields:
Address: '0x0'
Type: 'uint32'
Size: '1'
Alignment: '4'
Internal: [1x1 struct]where
Partition Fields | Description |
|---|---|
Address | Specifies the base address (in hexadecimal) of the memory partition within the node's shared memory space. The default value is '0x0', the first location in shared memory. Align partition addresses on 32-bit word boundaries (for example, 0x0, 0x4, 0x8, and so forth). |
Type | Specifies the data type of the memory segment. Specify one of the following types:
The default value is 'uint32'. A minimum partition size is 32 bits. |
Size | Specifies the dimension and size of the memory segment. You can enter a scalar value or a value with the [m,n] format. The default value is '1'.
|
Alignment | If another partition precedes this partition, defines the byte alignment of this segment. Specify one of the following alignment values: 1, 2, 3, 4, or 8. The default value is '4'. This value forces a double word boundary alignment for all elements. |
Internal | Reserved for internal use. |
A node initialization structure has the following fields:
Interface: [1x1 struct]
Partitions: [1x1 struct]
where
Node Structure Fields | Description |
|---|---|
Interface | Specifies how the board is configured. The Interface structure has the following fields, three of which are structures:
|
Partitions | Stores the shared memory segments (see Create Shared Memory Partitions) |
Board Mode. The PCI-5565 board has a number of registers that you can set through the Interface.Mode field. To display the board mode fields, type
>> node.Interface.Mode
ans =
StatusLEDOff: 'off'
TransmitterDisable: 'off'
DarkOnDarkEnable: 'off'
LoopbackEnable: 'off'
LocalParityEnable: 'off'
MemoryOffset: '0'
MemorySize: '64MByte'Note that mode values affect the PCI-5565 board setting of the LSR1 (Local Control and Status Register 1) and LIER (Local Interrupt Enable Register) registers. Refer to the PCI-5565 product documentation for further details on these two registers. To monitor the status of these modes, select the Error Status Port check box of the GE Fanuc 5565 read or GE Fanuc 5565 write block.
Of particular note are the following modes:
Board Modes | Description |
|---|---|
StatusLEDOff | Turns the PCI-5565 board status LED on and off. Setting this value to 'off' turns off the LED when the xPC Target model runs, setting this value to 'on' turns on the LED when the xPC Target model runs. When the xPC Target software terminates, the LED status reverses in both cases. The default value is 'off'. |
MemoryOffset | Applies a global offset to all network data transfers coming from the PCI-5565 board. The following table lists offset values and the resulting offset. The default value is '0'. |
MemorySize | Specifies the minimum memory size required. The PCI-5565 driver checks this value against the memory size of the PCI-5565 board. A PCI-5565 board has a memory size of either '64MByte' or '128MByte'. If you enter a size in this field that is larger than the actual PCI-5565 board memory size, the driver will return an error. The default value is '64MByte'. |
This table lists the values for MemoryOffset:
Value | Offset Produced |
|---|---|
'0' | 0 |
'1' | 0x4000000 |
'2' | 0x8000000 |
'3' | 0xC000000 |
Board Interrupts. The PCI-5565 board can generate PCI interrupts in response to network events that have been broadcast from other nodes, or in response to error conditions. For example, you can configure two xPC Target Simulink models, one as master, and one as a slave of the broadcast node in the master xPC Target model. In such a configuration, the broadcast node interrupt triggers the model's time steps.
To display the interrupt mode fields, type
>> node.Interface.Interrupts
ans =
LocalMemoryParity: 'off'
MemoryWriteInhibited: 'off'
LatchedSyncLoss: 'off'
RXFifoFull: 'off'
RXFifoAlmostFull: 'off'
BadData: 'off'
PendingInit: 'off'
RoguePacket: 'off'
ResetNodeRequest: 'off'
PendingInt3: 'off'
PendingInt2: 'off'
PendingInt1: 'off'Each field corresponds to a bit in the LIER register of the PCI-5565 board. Each bit enables the specified interrupt source on the PCI-5565 board. Refer to the PCI-5565 product documentation for further details on this register.
To enable a node to generate a network interrupt source, add the 5565 broadcast block to a model (for example, the master model). This block issues network interrupts at the model sample rate. Correspondingly, to enable other nodes of the network (for example, the slaves) to accept broadcast interrupts from the model, configure the slave model to expect the broadcast interrupt.
The following procedure describes how to configure an entire xPC Target model to accept a broadcast interrupt from a PCI-5565 board. See GE Fanuc 5565 broadcast for a description of the Interrupt parameter value that the xPC Target model expects.
From the MATLAB Command Window, type
getxpcpci
This command lists board information for all installed PCI devices that the xPC Target software knows about.
Find the IRQ specified for the PCI-5565 board.
This is the interrupt source number you need to specify in the xPC target code generation options field in step 10 of the following procedure.
Edit your script and add a line like the following.
node.Interface.Interrupts.PendingInt1='on'
This line directs the model to expect an interrupt. It assumes that the value of the 5565 broadcast block Interrupt parameter is 1.
From the MATLAB Command Window, type the name of your Simulink model.
The Simulink model appears.
From the Category list, choose xPC Target code generation options.
Select the interrupt number to which the board is set (from step 2).
Click the I/O board generating the interrupt list and select GE_Fanuc(VMIC)_PCI-5565 from the list.
Note If you have a larger model, and you want to localize control of the interrupt within that model, use the IRQ Source block from the Asynchronous Event sublibrary. |
Board Node ID. The jumpers of the PCI-5565 board specify the board node ID. Correspondingly, you can also configure the PCI-5565 block with the board node ID using the Interface.NodeID field. Enter values according to the following:
NodeID Value | Description |
|---|---|
'any' | Allows the PCI-5565 driver to work with any PCI-5565 node regardless of the PCI-5565 board node ID jumper setting |
value from '0' to '255' | Specifies the particular PCI-5565 node that the driver must look for. If this value does not match the jumpered value on the PCI-5565 board, the driver returns an error. |
The default value of 'any' suffices in most instances. However, you might want to specify a particular NodeID value if you have multiple PCI-5565 boards in your system and you want to identify the driver for a particular node.
![]() | Shared Memory Support | GE Intelligent Platforms Shared Memory | ![]() |

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.
| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |