386
Using
Peripheral
Devices
160
Find
the
row
and
column.
170
Sound
the
appropriate
tones.
180
Wait,
then
go
on
to
next
digit.
190
Dialing
is
completed.
200
Print
the
error
message.
210
Turn
off
the
volume,
and
hang
up
the
phone.
220
Open
the
RS232
port.
230
Get
a
byte
from
the
RS232
buffer;
if
not
a
null,
print
it
on
the
screen.
240
Get
a
byte
from
the
keyboard;
if
a
null,
go
back
to 230.
250
Check
for
Q
key
pressed
with
Q
key
to
quit.
260
Send
the
character
to
RS232.
270
Go
back
to
230.
280
Close
the
RS232
port
and
go
to
210.
Example:
This
example
uses
pulses
to
dial
the
phone
and
then
starts
communicating
until
a
Q
Q
is
typed.
10
PRINT"MAKE
SURE
A-0
SWITCH
IS
ON
0"
20
INPUT"NUMBER
TO
DIAL";N$
30
IFLEN(N$)O7THEN20
40
POKE64784,(PEEK(64784)OR64)
50
FORI=1TO500:NEXT
60
POKE64784,(PEEK(64784)AND191)
70
PORI=1TO500:NEXT
80
FORlKLTO7:N=ASC(MID$(N$,I,l))-48
90
IFN<0ORN>9THEN160
100
IFN=0THENN=10
110
PORJ=1TON
120
POKE64784,
(PEEK(64784)OR64)
:FORT=1TO40:NEXT
130
POKE64784,(PEEK(64784)AND191):FORT=1TO25:NEXTT,J
140
FORT=1TO350:NEXTT,I
150
PRINT"DIAL
COMPLETE":GOTO180
160
PRINT"INVALID-NUMBER"
170
POKE64784,(PEEK(64784)OR64):END
180
OPEN1,2,0,CHR$(22)+CHR$(5)
190
GET#1,A$:IFA$O""THENPRINTA$;
200
GETA$:IFA$=""THEN190
210
IFA$=CHR$(171)THEN240
220
PRINT#1,A$;
230
GOTO190
240
CLOSE1:GOTO170