COMM-DRV/Lib: PutPacket() Queues a packet for transmission

Description-

Queues a packet for transmission. This function attempts to output a packet of desired length. This function will output a partial packet. The buffer length specified during the OpenComPort() may be less than the desired packet size. This function will wait for up to the amount of time set by SetTimeout() before returning failure if the entire packet is not written. It will also send the characters out at the pace specified by the SetPaceTime() function.

Syntax-

count = PutPacket(port,len,pkt);

On Entry-

int port;

Port previously opened with InitializePort() or OpenComPort().

int len;

Length of packet to write.

char *pkt;

Pointer to buffer to with packet to transmit.

On Exit-

int count;

Length of packet actually transmitted.

else

-1 If port not initialized.

See Also-

PutByte()
PutString()

Example-

#include <comm.h>
int port=0;
char buf[]="ABCDEF";
if (PutPacket(port,sizeof(buf),buf) != sizeof(buf))
 {
 printf("Entire packet not outputted\n");
 }