SharedMem-VI-Tree.vi

This is a tool that provides two things.

1) Memory that can be shared between different Windows applications (shared memory).

2) Global memory for applications (not shared between different Windows applications)

The functionality is provided by a dll whic can be distributed under the terms of the GPL. This instrument driver is a wrapper around that dll.

Attached is a small program test2.exe. It writes the numbers 0..99 to the first 100 bytes of the shared memory. Then it writes the number 17 to the first 10 bytes. Then, every 100ms, it writes a loop index to the first 10bytes.

History: Version 0.0, 8th of April 2004

Copyright (C)

Gesellschaft für Schwerionenforschung, GSI

Planckstr. 1

64291 Darmstadt

Germany

Contact: D.Beck@gsi.de

This program is free software; you can redistribute it and/or modify it under the terms of the

GNU General Public License as published by the Free Software Foundation; either version 2 of the license, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General License for more details (http://www.gnu.org).

Gesellschaft für Schwerionenforschung, GSI

Planckstr. 1, 64291 Darmstadt, Germany

For all questions and ideas contact: D. Beck, M.Richter@gsi.de or H.Brand@gsi.de.

Last update: 07-APR-2004


Connector Pane

SharedMem-VI-Tree.vi


Front Panel

SharedMem-VI-Tree.vi


Block Diagram

SharedMem-VI-Tree.vi


SharedMem_CreateBuffer.vi

Creates a global memory buffer. The name of the memory buffer is an optional feature and limited to 32 characters. If the name is specified, another buffer with the same name must not exist. This function always creates a new buffer. In order to link to an existing buffer one can use the functions GetBuffID, GetBufferName and GetBufferPointer.

Returns the pointer to the global memory or 0, if not successful.


Connector Pane

SharedMem_CreateBuffer.vi


Front Panel

SharedMem_CreateBuffer.vi


Block Diagram

SharedMem_CreateBuffer.vi

SharedMem_CreateBuffer.vi

SharedMem_CreateBuffer.vi


SharedMem_DestroyBuffer.vi

Destroys a global memory buffer.

Returns the ID of the buffer or -1, if not successful.


Connector Pane

SharedMem_DestroyBuffer.vi


Front Panel

SharedMem_DestroyBuffer.vi


Block Diagram

SharedMem_DestroyBuffer.vi

SharedMem_DestroyBuffer.vi


SharedMem_GetBuffer.vi

Copies data from a global memory buffer to a buffer.

Returns the number of bytes copied or 0, if not successful.


Connector Pane

SharedMem_GetBuffer.vi


Front Panel

SharedMem_GetBuffer.vi


Block Diagram

SharedMem_GetBuffer.vi

SharedMem_GetBuffer.vi

SharedMem_GetBuffer.vi


SharedMem_GetBufferID.vi

Gets the ID of a global memory buffer.

Returns the ID of the buffer or -1, if not successful.


Connector Pane

SharedMem_GetBufferID.vi


Front Panel

SharedMem_GetBufferID.vi


Block Diagram

SharedMem_GetBufferID.vi

SharedMem_GetBufferID.vi

SharedMem_GetBufferID.vi


SharedMem_GetBufferName.vi

Gets the name of a global memory buffer. The name has a length of up to 32 characters.

Returns the ID of the buffer or -1, if not successful.


Connector Pane

SharedMem_GetBufferName.vi


Front Panel

SharedMem_GetBufferName.vi


Block Diagram

SharedMem_GetBufferName.vi

SharedMem_GetBufferName.vi

SharedMem_GetBufferName.vi


SharedMem_GetBufferPointer.vi

Gets the pointer to the global memory buffer.

Returns the pointer to the buffer or 0, if not successful.


Connector Pane

SharedMem_GetBufferPointer.vi


Front Panel

SharedMem_GetBufferPointer.vi


Block Diagram

SharedMem_GetBufferPointer.vi

SharedMem_GetBufferPointer.vi

SharedMem_GetBufferPointer.vi


SharedMem_GetBufferSize.vi

Gets the size of a global memory buffer.

Gets the size of the buffer or 0, if not successful.


Connector Pane

SharedMem_GetBufferSize.vi


Front Panel

SharedMem_GetBufferSize.vi


Block Diagram

SharedMem_GetBufferSize.vi

SharedMem_GetBufferSize.vi

SharedMem_GetBufferSize.vi


SharedMem_InitBuffer.vi

Initializes a global memory buffer with the specified value.

Returns the size of the global memory buffer in bytes or 0, if not successful.


Connector Pane

SharedMem_InitBuffer.vi


Front Panel

SharedMem_InitBuffer.vi


Block Diagram

SharedMem_InitBuffer.vi

SharedMem_InitBuffer.vi

SharedMem_InitBuffer.vi


SharedMem_SetBuffer.vi

Copies a buffer into a global memory buffer.

Returns the number of bytes copied or 0, if not successful.


Connector Pane

SharedMem_SetBuffer.vi


Front Panel

SharedMem_SetBuffer.vi


Block Diagram

SharedMem_SetBuffer.vi

SharedMem_SetBuffer.vi

SharedMem_SetBuffer.vi

SharedMem_SetBuffer.vi


SharedMem_GetProcCounter.vi

Gets the number of processes that are connected to the dll.


Connector Pane

SharedMem_GetProcCounter.vi


Front Panel

SharedMem_GetProcCounter.vi


Block Diagram

SharedMem_GetProcCounter.vi

SharedMem_GetProcCounter.vi


SharedMem_GlobalMemApplicationExample.vi

This example demonstrates how to pass data from one thread to another thread via global memory.


Connector Pane

SharedMem_GlobalMemApplicationExample.vi


Front Panel

SharedMem_GlobalMemApplicationExample.vi


Block Diagram

SharedMem_GlobalMemApplicationExample.vi

SharedMem_GlobalMemApplicationExample.vi


SharedMem_error_message.vi

Contains all the instrument-specific error codes and descriptions.

In case of an error, this VI adds the error message to the error source.

Optionaly, an error message pops up.

History: 05-APR-2004, Dietrich Beck

Copyright (C)

Gesellschaft für Schwerionenforschung, GSI

Planckstr. 1

64291 Darmstadt

Germany

Contact: D.Beck@gsi.de

This program is free software; you can redistribute it and/or modify it under the terms of the

GNU General Public License as published by the Free Software Foundation; either version 2 of the license, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General License for more details (http://www.gnu.org).

Gesellschaft für Schwerionenforschung, GSI

Planckstr. 1, 64291 Darmstadt, Germany

For all questions and ideas contact: D. Beck, M.Richter@gsi.de or H.Brand@gsi.de.

Last update: 05-APR-2004


Connector Pane

SharedMem_error_message.vi


Front Panel

SharedMem_error_message.vi


Block Diagram

SharedMem_error_message.vi

SharedMem_error_message.vi

SharedMem_error_message.vi


SharedMem_GetSharedBuffer.vi

Copies data from the shared memory to a buffer.

Returns the number of bytes copied or 0, if not successful.


Connector Pane

SharedMem_GetSharedBuffer.vi


Front Panel

SharedMem_GetSharedBuffer.vi


Block Diagram

SharedMem_GetSharedBuffer.vi

SharedMem_GetSharedBuffer.vi

SharedMem_GetSharedBuffer.vi


SharedMem_SetSharedBuffer.vi

Copies a buffer into a the shared memory.

Returns the number of bytes copied or 0, if not successful.


Connector Pane

SharedMem_SetSharedBuffer.vi


Front Panel

SharedMem_SetSharedBuffer.vi


Block Diagram

SharedMem_SetSharedBuffer.vi

SharedMem_SetSharedBuffer.vi

SharedMem_SetSharedBuffer.vi


SharedMem_GetSharedBufferSize.vi

Gets the size of the shared memory.

Gets the size of the buffer or 0, if not successful.


Connector Pane

SharedMem_GetSharedBufferSize.vi


Front Panel

SharedMem_GetSharedBufferSize.vi


Block Diagram

SharedMem_GetSharedBufferSize.vi

SharedMem_GetSharedBufferSize.vi

SharedMem_GetSharedBufferSize.vi


SharedMem_GetSharedBufferPointer.vi

Gets the pointer to the shared memory.

Returns the pointer to the buffer or 0, if not successful.


Connector Pane

SharedMem_GetSharedBufferPointer.vi


Front Panel

SharedMem_GetSharedBufferPointer.vi


Block Diagram

SharedMem_GetSharedBufferPointer.vi

SharedMem_GetSharedBufferPointer.vi

SharedMem_GetSharedBufferPointer.vi


SharedMem_SharedMemApplicationExample.vi

This example demonstrates how to pass data from one thread to another thread via shared memory.


Connector Pane

SharedMem_SharedMemApplicationExample.vi


Front Panel

SharedMem_SharedMemApplicationExample.vi


Block Diagram

SharedMem_SharedMemApplicationExample.vi


SharedMem_SharedMemSpeedTest.vi

Measures the transfer speed for a read/write cycle of shared memory in Mbytes/s.


Connector Pane

SharedMem_SharedMemSpeedTest.vi


Front Panel

SharedMem_SharedMemSpeedTest.vi


Block Diagram

SharedMem_SharedMemSpeedTest.vi


SharedMem_GlobalMemSpeedTest.vi

Measures the transfer speed for a read/write cycle of global memory in Mbytes/s.


Connector Pane

SharedMem_GlobalMemSpeedTest.vi


Front Panel

SharedMem_GlobalMemSpeedTest.vi


Block Diagram

SharedMem_GlobalMemSpeedTest.vi


SharedMem_Data2ByteArray.vi

Converts data to an array of unsigned bytes (unsigned char). If desired, this function converts the data from Motorola to Intel format.

Remark: LabVIEW stores data in Motorola format (even on an Intel machine). So if you would like to share data with other applications via memory buffers one should take care of that conversion.


Connector Pane

SharedMem_Data2ByteArray.vi


SharedMem_ByteArray2Data.vi

Converts from an array of unsigned bytes (unsigned char) to data. If desired, this function converts the data from Intel to Motorola format.

Remark: LabVIEW stores data in Motorola format (even on an Intel machine). So if you would like to share data with other applications via memory buffers one should take care of that conversion.


Connector Pane

SharedMem_ByteArray2Data.vi