I am an old hand at LabVIEW, but a newbie to RT.
I have a 7041 RT plug-in board, having 512k of shared memory.
I want to transfer part of my program to the RT board, and use shared memory (rather than TCP, etc.) to communicate (for speed reasons).
My existing code, which works well in the Windows target, needs to move several clusters across the divide between targets.
The existing VIs handle the simple types, and arrays, but no clusters. I could convert my clusters to arrays, but I would lose clarity ("MaxSpeed" is more descriptive than index "16").
When you drill down far enough in the shared-memory VI code, you come to a DLL which has the following interface:
long PeekBlockByName(CStr deviceName unsigned lo
ng offset, char *data, unsigned long size);Since the PEEK BYTE BY NAME and PEEK LONG BY NAME, etc., all use this same DLL function, I have to believe it's a generic function. Just pass it a pointer and a size, and data gets moved.
I am considering writing a READ and WRITE vi for each of my clusters (3 or 4 different types). Each VI would pass the appropriate arguments to the DLL.
Since my clusters might contain arrays, of variable length, the BYTE OFFSET is not known beforehand. So I would store the first cluster at byte offset 0, the next at byte offset 10,000 or something (way more than necessary), the third at offset 20,000, etc.
Since I have 512k available, the waste is not relevant.
I will of course have to implement my own handshake (the receiver should only perform the read if there is NEW data there, otherwise use the old value).
I will possibly have to include the array size, so the reader knows how many bytes to read.
Any flaws in my thinking?