7526 DCT Reference


Reference&mdash.Communications Ports (Serial)

(Ref #8.) reference&mdash.Communications Ports (Serial)

ComInit

This function sets up the asynchronous communcations parameters (transmit/receive speed and data word format) for one of the two optional RS-232 serial ports on the 7526 terminal. The transmit and receive buffers are also flushed during this function (clearing any characters in the receive buffer which have arrived but have not yet been read with ComRead, and aborting the transmission of any characters remaining in the transmit buffer).

This function will override any settings for this port which may have been stored in the File 0, Record 0 configuration data (File 0, Record 0 data will be re-instated if the 7526 is power-cycled or goes through an off-line/on-line cycle).

The defaults if File 0, Record 0 does not contain valid values are 9600 bps, 8 data bits, no parity, 2 stop bits.

This function requires V3.00 microcode or higher and requires either the optional Ethernet-Serial-Parallel (ESP) or Serial-Parallel (SP) adapter to be installed in the 7526.

C Format

     #include   "cfrapi26.h"           // For defined values
 
     USHORT     ComInit(com_num, baud, parity, stopbits, databits)
 
     UCHAR      com_num               // Physical port: SERIAL_1 or SERIAL_2
     UCHAR      baud                  // Speed: BAUD_110, BAUD_150, BAUD_300,
                                      //        BAUD_1200, BAUD_2400, BAUD_4800,
                                      //        BAUD_9600, or BAUD_19200
     UCHAR      parity                // Parity: PARITY_NONE, PARITY_ODD,
                                      //         or PARITY_EVEN
     UCHAR      stopbits              // Stop bits: STOP_BITS_1 or STOP_BITS_2
     UCHAR      databits              // Data bits: DATA_BITS_6, DATA_BITS_7,
                                      //            or DATA_BITS_8
 
     Returns:   E_OK               // If no error occurred
                E_PARAM            // If parameter values are invalid
                E_NOT_PRESENT      // If the ESP or SP card is not installed
 

Example

int far main (int funct,char far *params)

ComQuery

This function queries the asynchronous communcations parameters (transmit/receive speed and data word format) for one of the two optional RS-232 serial ports on the 7526 terminal. Because ComInit will purge any characters in the transmit and receive buffers, ComQuery is useful to determine if the current port setttings are equivalent to the new port settings -- thus allowing you to avoid unnecessary initialization of the port.

This function requires V3.00 microcode or higher and requires either the optional Ethernet-Serial-Parallel (ESP) or Serial-Parallel (SP) adapter to be installed in the 7526.

C Format

     #include   "cfrapi26.h"           // For defined values
 
     USHORT     ComQuery(com_num, settings )
 
     UCHAR      com_num               // Physical port: SERIAL_1 or SERIAL_2
     CHAR       settings[4]           // Pointer to an array of 4 characters which
                                      // will receive the port settings.  Baud rate
                                      // is returned in the first character:
                                      //  BAUD_110, BAUD_150, BAUD_300,
                                      //  BAUD_1200, BAUD_2400, BAUD_4800,
                                      //  BAUD_9600, or BAUD_19200
                                      // Parity is returned in the second character:
                                      //  PARITY_NONE, PARITY_ODD, PARITY_EVEN
                                      // Number of Stop bits is returned in the
                                      // third character:
                                      //  STOP_BITS_1 or STOP_BITS_2
                                      // Number of Data bits is returned in the
                                      // fourth character:
                                      //  DATA_BITS_6, DATA_BITS_7, or DATA_BITS_8
 
     Returns:   E_OK               // If no error occurred
                E_PARAM            // If parameter values are invalid
                E_NOT_PRESENT      // If the ESP or SP card is not installed
 

Example

int far main (int funct,char far *params)

ComRead

This function retrieves up to 256 characters from the receive buffer of one of the two optional RS-232 serial ports on the 7526 terminal. Characters are automatically buffered by the 7526 as they are received from attached devices. This command allows you to use data characters which have been received up to this point in time.

You may attempt read any number of characters from 1 to 256. The function will return either the maximum of the number of characters you specified or the number of characters available to read. Any unread characters remain in the buffer and are avaiable for the next call to this function.

not null-terminated.

Read with a buflen of 0 and check the function return code in order to detect if data is waiting without actually reading the data.

This function requires V3.00 microcode or higher and requires either the optional Ethernet-Serial-Parallel or Serial-Parallel adapter to be installed in the 7526.

C Format

     #include   "cfrapi26.h"           // For defined values
 
     USHORT     ComRead(com_num, buflen, buffer, count)
 
     UCHAR      com_num               // Physical port: SERIAL_1 or SERIAL_2
     USHORT     buflen                // The maximum number of characters
                                      // you want to read at one time.
     UCHAR *    buffer                // Pointer to buffer where you want the
                                      // data copied
     USHORT *   count                 // Count storage to be filled in by the
                                      // ComRead function indicating number of
                                      // characters actually copied to your buffer
 
 
     Returns:   E_OK               // If no error occurred
                E_PARAM            // If parameter values are invalid
                E_NO_DATA          // If no data is available to read

Example

int far main (int funct,char far *params)

ComWrite

This function sends up to 256 characters out on one of the two optional RS-232 serial ports on the 7526 terminal. Characters are automatically transmitted by the 7526 after they are transferred into its outbound buffers using this command.

This function requires V3.00 microcode or higher and requires either the optional Ethernet-Serial-Parallel or Serial-Parallel adapter to be installed in the 7526.

C Format

     #include   "cfrapi26.h"           // For defined values
 
     USHORT     ComWrite(com_num, buflen, buffer, count)
 
     UCHAR      com_num               // Physical port: SERIAL_1 or SERIAL_2
     USHORT     buflen                // The maximum number of characters
                                      // you want to send at this time.
     UCHAR *    buffer                // Pointer to buffer where you have the
                                      // data which is to be transmitted
     USHORT *   count                 // Count storage to be filled in by the
                                      // ComWrite function indicating number of
                                      // characters actually sent.
 
 
     Returns:   E_OK                  // If no error occurred
                E_PARAM               // If parameter values are invalid
                E_NO_DATA             // If insufficient buffer space is available --
                                      // No data was sent.

Example

int far main (int funct,char far *params)