Skip to Main Content Skip to Search
Product Documentation

GE Fanuc Embedded Systems Shared Memory

xPC Target supports reflective (shared) memory boards manufactured by GE Fanuc Embedded Systems (http://www.gefanucembedded.com/) – formerly VMIC.

Before You Start

Create Shared Memory Partitions

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.

Initialize Shared Memory Nodes

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.

Shared Memory Structure Reference

Shared Memory Partition Structure

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:

  • single (IEEE Single Precision)

  • double (IEEE Double Precision)

  • uint8

  • int8

  • uint16

  • int16

  • uint32

  • int32

  • Boolean (a single byte represents a boolean value)

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'.

  • scalar — Treats the Size entry as the specification of the length of a non-oriented array or vector

  • [m,n] — Treats the Size entry as an array dimension. The total number of elements in this segment is m*n.

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.

Shared Memory Node Initialization Structure

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:

  • Mode — Configures board registers (see Board Mode)

  • Interrupts — Enables the board to generate PCI interrupts from network events that have been broadcast from other nodes, or in response to error conditions (see Board Interrupts)

  • NodeID — Specifies the node ID for the board (see Board Node ID)

  • Internal — Reserved for internal use

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.

  1. From the MATLAB Command Window, type

    getxpcpci 
    

    This command lists board information for all installed PCI devices that the xPC Target software knows about.

  2. 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.

  3. 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.

  4. From the MATLAB Command Window, type the name of your Simulink model.

    The Simulink model appears.

  5. From the Simulation menu, click Configuration Parameters.

  6. Click the Code Generation tab.

  7. From the Category list, choose xPC Target code generation options.

  8. Set the Execution mode field to Real-Time.

  9. Click the Real-Time interrupt source list.

  10. Select the interrupt number to which the board is set (from step 2).

  11. Click the I/O board generating the interrupt list and select GE_Fanuc(VMIC)_PCI-5565 from the list.

  12. Click OK.

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.

  


Related Products & Applications

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