Library:  adsComm

Installing   PV reference   VB reference   Samples

Sub CommOpen(Speed As String)

Opens the serial port (COM2) and sets its speed. speed parameter must be chosen in: "110", "300", "600", "1200", "2400","4800", "9600", "14400", "19200", "28800", "38400", "56000","12800", "25600".

Sub CommClose()

Closes the serial port.

Function IsCommOpen() As Boolean

Tests the serial port state.

Return value: True port is open, False otherwise.


Function CommWrite(Data() As Byte, Size As Integer) As Integer

Call this function when the port is open, to send data through the serial port. If you call the function when the port is not open the results are unpredicable (Fixed later). Data is the buffer which contains data to send. Size is assigned the number of bytes to send.

Return values:
ADSCOMM_SUCCESS
ADSCOMM_ERROR_ABORT
ADSCOMM_ERROR_DTE
ADSCOMM_ERROR_BREAK
ADSCOMM_ERROR_PROTOCOL

Function CommRead(Data() As Byte, Size As Integer) As Integer

Call this function when the port is open, to receive data through the serial port. If you call the function when the port is not open the results are unpredicable (Fixed later). Data is the buffer to store incoming data. On input Size is assigned the maximum number of bytes you can receive, on output it will reflect the number of bytes received which will never be greater than the maximum number. If more bytes are received than those you asked for, they will be discarded.

Return values:
ADSCOMM_SUCCESS
ADSCOMM_ERROR_ABORT
ADSCOMM_ERROR_DTE
ADSCOMM_ERROR_BREAK
ADSCOMM_ERROR_PROTOCOL

Sub Abort()

Aborts read and write operations.