Reading Modem Responses - HP 82718A Expansion Pod Reference Manual

For use with the hp-75
Hide thumbs Also See for HP 82718A Expansion Pod:
Table of Contents

Advertisement

Software Usage and Examples
Reading Modem Responses
Frequently when using the modem, an application program will use
t'10D I tH:
to read modem responses
(CONNECT, OK, etc.) for two reasons: to establish if a certain condition has occurred, or to remove the
modem response from the incoming data stream. A single
t'10D I
t·~~:.
may not read all the characters of a
response at once-you may need more than one
t'10D I
t·U
to collect the entire response. To collect the
response, use a general purpose subroutine such as the one below:
1
(1(10
t'1$=
11 11
Initialize scratch variable
1
(106
!
1~X17
1
(1(1:3
I
10(1'3
I
Look for the string to be found,
successive MODIN$s and searching
bl::l accur'lU l.:=it. i n'd
F$.
1010
M$=M$&MODIN$
e
IF NOT POS(M$,F$) THEN
1010
ELSE RETURN
This subroutine is called by passing it the string to be found in
F$.
For example, to find %CONNECT, the
calling sequence is:
This calling sequence will only determine if a connection has been made. If you want to remove the
response from the incoming data stream, you need to know the full sequence of characters for a
~~~f:;t:::u;:~~o~:~ ~!c~~e~CONNECT ~R :~t
%OK
~~ :~t
(long responses onlY---4lee appendix D). The
10
E$=CHR$ (
1 :::)
&CHR$ (
1
(1::'
I~
F$=E$:~.:
11
~·~COt·mECT
11
:~.:E$:~.:
11
\OK
11
t:E$
2(1
GOSUB
1000
This subroutine can also be used when the modem is turned on by setting F $ to r,OK for long responses or
%4[,m short ones. The last two examples under "Turning the Modem On" would become:
10
MODEM OFF
e
MODEM ON
20
F$=
II
~·~OK
II
I~
GO:::UB
100(1
and
1
[I
I HIT I AL I ZE
11:
t'10Dt'1
11
e
t'10DEt'1
ot·~
2(1
F$=II~·~OKII
I~
GOSUB
1
(1
(HZ1
In that same section ("Turning the Modem On "), there were two reasons listed why line 20 of the previous
example can be simplified to
IF t'10D I
t·U#
11
~·~OK
11
THEt·~
20.
There are two more reasons as well.
First, when the modem is turned on, the long response is %OK, not r,OK
~~ ,~t
(see appendix D). Second,
only when the modem is turned on, any response (long or short) will be read ina single
t'1OD I
t·U.
22

Advertisement

Table of Contents
loading

Table of Contents