Browse
(440) 299-7778
Menu
(440) 299-7778
One-year parts and labor warranty30-day money-back guaranteeEnglishEspañolContact

The text of a manual · part 18 of 19

PDT 3200 Run-Time Library Reference Manual: Chapter 3 Serial Communications, pages 153 to 160

Pages 153 to 160 of 168, from PDT 3200 Run-Time Library Reference Manual

The original document is the PDF (949 KB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.

For the Symbol PDT-3200

Page 153

Chapter 3: Serial Communications

SIO_Open sio.h Syntax PORT* SIO_Open (BYTE portid, UINT size_rb, UINT size_wb);

Description Initializes the communications port, setting up interrupts (if requested) and setting the port parameters to default values. All necessary memory buffers are allocated here, and various ßags are set to indicate that the port is being used.

Parameters portid size_rb size_wb

Communications port to open. SIO_COM1 indicates COM1. SIO_COM2 indicates COM2. Size of the read buffer. If zero is speciÞed, read interrupts are not enabled for this port. Size of the write buffer. If zero is speciÞed, write interrupts are not enabled for this port.

Returns Pointer to a port structure that contains the characteristics of the opened port.

Sample #include <stdlib.h> #include “sio.h” #include “filexfer.h” void main (void) { BYTE FileName[] = “MYDATA.TXT”; PORT

*port = NULL;

// Define a string to // transmit. // Define the comm port.

// Disable automatic port close. The default is TRUE. SIO_AutoClose (FALSE); // Open Com2 with a read interrupt buffer. port = SIO_Open(SIO_COM2, 300, 0);

3-17

Page 154

PDT 3200 Run-Time Library Reference Manual

// Setup the comm port for 19,200 baud, XMODEM protocol port->baudrate = SIO_BAUD_19K; port->protocol = SIO_XMODEM; port->RTS = TRUE; SIO_SetComm (port); // Transfer the file SIO_FileTransfer (port, FileName, SIO_FLG_TRANSMIT, 0); // Close COM2 SIO_Close (port); }

3-18

// Not needed if SIO_AutoClose() hadn’t // been called above.

Page 155

Chapter 3: Serial Communications

SIO_Read sio.h Syntax int SIO_Read (PORT *port, char szBuffer[], int nlen);

Description Reads the speciÞed number of characters from the speciÞed port.

Parameters port szBuffer nlen

Communications port from which to read. See PORT Data Structure for the port structure deÞnition. Character array to store the data read. Number of characters to read.

Returns The number of characters read, or a negative value if an error occurs. If an error occurs, call SIO_GetCommError() to determine the nature of the error.

Sample None.

3-19

Page 156

PDT 3200 Run-Time Library Reference Manual

SIO_SetComm sio.h Syntax void SIO_SetComm (PORT *port);

Description Sets the communications port parameters based upon a provided structure.

Parameters port

Communications port structure. See PORT Data Structure for the port structure deÞnition.

Returns None.

Sample See SIO_Open().

3-20

Page 157

Chapter 3: Serial Communications

SIO_Ticks sio.h Syntax ticks_t SIO_Ticks(void);

Description Gets the number of timer ticks since midnight. There are 18.2 timer ticks every second.

Parameters None.

Returns Timer ticks since midnight.

Sample None.

3-21

Page 158

PDT 3200 Run-Time Library Reference Manual

SIO_Time sio.h Syntax DWORD SIO_Time(void);

Description Gets the number of seconds since midnight.

Parameters None.

Returns Seconds since midnight.

Sample None.

3-22

Page 159

Chapter 3: Serial Communications

SIO_Write sio.h Syntax int SIO_Write (PORT *port, char szBuffer[], int nlen);

Description Writes the speciÞed number of characters to the speciÞed port.

Parameters port szBuffer nlen

Communications port where data is sent. Character array containing data to be written. Number of characters to write.

Returns The number of characters written, or a negative value if an error occurs. If an error occurs, SIO_GetCommError() should be called to determine the nature of the error.

Sample None.

3-23

Page 160

PDT 3200 Run-Time Library Reference Manual

3-24