GtDio6xWriteVectorMemory

Applies To

GX5296, GX5961, GX5964, File

Purpose

Writes one or more vectors to one or more channels.

Syntax

GtDio6xWriteVectorMemory (nHandle, lChannelCount, palChannelList, lVectorStart, lVectorSize, psVectors, pnStatus)

Parameters

Name
Type
Comments
nHandle
SHORT
Session identifier:

     Board handle is used when communicating with the hardware. The Board handle session identifier is returned by calling GtDio6xInitialize or GtDio6xSetupInitialization.

     File handle is used when communicating with a file. The File handle session identifier is  returned by calling GtDio6xFileOpen.

lChannelCount
LONG
Used to specify the number of channels in the ChannelList Array.
palChannelList
LONG
An array to specify the channels to write to.
lVectorStart
LONG
Used to specify the start vector.
lVectorSize
LONG
Used to specify the number of vectors to write.
pcVectors
PCHAR
Used to program the Vector data. The array passed must contain at least as many elements as specified by lVectorSize*lChannelCount. See comments below for additional information.
pnStatus
PSHORT
Returned status: 0 on success, negative value on failure.

Comments

The psVectors array contains character elements that represent opcodes that are to be written to the Vector Memory. To index into this array use the following formula: lChannelCount*lVector+lChannel. For example, to access the opcode for vector 6, channel 4, in an array representing 43 channels the following code would be used:

sVectors[43*6+4]=’H’;

There are fourteen pattern codes. The following table lists how each pattern code affects the driver/comparator:

Pin Action
Data OpCode
Driver
Comparator Expect
Invert Code
Disable channel
'Z'
Off
X
None
Disable Channel ‘Z’
Collect CRC
'C'
Off
X
Enable CRC
Collect CRC ‘C’
Drive Low
'0'
On
DVH
None
Drive Low ‘0’
Drive High
'1'
On
DVL
None
Drive High ‘1’
Repeat Previous Code
'R'
Repeats the last non-repeat/invert code.
Invert Previous Code
'I'
Inverts the last non-repeat/invert code. Refer to Invert Code column of this table.
Expect Valid Low
'L'
Off
X
< CVL
Expect Valid High ‘H’
Expect Valid High
'H'
Off
X
> CVH
Expect Valid Low ‘L’
Expect Valid
'V'
Off
X
< CVL or > CVH
Expect Invalid ‘B’
Expect Invalid
'B'
Off
X
> CVL and < CVH
Expect Valid ‘V’
Drive Low, Expect Low
'l'
On
DVL
< CVL
Drive High, Expect High ‘h’
Drive High, Expect High
'h'
On
DVH
> CVH
Drive Low, Expect Low ‘l’
Drive Low, Expect High
‘/’
On
DVL
> CVH
Drive High, Expect Low ‘\’
Drive High, Expect Low
‘\’
On
DVH
< CVL
Drive Low, Expect High ‘/’

Example

The following example writes the ‘h’ opcode (drive high, expect high) to 2000 vectors. Each vector contains data for 64 channels.

 

LONG alChannelListArray [64];

CHAR  pcWriteVectors[64*2000];

CHAR  pcReadVectors[64*2000];

SHORT nStatus, I, y;

 

// Fill the vectors

for (i=0; i<2000; i++) //2000 Vectors

{

    for(y=0; y<64; y++) //64 Channels per Vector

        pcSteps[i*64+y]=’h’;

}

for (i=0; i<64; i++) //64 Channel array (0-63)

    alChannelListArray[i]=i;

 

GtDio6xWriteVectorMemory(nHandle, 64, alChannelListArray, 0, 2000, pcWriteVectors, &nStatus);

 

GtDio6xReadVectors(nHandle, 64, alChannelListArray, 0, 2000, pcReadVectors, &nStatus);

 

See Also

GtDio6xReadVectorMemory, GtDio6xFillVectors, GtDio6xGetErrorString