📄 wsc4vb_u.txt
字号:
"_declspec" keywords are specified.
For more information on the C/C++ version of WSC, download the latest
version of WSC4C from our web site at www.marshallsoft.com.
3.2 Compiling Example Programs
Visual Basic MAK files are provided with all example programs. All
example source code is saved in Visual Basic 3.0 format so that it
can be read by all versions of Visual Basic.
3.3 EXCEL, ACCESS, and WORD
WSC can be used with Microsoft VBA (Visual Basic for Applications)
applications such as EXCEL, ACCESS, and WORD. Note that WSC16.DLL
must be used for 16-bit applications, even if running under Windows
95/98 or NT. See EXCEL.TXT, ACCESS.TXT, and WORD.TXT for more
information.
3.4 PowerBuilder and FoxPro
WSC can also be used with Power Builder and FoxPro applications.
WSC.PBI : Power Builder declaration file.
WSC.PRG : FoxPro declaration file.
See PBUILDER.TXT and FOXPRO.TXT for more information.
WSC4VB Users Manual Page 7
4.0 MODEM I/O (MIO)
4.1 MIO Introduction
The file MIO32.BAS contains prototypes for using the Modem I/O DLL.
These functions ease communicating with modems using AT commands.
The MIO functions are broken down into parts called states, and
control is returned to Windows between executing each state.
For example:
(1) Send the string to the MIO driver by executing:
Code = mioSendTo(Port,100,"!ATDT1,256,880,9748")
The '!' characters are converted to carriage returns. The text
string is copied into the driver's data area.
(2) Call mioDriver (typically based on a timer) until MIO_IDLE is
returned. Each time mioDriver is called, it will send another
character to the modem provided the required delay (since the
previous character was sent) has passed. If the delay has not
passed, the driver simply returns MIO_RUNNING, but without actually
sending a character to the modem. Once all characters have been
sent, mioDriver will return MIO_IDLE, indicating it is done and is
ready to accept another function.
mioDriver will return MIO_RUNNING if it is still processing. Any
other return value indicates that it is still processing and the
returned value is a character from the modem that can be displayed if
wanted.
(3) Once mioDriver returns MIO_IDLE, call mioResult to get the
result of the mioSendTo call.
4.2 MIO Function Summary
mioDriver : Drives the execution of mioSendTo, mioWaitFor, or
mioQuiet once they have been started.
mioBreak : Forces the MIO driver to IDLE state.
mioSendTo : Sends a string (including control chars) to the modem.
mioWaitFor : Waits for a particular string from the modem, passing
all else through.
mioQuiet : Waits for continuous quiet of a specified duration.
mioBreak : Breaks further modem I/O activity.
Refer to the WSC4VB Reference Manual (WSC4VB_R.TXT) for more
detailed information.
WSC4VB Users Manual Page 8
5.0 XMODEM & YMODEM
5.1 XYDRIVER Introduction
The XMODEM & YMODEM functions are implemented in XYDRV as a DLL
(Dynamic Link Library), and are state driven like the Modem I/O
functions described in the previous section. The TERM program
provides an example of using XYDRV.
Files can be sent and received using XMODEM, XMODEM/CRC, XMODEM/1K,
and YMODEM. The basic procedure used to run XMODEM or YMODEM is as
follows:
(1) Call xyAcquire() immediately after calling SioReset().
(2) To receive a file, call xyStartRx(), then call xyDriver()
repeatedly until XY_IDLE is returned.
(3) To send a file, call xyStartTx(), then call xyDriver() repeatedly
until XY_IDLE is returned.
(4) Call xyRelease() immediately before calling SioDone().
Refer to the TERM program for examples of calling the XYDRV
functions.
5.2 XYDRIVER Function Summary
xyAbort : Abort driver at any time.
xyAcquire : Acquire a port.
xyDebug : Set the debug level.
xyDriver : Executes the next state or states.
xyGetMessage : Get the next debug message.
xyGetParameter : Get a driver parameter.
xyGetFileName : Get name of file being sent or received.
xyRelease : Release a port.
xySetParameter : Set a driver parameter.
xyStartRx : Start a receive.
xyStartTx : Start a transmit.
Refer to the WSC4VB Reference Manual (WSC4VB_R.TXT) for more detailed
information.
WSC4VB Users Manual Page 9
6.0 ASCII File Transfer
6.1 ASCII Protocol
The "ASCII Protocol" is not a defined protocol, but rather it is a
loose set of conventions developed over a period of years by BBS
operators. Because XON/OFF flow control is used, only ASCII text can
be transferred. The ASCII protocol is implemented as a DLL and is
state driven like the MIO and XYDRIVER code.
(1) Call ascInit(Port,RxQueSize,xFlag) to do initialization, where
Port = The connected port (COM1, COM2, etc).
RxQueSize = The size of the Rx Queue as passed to SioReset().
xFlag = 1 if this module will perform XON/XOFF flow control.
Set to FALSE if flow control is being performed by the
WSC code (you called SioFlow()).
(2) To send an ASCII file, call
ascStartTx(FileName,CharPace,TermChar,EchoFlag), where
FileName = The path & name of the file to send.
CharPace = The delay in milliseconds between characters.
TermChar = The termination character to send after the file
has been sent. If none, use 0x00.
EchoFlag = 1 if screen echo is desired.
Then call ascDriver() until it returns IDLE (1).
(3) To receive an ASCII file, call
ascStartRx(FileName,TermChar,FirstWait,CharWait,EchoFlag), where
FileName = The path & name of the file to send.
TermChar = The termination character. If none, use 0x00.
FirstWait = The maximum number of seconds to wait for the
first incoming character.
CharWait = The maximum number of seconds after which it is
assumed that the other side has completed sending.
If unsure, set this to 3 seconds.
EchoFlag = 1 if screen echo is desired.
Then call ascDriver() until it returns IDLE (1).
6.2 ASCII Function Summary
ascAbort : Abort driver at any time.
ascDriver : Executes the next state or states.
ascGetMessage : Get the next debug message.
ascGetParameter : Get a driver parameter.
ascGetFileName : Get name of file being sent or received.
ascInit : Initialize the driver.
ascStartRx : Start a receive.
ascStartTx : Start a transmit.
WSC4VB Users Manual Page 10
7.0 Problems
If you cannot get your application to run properly, first compile and
run the example program EASY.BAS. Test EASY by connecting two
computers with a null modem cable or by connecting a modem to a
serial port.
Once EASY runs, compile and run the SELFTEST program. This program
will test your serial ports' functionality.
If your application does not run but EASY and SELFTEST run correctly,
then you have most likely made a programming mistake in your
application. MarshallSoft Computing cannot debug your application,
especially over the telephone! However, consider each of the
following when searching for an error in your application.
1. Have you included the file WSC32.BAS in your application ?
2. Are your receive and transmit buffers large enough ? Use a buffer
size that is twice the size of the largest expected block.
3. Have you selected too high a baud rate? Windows can multitask
many tasks at once. You may have to lower your baud rate (or get
16550 UARTS).
4. Did SioReset return a zero value ? If not, then you must call
SioReset again. See EASY.BAS for an example.
5. Did you send the proper initialization string to your modem ?
Did you set DTR and RTS? (you should).
7. Are you trying to link a 32-bit DLL to a 16-bit program (or vice
versa)? The typical error message refers to a "corrupted" DLL file.
Keep Win16 & Win32 development separate.
We recommend the following steps if you believe that you have
discovered a bug in the library: (1) Create the smallest, simplest
test program possible that demonstrates the problem. (2) Document
your exact machine configuration and what error the test program
demonstrates. (3) Email us the example source.
If the problem can be solved with an easy work-around, we will
publish the work-around. If the problem requires a modification to
the library, we will make the change and make the modified library
available to our customers without charge.
WSC4VB Users Manual Page 11
8.0 Example Programs
The example programs are designed to demonstrate the various
capabilities of WSC4VB. The best way to become familiar with WSC4VB
is to study and run the example programs.
8.1 EASY
EASY is a very simple communications program using WSC4VB. Everything
that is typed on the keyboard is sent to the serial port, and
everthing incoming from the serial port is displayed on the screen.
The easiest way to test EASY is to connect to a modem. Typing 'AT'
should result in an 'OK' being displayed.
A null-modem cable can also be used to connect two computers together
with their serial ports. Run EASY on both machines. Whatever is typed
on one machine will be displayed on the other.
8.2 SELFTEST
SELFTEST performs a serial port I/O functionality test. Either a pair
of ports on the same computer (using a null modem cable) or a single
port (using a loopback adapter) can be tested.
Refer to LOOPBACK.TXT for an explanation of how to make a loopback
adapter (without tools!).
8.3 MODEM
MODEM is similiar to EASY, but with enhanced capability. It can set
flow control (hardware, software, or none), DTR line (set or clear),
RTS line (set or clear), display the transmit & receive queue sizes,
detect a break signal, detect changes in DSR and CTS, as well as
check for various line errors (parity error, framing error, data
overrun, receive queue overflow, and transmit buffer full).
WSC4VB Users Manual Page 12
8.4 TERM
TERM is a simple terminal emulator suitable for calling up a BBS and
downloading or uploading files using XMODEM or YMODEM. The TERM
program uses MIO.DLL for modem control commands, ASDRV.DLL for the
ASCII protocol, and the XYDRV.DLL for XMODEM & YMODEM protocol.
Selecting 'Dial' from the menu bar will result in a pop-up dialog
requesting the phone number to dial. Once entered, the number is
dialed, and the program will wait for up to 60 seconds for the
'CONNECT' string from the modem. This wait can be terminated at any
time by choosing 'BREAK' on the menu bar.
Once logged on, files can be uploaded or downloaded by selecting
'Send' or 'Receive' from the menu bar. To abort a file transfer,
choose 'BREAK' from the menu bar then type a series of Ctrl-X (^X)
characters from the keyboard.
8.5 FINDER
The FINDER program searches for a connected modem. Your modem must be
connected to one of COM1, COM2, COM3, or COM4, and must be turned on.
FINDER takes no arguments. After connecting your modem to one of your
serial ports, type
FINDER
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -