Returns the specified serial-out channel number status.
Gx3722SerialOutGetStatus (nHandle, nChannel, pnChStatus, pnStatus)
Name |
Type |
Comments |
nHandle |
SHORT |
Handle to a GX3722 board. |
nChannel |
SHORT |
Channel to get, channels are 0-2:0. GX3722_SERIAL_PAL_CH0: Channel 0.1. GX3722_SERIAL_PAL_CH1: Channel 1.2. GX3722_SERIAL_PAL_CH2: Channel 2. |
pnChStatus |
PSHORT |
Returns the specified serial-out channel number status:Bit 0: Arm state, when high the serial transmission is armed and waiting for a trigger (software or external).Bit 1: Software Trigger state.Bit 2: Serial Transmission in progress state, 0=Idle, 1= Serial Transmission in progress.Bit 3: Transmission Sent. Read Only. 1=serial word was sent, resets when Arm is OFF. |
pnStatus |
PSHORT |
Returned status: 0 on success, negative number on failure. |
The function may be used to check the status of the specified channel Serial Transmission in progress state, in order to detect when the channel can transmit the next data.
Channels 0-2 can be programmed to operate as serial-out transmitter or as static I/O, see Gx3722SerialOutSetMode() API for more details. When any of Channels 0-2 are set to Serial-out, all 4 channels direction is set to output.
The following example sets all channel 0 settings, and transmit 64-bit data:
SHORT nHandle, nStatus;
Short nChStatus, nChStatus;
DWORD dwMostSigWord, dwLeastSigWord;
// Reset serial-out channel 0
Gx3722SerialOutReset(nHandle, GX3722_SERIAL_PAL_CH0, &nStatus);
// Set the serial-out MS Data to 0x12345678, LS Data = 0xABCDEF12
Gx3722SerialOutSetData(nHandle, GX3722_SERIAL_PAL_CH0, 0x12345678, 0xABCDEF12, &nStatus);
// Resd back the serial-out data settings
Gx3722SerialOutGetData(nHandle, GX3722_SERIAL_PAL_CH0, &dwMostSigWord, &dwLeastSigWord, &nStatus);
printf("Channels 0 Most Sig Word=&i, Least Sig Word=%i", dwMostSigWord, dwLeastSigWord);
// Set serial-out channel 0 mode to Serial-out
Gx3722SerialOutSetMode(nHandle, GX3722_SERIAL_PAL_CH0, GX3722_SERIAL_MODE_TRANSMIT_DATA, &nStatus);
// Set serial-out Trigger Source to software
Gx3722SerialOutSetTriggerSource(nChannel, GX3722_SERIAL_TRIGGER_SOURCE_SOFTWARE, &nStatus);
// Set serial-out Shift Mode MSB shift left
Gx3722SerialOutSetShiftMode(nChannel, GX3722_SERIAL_SHIFT_MODE_LEFT_MSB_FIRST, &nStatus);
// Set serial-out Nummber Of Data Bits to 64
Gx3722SerialOutSetNumOfDataBits(nHandle, GX3722_SERIAL_PAL_CH0, 64, &nStatus);
// Set serial-out Trigger Delay to 0uSec
Gx3722SerialOutSetTriggerDelay(nHandle, 0, &nStatus);
// Set serial-out Bit Rate to 1000uSec/sec
Gx3722SerialOutSetBitRate(nHandle, 1000, &nStatus);
// Set serial-out Data Bits Pulse Width logic high=640uSec, Logic low=320uSec
Gx3722SerialOutSetDataBitsPulseWidth(nHandle, 640, 320, &nStatus);
// Set serial-out Arm to ON
Gx3722SerialOutGetArmState(nHandle, GX3722_SERIAL_PAL_CH0, GX3722_SERIAL_ARM_STATE_ON, &nStatus);
// Issue a software trigger
Gx3722SerialOutTrig(nHandle, GX3722_SERIAL_PAL_CH0, &nStatus);
// Check when transmittion is done
while(1)
{ Gx3722SerialOutGetStatus (nHandle, GX3722_SERIAL_PAL_CH0, &nChStatus, &nStatus);
if ((nChStatus&0x4)==0)
break;
Gx3722SerialOutReset, Gx3722SerialOutSetArmState, Gx3722SerialOutSetBitRate, Gx3722SerialOutSetData, Gx3722SerialOutSetDataBitsPulseWidth, Gx3722SerialOutGetTriggerSource, Gx3722SerialOutSetMode, Gx3722SerialOutSetNumOfDataBits, Gx3722SerialOutSetShiftMode, Gx3722SerialOutSetTriggerDelay, Gx3722SerialOutTrig, GxFpgaGetErrorString