Home
WSC_REF - MarshallSoft Computing
Contents
1. e Return WSC_IE NOPEN Port not opened Call SioReset first e Return WSC_IE BADID No such port e Return 0 DSRis clear e Return gt 0 DSRis set EXAMPLE Code SioDSR Port ALSO SEE See SioRead 16 2 12 SioDTR Set clear or read Data Terminal Ready DTR SYNTAX SioDTR Port Cmd Port I Port selected Cmd I DTR command see below REMARKS The SioDTR function controls the Data Terminal Ready DTR bit in the modem control register DTR should always be set when communicating with a modem NAME FUNCTION WSC_SET LINE to set DTR ON WSC_CLEAR LINE to clear DTR OFF WSC_READ LINE to read DTR RETURNS e Return WSC_IE NOPEN Port not opened Call SioReset first e Return WSC_IE BADID No such port e Return WSC_RANGE Not one of S C or R e Return 0 DTR is clear READ_LINE Command e Return gt 0 DTR is set READ_LINE Command EXAMPLE Code SioDTR Port WSC_SET_LINE ALSO SEE SioRead 17 2 13 SioEvent Efficiently waits for serial event SYNTAX SioEvent Port Mask Port I Port selected ask 1 Event Mask see below REMARKS The SioEvent function WIN32 WIN64 only waits blocks until the condition specified in Mask is satisfied SioEvent returns unblocks only for events that occur after it is called Multiple conditions can be OR ed to
2. DTR will be set at port initialization if DTR_Default is 1 else DTR will be cleared This is also the case for RTS_Default RETURNS e Return WSC_IE BADID No such port e Return WSC_IE OPEN Already open e Return WSC_IE MEMORY Cannot allocate memory e Return WSC_IE HARDWARE Hardware error EXAMPLE Code SioReset Port 1024 1024 ALSO SEE SioBaud SioParms and SioDone 34 2 30 SioRI Reads the Ring Indicator RI modem status bit SYNTAX SioRI Port Port I Port selected REMARKS The SioRI function is used to read the Ring Indicator RI modem status bit It is recommended that incoming rings be detected by looking for the text RING in the input stream rather than the RI signal since some modems do not set the RI reliably RETURNS e Return WSC_IE NOPEN Port not opened Call SioReset first e Return WSC_IE BADID No such port e Return 0 RI is clear e Return gt 0 RIis set RING has occurred EXAMPLE Code SioRI Port ALSO SEE SioRead 35 2 31 SioRTS Sets clears or reads the Request to Send RTS SYNTAX SioRTS Port Cmd Port I Port selected Cmd I RTS command SET CLEAR or READ REMARKS The SioRTS function controls the Request to Send RTS bit in the modem control register The RTS line is used by some error correcting modems to implement hardware flow control RTS is dropped by
3. Port I Port selected REMARKS The SioRxQue function will return the number of bytes in the receive queue not the UART at the time of the call RETURNS e Return WSC_IE NOPEN Port not opened Call SioReset first e Return WSC_IE BADID No such port EXAMPLE Code SioRxQue Port ALSO SEE See SioTxQue 2 34 SioRxWait Waits For Specified Number of Incoming Bytes SYNTAX SioRxWait Port BytesWanted Timeout Port I Port selected BytesWanted I Number of bytes wanted before returning Timeout I Number of milliseconds before timing out REMARKS The SioRxWait function will return once BytesWanted bytes are available to read or if the timeout period is exceeded RETURNS e Return WSC_IE NOPEN Port not opened Call SioReset first e Return WSC_IE BADID No such port e Return WSC_TIMEOUT Timed out EXAMPLE Code SioRxWait Port 100 3500 ALSO SEE See SioRxQue 39 2 35 SioSetInteger Sets integer parameter for serial processing SYNTAX SioSetInteger Port ParamName ParamValue Port I Port selected ParmName I Parameter name integer code ParmValue L Parameter value REMARKS The parameter values defined are as follows NAME FUNCTION WSC_ WAIT ON PUTS Complete I O before returning W WSC _ SIGNAL Signal thread blocking on SioEvent S WSC_OVERLAPPED Force overlapped I O 0
4. Buffer 128 RETURNS The Win32 Win64 numeric error code 51 3 Modem I O Functions 3 1 mioBreak Aborts the Modem I O state driver SYNTAX mioBreak Port Port I Port selected REMARKS The mioBreak function forces the MIO driver to the IDLE state abandoning any work in progress if any Itis used to abort mioSendTo mioQuiet and mioWaitFor functions RETURNS Return MIO_IDLE EXAMPLE Code mioBreak Port 52 3 2 mioDriver Modem I O state driver SYNTAX mioDriver Port Port I Port selected REMARKS The mioDriver function executes the next state of any previously started MIO function such as mioSendTo mioWaitFor and mioQuiet Returns MIO_IDLE defined in MIO H if idle not running MIO_RUNNING if running and anything else that is a character from the modem that can be displayed if wanted RETURNS e Return MIO IDLE if the driver is ready for the next mioSendTo mioWaitFor or mioQuiet e Return MIO RUNNING ifthe driver is not idle e Return lt else gt ifthe driver is not idle and the returned character was received from the modem EXAMPLE Code mioDriver Port 53 3 3 mioQuiet Waits for Modem I O state driver SYNTAX mioQuiet Port Wait Port I Port selected Wait L Wait in milliseconds REMARKS The mioQuiet function waits for continuous quiet no incoming serial data of Wait milliseconds before returning Any incoming characte
5. SYNTAX xyGetParameter Port Parm Port I Port Selected Parm 1 Parameter to return REMARKS The parameter value corresponding to the following table is returned NAME FUNCTION XY GET VERSION Returns XYM version a b c XY GET BUILD Returns XYM build number XY GET ERROR CODE Driver error code see XYM H XY GET ERROR STATE Error state if in error XY GET_PACKET Current packet number XY GET STATE Current state see XYDRIVER C XY GET FILE SIZE File size XY GET NBR_NAKS Get number of packets ACK ed XY GET_LAST GET Last incoming serial character XY GET_LAST PUT Last outgoing serial character XY GET GET COUNT Number of incoming characters bytes XY_GET PUT COUNT Number of outgoing characters bytes XY_GET DRIVER COUNT Number times xyDriver was called XY_GET SHORT PACKETS Get number of short packets RX side only XY_GET PACKETS ACKED Get number of packets ACK ed i Cannot recognize parameter The xyGetParameter function can be used to check the state of the driver For example 1 xyGetParameter Port XY_GET_STATE returns XY_IDLE if idle 2 xyGetParameter Port XY_GET_ERROR_CODE returns the driver error code if an error has occurred or XY_NO_ERROR 0 otherwise RETURNS See above EXAMPLE Code xyGetParameter Port XY
6. See above EXAMPLE Code xySetParameter Port XY SET EOF CHAR 0 66 4 10 xySetString Set Upload Download Directory String SYNTAX xySetString Port ParamName ParamString Port I Port to use ParamName I Parameter name ParamString P Pointer to parameter string REMARKS They location of the local upload download directory can be specified by passing XY_SET FILES DIRas the ParamName and a pointer to the requested directory as ParamString If the local upload download directory is not specified then the current directory is the default location RETURNS e Return gt 0 No error e Return 1 ParamName is not recognized EXAMPLE C C Example Code xySetString Port XY SET FILES DIR C WINDOWS TEMP BASIC Example Code xySetString Port XY SET FILES DIR C WINDOWS TEMP ALSO SEE None 67 4 11 xyStartRx Start XMODEM or YMODEM receive SYNTAX xyStartRx Port Filename NCGchar Batch Port I Port to use Filename P File to receive XMODEM only NCGchar I NAK C or G Batch I YMODEM flag T F REMARKS The xyStartRx starts the XMODEM or YMODEM file receive Once started calls to xyDriver are made to execute the next state or states The xyStartTx function returns immediately The protocols supported and their parameters are as follows Protocol NCGchar
7. FILE ERROR Specified file is empty XY NO _ STARTUP_CHAR ERROR Must specify NAK C or G XY NOT_NCG_ERROR Expected NAK C or G XY_DISK_READ ERROR Error reading disk XY_NO_EOT_ACK_ERROR EOT was not ACK ed XY_INTERNAL_ ERROR Internal error XY_CANCELLED_ ERROR Other side canceled XY OUT_OF_SYNC_ERROR Protocol has lost synchronization XY RETRIES_ERROR Packet retry limit was exceeded XY BAD PACKET NBR ERROR Incorrect packet number XY TIMED_OUT_ERROR Timed out waiting for other side XY_NO_SUCH_FILE ERROR No such file XY_NOT_ ACTIVE ERROR Port not acquired by xyAcquire XY_PORT_RANGE_ERROR Port number out of range The numerical value for each error code is listed in the file wscErrors txt located in the DOCS subdirectory 70
8. GET VERSION 64 4 8 xyRelease Releases driver port SYNTAX xyRe lease REMARKS The xyRelease function releases the ports that were previously acquired with xyAcquire This function should be called before calling the WSC function SioDone RETURNS e Return 0 No error XY_NO_ERROR e Return lt 0 XYDRIVER error See XYDRIVER Error Codes EXAMPLE Code xyRelease ALSO SEE xyAcquire 4 9 xySetParameter Sets driver parameter SYNTAX xySetParameter Port ParmName ParmValue Port I Port Selected ParmName I Parameter Name ParmValue L Parameter Value REMARKS The ParmValue corresponding to the following table is set NAME FUNCTION ParmName XY SET NAK RATE Sets the prompt delay in seconds ParmName XY_SET EOF CHAR Sets the XMODEM pad character ParmName XY_SET_ONE_ SECOND Sets the milliseconds second The XY_SET_NAK_RATE parameter sets the delay in seconds between prompts that the receiver transmits to the sender to start the file transfer The legal range is 1 to 10 seconds The XY_SET_EOF_CHAR parameter sets the pad character used by XMODEM in padding the last packet to 128 bytes The normal value is control Z hex 1A The XY SET ONE SECOND parameter if set to less than 1000 is used to speed up the protocol by reducing waits To reduce all time delays to half of their default value use 500 RETURNS
9. WSC_WAIT_ON_PUTS is used to direct SioPuts to return immediately before the I O is complete if ParamValue is TRUE not 0 The default is 0 FALSE which means that SioPuts will not return until the T O is completed WSC_SIGNAL is used to signal WSC to release the block created when SioEvent was called WSC_OVERLAPPED is used to disable all overlapped I O pass ParmValue 0 By default WSC32 will use overlapped I O when running on Win98 and above machines but not on Win95 machines since Win95 does not support overlapped I O RETURNS The parameter value is returned if the parameter name is recognized otherwise 1 is returned EXAMPLE SioSetInteger Port WSC_WAIT_ON_PUTS 1 SioSetInteger Port WSC_SIGNAL 1 40 2 36 SioSetTimeouts Sets Transmit and Receive Timeout Constants SYNTAX SioSetTimeouts Port ReadInter ReadMult ReadCons WriteMult WriteCons Port I port selected ReadInter I read interval t o ReadMult I read t o multiplier ReadCons I read t o constant WriteMult I write t o multiplier WriteCons 1 write t o constant REMARKS Sets the transmit SioPutc SioPuts amp receive SioGetc SioGets operation timeouts If the value returned by SioPutc is O then a timeout has occurred If the value returned by SioPuts is less than the number of bytes passed as the last argument to SioPuts then a timeout has occurred WSC_READ_INTERVAL_TIMEOUT ReadInter Sets the maximum period of time
10. hexadecimal characters corresponding to the bytes in the Binary array For example if Binary contains the two bytes 01 5A then the SioHex View will construct the output buffer to be the five byte string 01 5A RETURNS Returns the number of characters written to Buffer EXAMPLE char Binary 0x01 0x5A char Buffer 6 Code SioHexView char Binary 2 char Buffer 6 25 2 21 SioInfo Returns WSC library version information SYNTAX Siolnfo Cmd Cmd I Command See below REMARKS The SioInfo function returns an integer code corresponding to the Cmd as follows NAME FUNCTION WSC_GET VERSION Library version number 3 hex digits WSC_GET BUILD Library build number SioInfo WSC_ GET VERSION will return the 3 digit version number embedded in WSC64 DLL and in WSC32 DLL The 3 digit version number is formatted as the rightmost 3 nibbles 4 bits per nibble of the return value SioInfo WSC_GET BUILD will return the version build number Refer to the WSCVER program for an example RETURNS See remarks above Return 1 Cannot recognize command EXAMPLE Code Siolnfo WSC GET VERSION 26 2 22 SioKeyCode Pass keycode to WSC DLL SYNTAX SioKeyCode KeyCode KeyCode L Keycode value 0 or 8 to 10 digit number REMARKS The SioKeyCode function must be the first WSC call made When WSC is purchased you will receive a keycod
11. like the ungetc function in the C language RETURNS e Return WSC_IE NOPEN Port not opened Call SioReset first e Return WSC_IE BADID No such port EXAMPLE Code SioUnGetc Port ALSO SEE SioReset 49 2 45 SioWaitFor Waits for the next character from the serial line SYNTAX SioWaitFor Port Port Timeout REMARKS Timeout Port selected Timeout milliseconds The SioWaitF or function waits up to Timeout milliseconds for the next incoming byte from the selected serial port WSC_TIMEOUT is returned if no byte is available within the timeout period RETURNS Return Return Return e Return EXAMPLE Code ALSO SEE SioGetc and SioGets WSC_TIMEOUT Port not opened Call SioReset first No such port timed out waiting for next incoming byte character read SioWaitFor Port 5000 2 46 SioWinError Return last Win32 Win64 error code amp message text SYNTAX SioWinError Buffer Size Buffer P Pointer to messages buffer Size I Size of buffer REMARKS The SioWinError is a Win32 Win64 ONLY function that returns the last Win32 Win64 error code If Buffer is not NULL it will also copy the corresponding text message into Buffer of maximum size Size EXAMPLE C C Example char Buffer 128 Code SioWinError char Buffer 128 BASIC Example Dim Buffer As String 128 Code SioWinError
12. used by some error correcting modems to implement hardware flow control CTS is dropped by the modem to signal the computer not to send data and is raised to signal the computer to continue Refer to the SERIAL User s Manual SERIAL PDE for a discussion about flow control RETURNS e Return WSC_IE NOPEN Port not opened Call SioReset first e Return WSC_IE BADID No such port e Return 0 CTS is clear e Return gt 0 CTS is set EXAMPLE Code SioCTS Port ALSO SEE See SioFlow and SioRead 12 2 8 SioDCD Reads the Data Carrier Detect DCD modem status bit SYNTAX SioDCD Port Port I Port selected REMARKS The SioDCD function is used to read the Data Carrier Detect DCD modem status bit Also see SioStatus SioDCD is normally used after connecting to check that the carrier has not been dropped RETURNS e Return WSC_IE NOPEN Port not opened Call SioReset first e Return WSC_IE BADID No such port e Return 0 DCD is clear e Return gt 0 DCD is set EXAMPLE Code SioDCD Port ALSO SEE See SioRead 2 9 SioDebug Sets and or reads debug data SYNTAX SioDebug Parm Parm I Parameter REMARKS Passing the character R will result in the serial port driver RESETDEV reset device command being called when SioReset is called The RESETDEV command is not required for the operation of the UART and is not always implemented by some serial d
13. BatchFlag XMODEM A NAK FALSE Standard XMODEM XMODEM CRC eS FALSE XMODEM 1K F Cc FALSE YMODEM H LOY TRUE Standard YMODEM RETURNS e Return TRUE No error e Return FALSE Not started Port not active EXAMPLE C C Example Code xyStartRx Port MYFILE ZIP C 1 BASIC Example Code xyStartRx Port MYFILE ZIP ASC C 1 ALSO SEE xyStartTx and xyDriver 68 4 12 xyStartTx Start XMODEM or YMODEM transmit SYNTAX xyStartTx Port Filename OneK Batch Port I Port to use Filename P File to send OneK I Want 1K blocks T F Batch I YMODEM flag T F REMARKS The xyStartTx starts the XMODEM or YMODEM file send Once started calls to xyDriver are made to execute the next state or states The xyStartTx function returns immediately The protocols supported and their parameters are as follows Protocol OneKf lag BatchFlag XMODEM FALSE FALSE Standard XMODEM XMODEM CRC E FALSE FALSE XMODEM 1K TRUE FALSE YMODEM H TRUE TRUE Standard YMODEM RETURNS e Return TRUE No error e Return FALSE Not started Port not active EXAMPLE Code xyStartTx Port MYFILE ZIP 0 1 ALSO SEE xyStartRx and xyDriver 69 5 Error Codes 5 1 WSC Error Codes NAME FUNCTION WSC_ABOR
14. ME WSC_RXOVER WSC_OVERRUN WSC_ PARITY WSC_FRAME WSC_BREAK WSC_TXFULL RETURNS FUNCTION The receive queue overflowed An incoming byte was overwritten A parity error was detected incoming byte A framing error was detected incoming byte A break signal was detected The transmit queue is full NOPEN Port not opened Call SioReset first e Return WSC_IE e Return WSC_IE_ EXAMPLE Code SioStatus Port WSC FRAME ALSO SEE SioRead BADID No such port 44 2 40 SioTimer Returns the current time in milliseconds SYNTAX SioTimer REMARKS The SioTimer returns the system time in milliseconds SioTimer calls the Windows API function GetCurrentTime This function is provided as a convenience since GetCurrentTime can not be called directly from programs written in some computer languages RETURNS The system time in milliseconds EXAMPLE TimeNow SioTimer 45 2 41 SioTimeMark Returns the current time in milliseconds SYNTAX SioTimeMark DWORD TimeMask TimeMask 1 Mask to AND with system time REMARKS The SioTimeMark returns the system time modulo the TimeMask in milliseconds SioTimeMark calls the Windows API function GetCurrentTime This function is provided as a convenience since GetCurrentTime can not be called directly from programs written in some computer languages RETURNS The system time in milliseconds after applying the mask E
15. NTROL No flow control default In order for flow control to work correctly your serial device must also be configured to work with the same class of flow control hardware or software If using hardware flow control the computer to serial device cable must have RTS and CTS wired straight through If hardware flow control is enabled the RTS line should not be modified by calling SioRT S RETURNS e Return WSC_RANGE Cannot recognize command e Return gt 0 Flow control enabled e Return 0 Flow control disabled EXAMPLE Code SioFlow Port WSC_HARDWARE FLOW CONTROL ALSO SEE SioPutc and SioSetTimeouts 21 2 17 SioGetc Reads the next character from the serial line SYNTAX SioGetc Port Port I Port selected REMARKS The SioGetc function reads the next byte from the receive queue of the selected serial port WSC_NO_DATA 100 is returned if no byte is available RETURNS e Return WSC_IE NOPEN Port not opened Call SioReset first e Return WSC_IE BADID No such port e Return WSC_NO DATA no data available e Return gt 0 character read EXAMPLE Code SioGetc Port ALSO SEE SioUnGetc and SioGets 2 18 SioGetReg Returns the license registration string SYNTAX SioGetReg Buffer BufLen Buffer P Buffer for registration string Buflen I Length of above buffer REMARKS The SioGetReg function copies the license registration string a maximum
16. ShortToByte Converts 16 bit Unicode ASCII character buffer to 8 bit SYNTAX SioShortToByte Buffer Buffer P character buffer REMARKS The SioShortToByte function converts the null terminated character buffer Buffer from 16 bit Unicode ASCII characters to 8 bit ASCII characters The buffer must be null terminated last character is a hex 00 This function is only necessary when working with 16 bit Unicode ASCII characters RETURNS None EXAMPLE C NameString MyFile zip 0 char NameBuffer NameString ToCharArray convert null terminated 16 unicode buffer to 8 bit fixed char pNameBuffer NameBuffer SioShortToByte pNameBuf fer ALSO SEE SioByteToShort 42 2 38 SioSleep Sleeps Specified Time SYNTAX SioSleep Milliseconds Milliseconds 1 Number of milliseconds to sleep REMARKS The SioSleep function sleeps for the indicated number of milliseconds Milliseconds must be positive This function is included in WSC because it is not available in all computer languages EXAMPLE C C sleep 1 second Tics SioSleep 1000 EXAMPLE VB sleep 1 second Tics SioSleep 1000 RETURNS 1 is always returned 2 39 SioStatus Returns the serial port status SYNTAX SioStatus Port Mask Port I Port selected Mask I Error mask REMARKS The SioStatus function returns the serial port error status corresponding to the mask argument MASK NA
17. TED The evaluation version of WSC corrupted WSC_BUFFERS Cannot allocate memory for buffers WSC_EXPIRED Evaluation version expired WSC_KEYCODE Bad key code value WSC_NO DATA No incoming serial data is available WSC_RANGE A parameter is out of range WSC_THREAD Cannot start thread WSC_WIN32ERR Win32 Win64 system error wWSC_IE BADID o such port WSC_IE BAUDRATE Unsupported byte size WSC_IE BYTESIZE Unsupported byte size WSC_IE DEFAULT Error in default parameters WSC_TE HARDWARE COM port hardware not present WSC_TE MEMORY Cannot allocate memory WSC_TE NOPEN Port not opened Call SioReset first WSC_TE OPEN Port already opened WSC_TO ERROR An event error has occurred The WSC_ABORTED error occurs in the evaluation version only if there is a problem displaying the software info screen The WSC_WIN32ERR error code is returned only for Win32 Win64 system errors Call SioWinError to retrieve the error message 5 2 XYDRIVER Error Codes Error codes are always negative except for no error Most of these error conditions rarely occur Also note that XYDRIVER functions can return WSC errors An error message is queued when an error occurs which can be retrieved with xyGetMessage NAME FUNCTION XY_NO_ERROR No error XY_UNKNOWN_ERROR Unknown error XY ALREADY ACTIVE ERROR Port already acquired XY CANNOT_OPEN_ERROR Cannot open specified file XY EMPTY
18. Windows Standard Serial Communications Reference Library WSC_REF Version 5 4 August 11 2015 This software is provided as is There are no warranties expressed or implied Copyright C 2015 All rights reserved MarshallSoft Computing Inc Post Office Box 4543 Huntsville AL 35815 USA Email info O marshallsoft com Web www marshallsoft com MARSHALLSOFT is a registered trademark of MarshallSoft Computing TABLE OF CONTENTS 1 Introduction errr S UN ER N n a NNNNNNNNNNNNNyNNyNyNNyNNNNNNNNNNyNNNNNNyNNNNNNNNNNNDN 003004 NnNRa 00 73004 0UNRO ds ds ds Ys ds ds BPWWWWWWWWWWNNNNNNNNND 1 GrG GYNRPROowo0o JO00d4 YN R Oo0o0 JO00d040NnN ROO General Remarks Documentation Set Declaration Files Language Notes Functions SioBaud SioBrkSig SioByteToShort SioCountWait SioCRC16 SioCRC32 SiocTS SioDCD SioDebug SioDone SioDSR SioDTR SioEvent SioEventChar SioEventWait SioFlow SioGetc SioGetReg SioGets SioHexView SioInfo SioKeyCode SioMessage SioParms SioPutc SioPuts SioQuiet SioRead SioReset SioRI SioRTS SioRxClear SioRxQue SioRxWait SioSetInteger SioSetTimeouts SioShortToByte SioSleep SioStatus SioTimer SioTimeMark SioTxClear SioTxQue SioUnGetc SioWaitFor SioWinError Page Page Page Page Page Page Page Page Page Page Page Page Page Page Page Page Page Page Page Page Page Page Page Page Page Page Page Page P
19. XAMPLE get last 8 bits of system time TimeMark SioTimeMark 255 46 2 42 SioTxClear Clears the transmit buffer SYNTAX SioTxClear Port Port I Port selected REMARKS The SioTxClear function will delete any characters in the transmit buffer not the UART for the specified port Once this function is called any character in the transmit buffer put there by SioPute or SioPuts will be lost and therefore not transmitted RETURNS e Return WSC_IE NOPEN Port not opened Call SioReset first e Return WSC_IE BADID No such port EXAMPLE Code SioTxClear Port ALSO SEE SioTxQue 2 43 SioTxQue Returns the number of bytes in the transmit queue SYNTAX SioTxQue Port Port I Port selected REMARKS The SioTxQue function will return the number of characters in the transmit queue not the UART at the time of the call RETURNS e Return WSC_IE NOPEN Port not opened Call SioReset first e Return WSC_IE BADID No such port EXAMPLE Code SioTxQue Port ALSO SEE SioRxQue 2 44 SioUnGetc Ungets the last character read with SioGetc SYNTAX SioUnGetc Port Ch Port I Port selected Ch I Character to unget REMARKS The SioUnGetc function returns pushes the character back into the serial input buffer The character pushed will be the next character returned by SioGetc Only one character can be pushed back This function works just
20. age Page Page Page Page Page Page Page Page Page Page Page Page Page Page Page 1 Page 1 Page 1 Page 1 Page 1 Page 1 Page 1 Page 1 Page 1 oy 01 U A ds 00 JO MOND t NRo N w WD Y Y Y UY Y Y Y YN NN DN DN y Ss o aoe BB DB WB WB Wop 0 73004 0UNRO WO 00 J00 4 G0NROto 00 001 SA Ko FPOWOANTADAUBPWNE 3 Modem I O Functions mioBreak mioDriver mioQuiet mioResult mioSendTo mioWaitFor WD in y Y WW No FPWNE ES x K ES Functions xyAbort xyAcquire xyDebug xyDriver xyGetFileName xyGetMessage xyGetParameter xyRelease xySetParameter 10 xySetString 11 xyStartRx 12 xyStartTx 0 7305004 NR Sos ds ds ds ds BR DB ds BBA Ne 5 Error Codes Page Page Page Page Page Page Page Page Page Page Page Page Page Page Page Page Page Page Page Page Page 52 52 53 54 55 56 57 58 58 59 60 61 62 63 64 65 66 67 68 69 70 1 Introduction The Windows Standard Serial Communications Library WSC is a serial communication component DLL library that provides full control over a serial port WSC uses the standard Windows API Application Programmer s Interface to communicate with any device connected to a serial port A simple interface allows accessing data from a serial port using RS232 or multi drop RS422 RS485 serial ports Windows Standard Serial Communications Library WSC also supports virtual ports such as
21. ar I Event character Timeout I Timeout milliseconds REMARKS The SioEventChar function WIN32 WIN64 only waits blocks until the specified character is seen in the serial input stream or timeout occurs SioEventChar returns unblocks only when the specified character is received after it is called RETURNS Port not opened Call SioReset first e Return WSC_IE NOPEN e Return WSC_IE BADID e Return WSC_IO_ ERROR An event error has occurred No such port e Return WSC_IO COMPLETE e Return WSC_IO_ PENDING success event has occurred fails event has not occurred WSC_IO_PENDING will be returned by SioEventChar if timeout has occurred EXAMPLE C C Example wait up to 1 second until a carriage return is seen Code SioEventChar Port r 1000 BASIC Example wait up to 1 second until a carriage return Chr 13 is seen Code SioEventChar Port 13 1000 ALSO SEE SioEvent and SioEventWait 19 2 15 SioEventWait Efficiently waits for a serial event SYNTAX SioEventWait Port Mask Timeout Port I Port selected Mask I Event Mask see below Timeout I Timeout milliseconds REMARKS The SioEventWait function WIN32 WIN64 only waits blocks until the condition specified in Mask is satisfied or the timeout is reached SioEventWait returns unblocks only for events that occur after it is ca
22. as well as the examples in the specified programming environment The x in WSC_4x Programmer s Manual specifies the host language such as C for C C VB for Visual Basic etc The WSC User s Manual WSC_USR discusses language independent serial communications programming issues including modem control It also contains purchase and license information The WSC Reference Manual WSC_REF contains details on each individual WSC function The Serial Communications Manual SERIAL contains background information on serial port hardware 1 3 Declaration Files The exact syntax for calling WSC functions are specific to the host language C C Delphi VB etc and are defined for each language in the WSC declaration files Each WSC product comes with the appropriate declaration file for the supported language For example WSC4C C C NET C WSC H WSC4VB Visual Basic WSC64 BAS and WSC32 BAS VB NET WSC64 VB and WSC32 VB VBA EXCEL ACCESS etc WSC64 BAS and WSC32 BAS WSC4PB PowerBASIC WSC32 PBI WSC4D Borland Embarcadero Delphi WSC64 PAS and WSC32 PAS WSC4CB Fujitsu COBOL WSC32 CBI WSC4FP Visual FoxPro WSC32 FOX WSC4DB Visual dBase WSC32 CC WSC4XB Xbase WSC32 CH 1 4 Language Notes All language versions of Windows Standard Serial Communications Library WSC include the example program WSCVER Refer to this program and the declaration file as defined in Section 1 3 above to see how WSC functions a
23. e an 8 to 10 digit number that matches the keycode within the registered version of the DLL For the evaluation shareware version the keycode is 0 See file KEYCODE EXAMPLE All example programs call SioKeyCode Code SioKeyCode WSC KEY CODE RETURNS Return gt 0 No error Return WSC_KEYCODE wrong keycode 27 2 23 SioMessage Send windows message when event occurs SYNTAX SioMessage Port Handle Message Mask Port I Port selected Handle S Window handle HWND Message I Message Usually WM_USER Mask L Event mask see SioEvent REMARKS The SioMessage function will post the message Message to the window handle Handle when event Mask occurs SioMessage does not block Call SioMessage Port O O 0 in order to cancel a previous event Refer to SioEvent for a list of mask values RETURNS See remarks above EXAMPLE Code SioMessage Port hWnd WM_USER EV_RXCHAR ALSO SEE SioEvent SioEventChar and SioEventWait 28 2 24 SioParms Sets parity stop bits and word length SYNTAX SioParms Port Parity StopBits DataBits Port I 1 or port selected Parity I Parity code StopBits I Stop bits code DataBits I Word length code REMARKS The SioParms function sets the parity stop bits and word length values SioParms can be called either before or after calling SioReset Call SioParms w
24. ed Wait L Total time to wait for response milliseconds Text P Th xpected response string REMARKS The mioWaitFor function waits for characters from serial input that match the string Text A total of Wait milliseconds are allowed before timing out and returning FALSE 0 The string comparison is NOT case sensitive The function mioDriver must be called until MIO_IDLE is returned Then mioResult is called to get the result of the mioWaitFor Looking at the example below a value of 0 indicates that neither CONNECT BUSY nor NO CARRIER was received A non zero value indicates that one of the three sub strings was received A 0 is returned if CONNECT was seen 1 is returned if NO CARRIER was seen and 2 is returned if BUSY was seen RETURNS A character as described above EXAMPLE Code mioWaitFor Port 60000 CONNECT NO CARRIER BUSY ALSO SEE mioResult 57 4 XYM Functions 4 1 xyAbort Aborts the XYDRIVER state driver SYNTAX xyAbort Port Port I Port selected REMARKS The xyAbort function forces the driver to IDLE terminating any file transfer that may be in progress RETURNS Return XY NO ERROR 0 EXAMPLE Code xyAbort Port 58 4 2 xyAcquire Prepares the state driver for operation SYNTAX xyAcquire FirstPort LastPort FirstPort 1 First port selected LastPort I Last port selected REMARKS The xyAcquire function initial
25. en Return EXAMPLE C C Example char Break if SioQuiet Port 1000 60000 WSC_TIMEOUT printf Failure Timed out n return Code SioPuts Port Break 3 SioSleep 1000 BASIC Example Dim Break As String Break If SioQuiet Port 1000 60000 WSC_TIMEOUT Then PRINT Failure Timed out EXIT End If Code SioPuts Port Break 3 SioSleep 1000 ALSO SEE 32 2 28 SioRead Reads any UART register SYNTAX SioRead Port Reg Port I Port selected Reg I UART register 0 to 7 REMARKS SioRead is ONLY for Win16 applications running under Windows 95 and 98 Win16 is no longer supported in WSC 33 2 29 SioReset Initialize a serial port for processing SYNTAX SioReset Port RxQueSize TxQueSize Port I Port selected or 1 see below RxQueSize I Receive queue size TxQueSize I Transmit queue size REMARKS The SioReset function initializes opens the selected serial port SioReset should be called before making any other calls to WSC except for setting default behavior port 1 SioReset uses the parity stop bits and word length value previously set if SioParms was called otherwise the default values 19200 no parity 8 data 1 stop are used SioReset can be called with Port set to 1 in order to specify the behavior of DTR and RTS at port initialization SioReset 1 DTR Default RTS Default
26. evices such as USB Serial adapters Passing the character W will toggle the operation of SioPuts between 1 wait for completion default and 2 immediate return modes as described in Section 2 9 SioPuts Notes of the WSC User s Manual WSC_USR PDF RETURNS See remarks above EXAMPLE C Example Code SioDebug W BASIC Example Code SioDebug ASC W ALSO SEE None 14 2 10 SioDone Terminates further serial processing SYNTAX SioDone Port Port I Port selected REMARKS The SioDone function terminates further serial port processing allowing other applications to use the port SioDone should always be the last function called before exiting an application If an application is running from within an integrated development environment IDE and the application terminates without SioDone being called first the IDE itself will prevent the port from being re opened Terminating the IDE will free the port RETURNS e Return WSC_IE NOPEN Port not opened Call SioReset first e Return WSC_IE BADID No such port EXAMPLE Code SioDone Port ALSO SEE See SioReset 15 2 11 SioDSR Reads the Data Set Ready DSR modem status bit SYNTAX SioDSR Port Port I Port selected REMARKS The SioDSR function is used to detect if DSR Data Set Ready is set 1 or clear 0 Some Windows Modems normally set DSR as soon as they are powered up RETURNS
27. gether See example below The event masks are NAME FUNCTION EV_RXCHAR A character was received EV BREAK A break signal was received EV_CTS The CTS line changed states EV_DSR The DSR line changed states EV ERR An error was detected EV_RLSD The DCD line has changed states EV_RING The RI line has been set EV TXEMPTY The TX queue has becom mpty Call the SioEventWait function if an event timeout is desired RETURNS SioEvent does not return until the specified event occurs For this reason it is best used inside of a thread e Return WSC_IE NOPEN e Return WSC_IE BADID No such port Port not opened Call SioReset first e Return WSC_IO ERROR An event error has occurred e Return WSC_IO COMPLETE success event has occurred e Return WSC_IO PENDING fails event has not occurred WSC_IO_PENDING will be returned by SioEvent if timeout has occurred EXAMPLE C C Example wait until CTS or DSR changes states Code SioEvent Port EV_CTS EV_DSR BASIC Example wait until CTS or DSR changes states Code SioEvent Port EV_CTS OR EV_DSR ALSO SEE SioEventChar SioEventWait and SioMessage 18 2 14 SioEventChar Efficiently waits for a serial character SYNTAX SioEventChar Port EvtChar Timeout Port I Port selected EvtCh
28. in milliseconds allowed between two sequential bytes being read from the serial port before the receive operation terminates If set to MAXDWORD and the other two above READ timeouts are set to zero then serial receive calls return immediately without waiting WSC_READ_TIMEOUT_MULTIPLIER ReadMult Sets the multiplier in milliseconds used to calculate the overall timeout of serial receive operations This timeout is given by NbrBytes ReadTimeoutMultiplier ReadTimeoutConstant NorBytes bytes requested WSC_READ_TIMEOUT_CONSTANT ReadConst Sets the constant in milliseconds used to calculate the overall timeout of serial receive operations This timeout is given by NbrBytes ReadTimeoutMultiplier ReadTimeoutConstant NbrBytes bytes requested WSC_WRITE_TIMEOUT_MULTIPLIER WriteMult Sets the multiplier in milliseconds used to calculate the overall timeout of serial transmit operations This timeout is given by NbrBytes WriteTimeoutMultiplier WriteTimeoutConstant NorBytes bytes requested WSC_WRITE_TIMEOUT_CONSTANT WriteCons Sets the constant in milliseconds used to calculate the overall timeout of serial transmit operations This timeout is given by NbrBytes WriteTimeoutMultiplier WriteTimeoutConstant NorBytes bytes requested RETURNS e Return WSC_WIN32ERR cannot set timeouts EXAMPLE SioSetTimeouts Port DWORD 1 DWORD 0 DWORD 0 DWORD 1 DWORD 2000 41 2 37 Sio
29. ith Port set to 1 before calling SioReset to make the passed parameters the default Use the constant values defined in the WSC declaration file see Section 1 3 to minimize the chance of passing an incorrect parameter value PARITY STOPBITS DATABITS NoParity OneStopBit WordLength7 OddParity One5StopBits WordLength8 EvenParity TwoStopBits z5 SpaceParity o arkParity a cr RETURNS e Return WSC_IE BADID No such port e Return WSC_IE BYTESIZE Word length not supported e Return WSC RANGE Parameter out of range EXAMPLE Code SioParms Port WSC_NoParity WSC_OneStopBit WSC WordLength8 ALSO SEE SioReset 29 2 25 SioPutc Transmit a character over a serial line SYNTAX SioPutc Port Ch Port I Port selected Ch 1 Character to send REMARKS The SioPute function copies the character to the transmit queue for subsequent transmission by the UART RETURNS e Return WSC_IE NOPEN Port not opened Call SioReset first e Return WSC_IE BADID No such port e Return 1 No error EXAMPLE C C Example Code SioPutc Port A BASIC Example Code SioPutc Port ASC A ALSO SEE SioGetc SioFlow and SioSetTimeouts 30 2 26 SioPuts Transmits a byte buffer over a serial line SYNTAX SioPuts Port String Count Port I Port selected String P Pointer to string of bytes to transmit Count I Number of bytes to trans
30. izes the driver for subsequent use This should be the first driver function called RETURNS e Return 0 No error XY_NO_ERROR e Return lt 0 XYDRIVER error See XYDRIVER Error Codes EXAMPLE Code xyAcquire COM1 COM1 ALSO SEE xyRelease 4 3 xyDebug Set the driver debug level SYNTAX xyDebug Level Level I Debug level value REMARKS The xyDebug function sets the driver debug level as follows Debug messages are retrieved using the xyGetMessage function RETURNS New debug level 0 1 2 EXAMPLE Code xyDebug 0 ALSO SEE xyGetMessage LEVEL FUNCTION Level is 0 Only error messages are generated default Level is 1 Minimal debug messages are generated Level is 2 Maximal debug messages are generated 60 4 4 xyDriver XMODEM YMODEM state driver SYNTAX xyDriver Port Port I Port selected RETURNS e Return XY IDLE A transfer is not underway REMARKS The xyDriver function drives the state engine Note that xyDriver never returns an error code In order to send or to receive a file call xyDriver in a loop until it returns XY_IDLE numerical 0 after first initiating the transfer by calling either xyStartTx or xyStartRx xyDriver can be called as often as wanted whether or not a file transfer was initiated EXAMPLE Code xyDriver Port ALSO SEE xyStartTx and xyStartRx 61 4 5 xyGetFileName Get the fi
31. lename from packet 0 SYNTAX xyGetFileName Port Buffer Size Port I Port selected Buffer P Filename buffer Size I Size of Filename buffer REMARKS The xyGetFileName function gets the current filename This function is designed for use on the receive side YMODEM protocol where the filename is received as part of the first packet packet 0 See the TERM example program RETURNS e Return TRUE A message was copied into Buffer e Return FALSE No messages are available EXAMPLE C C Example char Buffer 40 Code xyGetFileName Port char Buffer 40 BASIC Example Dim Buffer As String 40 Code xyGetFileName Port Buffer 40 ALSO SEE xyGetParameter 62 4 6 xyGetMessage Get next XYDRIVER message SYNTAX xyGetMessage Port Buffer Size Port I Port selected Buffer P Message buffer Size I Size of message buffer REMARKS The xyGetMessage function retrieves the next message from the driver message queue Refer to the TERM example program for an example of using xyGetMessage RETURNS e Return TRUE A message was copied into Buffer e Return FALSE No messages are available EXAMPLE C C Example char Buffer 40 Code xyGetMessag Port char Buffer 40 BASIC Example Dim Buffer As String 40 Code xyGetMessage Port Buffer 40 ALSO SEE xyDebug 63 4 7 xyGetParameter Retrieves driver parameter
32. lled unless the specified timeout period is reached Multiple conditions can be OR ed together See the example below The event masks can be found in the description of SioEvent entry above RETURNS e Return WSC_IE NOPEN Port not opened Call SioReset first e Return WSC_IE BADID e Return WSC_IO_ ERROR An event error has occurred No such port e Return WSC_IO COMPLETE e Return WSC_IO PENDING success event has occurred fails event has not occurred WSC_IO_PENDING will be returned by SioEventWait if timeout has occurred EXAMPLE C C Example Wait up to 1 5 seconds for incoming serial data Code SioEventWait Port EV_RXCHAR 1500 BASIC Example Wait up to 1 5 seconds for incoming serial data Code SioEventWait Port EV_RXCHAR 1500 ALSO SEE SioEvent and SioEventChar 20 2 16 SioFlow Sets flow control protocol SYNTAX SioFlow Port Cmd Port I Port selected Cmd I Class of flow control see below REMARKS The SioFlow function is used to enable or disable hardware flow control Hardware flow control uses RTS and CTS to control data flow between the modem and the computer To enable flow control call SioFlow with Cmd set to NAME 5 FUNCTION WSC HARDWARE FLOW CONTROL Hardware RTS CTS flow control WSC_SOFTWARE FLOW CONTROL Software XON XOFF flow control WSC_NO_FLOW_ CO
33. mit REMARKS The SioPuts function copies Count bytes from String to the transmit queue for transmission The String can contain any ASCII or binary values The SioPuts function can operate in two ways wait for completion and immediate return as described in Section 2 9 SioPuts Notes in the WSC User s Manual WSC_USR PDE RETURNS e Return WSC_IE NOPEN Port not opened Call SioReset first e Return WSC_IE BADID No such port e Return gt 0 The number of bytes accepted for transmission EXAMPLE C C Example char Buffer 128 Code SioPuts Port char Buffer 128 BASIC Example Dim Buffer As String 128 Code SioPuts Port Buffer 128 ALSO SEE SioGetc SioFlow and SioSetTimeouts 31 2 27 SioQuiet Returns after specified period of quiet SYNTAX SioQuiet Port Quite Timeout Port I Port selected Quiet I Quiet time period milliseconds Timeout I Timeout period milliseconds REMARKS The SioQuiet function will not return until there is Quiet continuous milliseconds in which there is no incoming bytes or the timeout period is exceeded Any incoming data is removed deleted while SioQuiet is running The primary purpose of SioQuiet is for changing modem states See example below RETURNS e Return WSC_IE NOPEN Port not opened Call SioReset first WSC_IE BADID No such port e Return WSC_TIMEOUT Timed out e Return 0 Quiet time se
34. o be one listed above When SioReset is called the baud rate is set to 19200 until changed by calling SioBaud The 19200 default baud rate can be changed by calling SioBaud with Port set to 1 before calling SioReset Subsequent calls to SioReset will then use the new default baud rate EXAMPLE Code SioBaud COM1 28800 RETURNS e Return WSC_IE BADID No such port e Return WSC_IE BAUDRATE Unsupported baud rate 2 2 SioBrkSig Asserts cancels or detects BREAK signal SYNTAX SioBrkSig Port Cmd Port I Port selected Cmd I ASSERT CANCEL or DETECT REMARKS The SioBrkSig function controls the BREAK bit in the line status register The legal commands are NAME FUNCTION WSC_ASSERT BREAK to assert BREAK WSC_ CANCEL BREAK to cancel BREAK WSC_DETECT BREAK to detect BREAK WSC_ASSERT_BREAK WSC_CANCEL_BREAK and WSC_DETECT_BREAK are defined in the language declaration file see Section 1 3 RETURNS e Return WSC_IE NOPEN Port not opened Call SioReset first e Return WSC_RANGE Illegal command Expected A C or D EXAMPLE Code SioBrkSig Port WSC ASSERT BREAK 2 3 SioByteToShort Converts 8 bit Character Buffer to 16 bit Unicode ASCII SYNTAX SioByteToShort Buffer Buffer P character buffer REMARKS The SioByteToShort function converts the null terminated character buffer B
35. of 50 bytes to Buffer The registration string identified the purchaser and is embedded in each registered DLL RETURNS Number of bytes copied EXAMPLE Length SioGetReg Buffer 50 23 2 19 SioGets Reads the next byte buffer from the serial line SYNTAX SioGets Port String Cnt Port I Port selected String P Pointer to receive buffer Cnt I Number of bytes to read REMARKS The SioGets function reads the smaller of the number of bytes wanted Cnt and the number of bytes in the receive buffer A zero is returned if no bytes are read Note that even if the data is being sent in one operation by the other side it may not necessarily arrive all at in a single packet RETURNS e Return WSC_IE NOPEN Port not opened Call SioReset first e Return WSC_IE BADID No such port e Return gt 0 Number of characters actually read EXAMPLE C C Example char Buffer 128 Code SioGets Port char Buffer 128 BASIC Example Dim Buffer As String 128 Code SioGets Port Buffer 128 ALSO SEE SioUnGetc and SioPutc 24 2 20 SioHexView Constructs Hexadecimal String SYNTAX SioHexView Binary BinLen Buffer BufLen Binary I Array of binary bytes BinLen I Number of bytes in Binary array above Buffer I Buffer into which hexadecimal bytes are written BufLen I Size of Buffer REMARKS The SioHex View function constructs a string of
36. r buffer BufLen I Number of bytes in above buffer REMARKS The SioCRC16 function computes the 16 bit CCITT CRC over the specified buffer The 16 bit CCITT CRC uses generating polynomial 1021 hex 8408 hex reversed This CRC is used for calculating the 16 bit YMODEM CRC value among other uses EXAMPLE C C Example int Code char Buffer ABC Code SioCRC16 Buffer 3 answer is 0x3994 BASIC Example Dim Buffer as String Buffer ABC Code SioCRC16 Buffer 3 answer is 14740 3994 hex ALSO SEE SioCRC32 10 2 6 SioCRC32 Computes 32 Bit CRC SYNTAX SioCRC32 Buffer BufLen Buffer P Character buffer BufLen I Number of bytes in above buffer REMARKS The SioCRC32 function computes the 32 bit CCITT CRC over the specified buffer The 32bit CCITT CRC uses generating polynomial 04C11DB7 hex EDB88320 hex reversed This CRC is used for calculating the 32 bit ZMODEM CRC value among other uses EXAMPLE C C Example int Code char Buffer ABC Code SioCRC32 Buffer 3 answer is 0xA3830348 BASIC Example Dim Buffer as String Buffer ABC Code SioCRC32 Buffer 3 answer is 1551695032 A3830348 hex ALSO SEE Si0CRC16 11 2 7 SioCTS Reads the Clear to Send CTS modem status bit SYNTAX SioCTS Port Port I Port selected REMARKS The SioCTS function is used to detect if CTS Clear To Send is set 1 or clear 0 The CTS line is
37. re called The best way to see how a function is called is to find it used in one of the example programs All WSC functions are used in one or more examples 1 4 1 C C C and NET None 1 4 2 Delphi 1 Functions defined in the Delphi Unit WSCW PAS begin with f rather than Sio 2 Replace with in the examples 1 4 3 Visual Basic and VB NET None 1 4 4 PowerBASIC 1 Constants defined for PowerBASIC WSC32 PBI begin with the character symbol 2 The WSC keycode is defined in KEYCODE PBI 1 4 5 Visual FoxPro All strings passed to WSC functions must be prefixed with the character 1 4 6 Visual dBase None 1 4 7 Xbase 1 Functions defined for Xbase begin with X 2 All strings passed to WSC functions must be prefixed with the character 2 WSC Functions 2 1 SioBaud Sets the baud rate SYNTAX SioBaud Port Baud Port 1 1 or port selected Baud I Baud code or actual baud rate REMARKS The SioBaud function sets the baud rate without resetting the port It is used to change the baud rate after calling SioReset SioBaud may be called with either the actual baud rate value or one of the baud rate codes as follows VALUE RATE NAME 0 110 Baud110 1 300 Baud300 2 1200 Baud1200 3 2400 Baud2400 4 4800 Baud4800 3 9600 Baud9600 6 19200 Baud19200 7 38400 Baud38400 8 57600 Baud57600 9 115200 Baud115200 Note that the baud rate does NOT have t
38. rs while mioQuiet is running are lost RETURNS Return TRUE EXAMPLE Code mioQuiet Port 1000 54 3 4 mioResult Returns result of last mioWaitFor SYNTAX mioResult Port Port I Port selected REMARKS The mioResult function returns the result of the last mioWaitFor function This function should not be called until the driver returns MIO_IDLE See the remarks section of the mioWaitFor function for an example RETURNS e Return 0 False last WaitFor not matched e Return 0 0 if first substring matched 1 if second substring matched etc EXAMPLE Code mioResult Port ALSO SEE mioWaitFor 3 5 mioSendTo Sends string to modem SYNTAX mioSendTo Port Port ey Pace gay String P REMARKS The mioSendTo function sends the characters in the string Text to serial output There is a delay of Pace Pace Text Port selected Ea he inter character delay in milliseconds ES The string to send milliseconds between characters Three characters in Text are interpreted as NAME char is char is char is RETURNS Return TRUE EXAMPLE FUNCTION next character is control char A for 0x01 replaced with carriage return removed from string delay 1 2 second Code mioSendTo Port 100 ATDT555 1212 56 3 6 mioWaitFor Waits for continuous quiet SYNTAX mioWaitFor Port Wait Text Port I Port select
39. the computer to signal the modem not to send data and is raised to signal the modem to continue RTS should be set when communicating with a modem unless flow control is being used Refer to the SERIAL User s Manual SERIAL PDF or http www marshallsoft com serial pdf for a discussion of flow control Commands defined in WSC declaration file Section 1 3 are NAME A FUNCTION WSC SET LINE set RTS ON WSC_CLEAR LINE clear RTS OFF WSC_READ LINE read RTS RETURNS e Return WSC IE NOPEN Port not opened Call SioReset first WSC_IE _BADID No such port e Return WSC RANGE Command is not one of S C or R e Return 0 RTS is clear R command e Return gt 0 RTS isset R command Return EXAMPLE Code SioRTS Port WSC CLEAR LINE ALSO SEE SioFlow and SioDTR 36 2 32 SioRxClear Clears the receive buffer SYNTAX SioRxClear Port Port I Port selected REMARKS The SioRxClear function will delete any characters in the receive buffer not the UART for the specified port After execution the receive buffer will be empty RETURNS e Return WSC_IE NOPEN Port not opened Call SioReset first e Return WSC_IE BADID No such port EXAMPLE Code SioRxClear Port ALSO SEE SioRxQue 37 2 33 SioRxQue Returns the number of bytes in the receive queue SYNTAX SioRxQue Port
40. those created by Bluetooth and USB serial converters The WSC Reference Manual WSC_REF applies to the Windows Standard Serial Communications Library WSC for all supported languages It contains details on each individual WSC function 1 1 General Remarks All functions return an integer code Negative values are always errors See WSC Error Codes in Section 5 1 Non negative gt 0 return codes are never errors Each function argument is marked as e I 4 byte integer Win32 Win64 S 2 byte short integer Win32 Win64 e L 4 byte integer Win32 Win64 P 4 byte pointer Win32 Win64 Refer to the declaration files see Section 1 3 below for the exact syntax of each WSC function Also note that the example programs found in the APPS directory show exactly how WSC functions are called The latest version of our serial comm software and complete technical documentation can be found online at http www marshallsoft com serial communication library htm 1 2 Documentation Set The complete set of documentation consists of four manuals This is the third manual WSC_REF in the set e WSC 4x Programmer s Manual WSC_4x PDF e WSC User s Manual WSC_USR PDF e WSC Reference Manual WSC_REF PDF e SERIAL User s Manual SERIAL PDF Each manual comes in Adobe PDF format The WSC_4x Programmers Manual is the language dependent manual and provides information needed to compile your programs
41. uffer from 8 bit ASCII characters to 16 bit Unicode ASCII characters The buffer must be null terminated last character is a hex 00 and the buffer must be at least twice the size in bytes of the character string since 16 bit characters require twice the space as 8 bit characters This function is only necessary when working with 16 bit Unicode ASCII characters RETURNS None EXAMPLE C char UnsafeBuffer new char 128 get the registration string fixed char pBuffer UnsafeBuffer Code SioGetReg pBuffer 50 if Code gt 0 convert null terminated UnsafeBuffer to 16 bit chars unicode fixed char pBuffer UnsafeBuffer SioByteToShort pBuffer ALSO SEE SioShortToByte 2 4 SioCountWait Waits for Specified Bytes Before Returning SYNTAX SioCountWait int Port int Count DWORD Timeout Port I Port selected Count I Number of bytes to receive before returning Timeout 1 Timeout in milliseconds REMARKS The SioCountWait functions waits for the specified number of incoming bytes Count in the Windows RX queue before returning unless the timeout value in milliseconds is exceeded first Use this function when you know that you will be receiving an incoming buffer of a predetermined number of bytes EXAMPLE Code SioWaitCount COM1 128 3000 ALSO SEE SioEvent 2 5 SioCRC16 Computes 16 Bit CRC SYNTAX SioCRC16 Buffer BufLen Buffer P Characte
Download Pdf Manuals
Related Search
Related Contents
Ouvrage dirigé par Brigitte Durieux User Manual Descarga de la guía rápida - SEDA Sistemas Electronicos de `Mapping` in `ICE Emulator for PowerPC` Problèmes économiques et sociaux 06LT egèiS la yo R erutioV - Royal Kiddy London Royal Kiddy London FRANCAIS en pdf Cliquez-ici TomTom GO - produktinfo.conrad.com JB-1838 Multi-functional Secure Display Stand User Manual Adas user manual - appxa-08 Copyright © All rights reserved.
Failed to retrieve file