PC Communication Driver
3.4
API Functions Common To All Drivers,
long CElnApi::TransCeive(unsigned char* pbyTxMsg, unsigned char* pbyRxMsg, int nMaxTx int nMaxRx,
int* pnActualLength, int nUnitAddr);
pbyTxMsg:
pbyRxMsg:
nMaxTx:
nMaxRx:
pnActualLength:
nUnitAddr:
This function sends a message to an instrument and receives the response. Make sure that the buffer that
pRxMsg points to is big enough to hold the instrument's reply. If the reply is longer than MaxRx, it will be
truncated and a receive buffer overflow error will be returned.
Although the protocol makes it theoretically possible to transmit new messages while outstanding messages
are pending, this mode will be unsupported for the sake of simplicity
void CElnApi::SoftReset()
This function performs a reset of the port hardware. It shouldn't be necessary to use it, but it has been
necessary in the past when dealing with some particularly ornery SCC chips.
3.5 Anatomy of a Standard Return Value
0 indicates success.
Bit 0-7: Error code returned from instrument if application error occurred.
Bit 8:
Receive buffer overrun.
Bit 9:
Application error; instrument returned ANAK.
Bit 10: Link error; bad CRC.
Bit 11: Physical error; bad framing or parity, timeout.
22
Ptr to the outgoing message.
Buffer ptr for incoming message.
Outgoing msg length.
In buffer size.
Return value in disguise; length of incoming message.
Address of unit.
RS232 Communications Reference Manual
continued
8/99