beautypg.com

Rpbasic-52 programming guide – Remote Processing BASIC 52 User Manual

Page 153

background image

RPBASIC-52 PROGRAMMING GUIDE

B-4

rem 2 = looking for password. If ok send log on. If not, tell user 1500
rem 3 = looking for command. If ok, set MCYCLE. If not, tell user 1500
rem 4 = Send esc, look for OK, send hang up, look for OK, send reset
rem look for OK 1600
rem 5 = Send out sign on message after a few seconds delay

rem cycle = 0 1 2 3 4 5 6 7
1000

on cycle gosub 1400,1500,1500,1500,1600,1900

rem other ONTICK stuff

1390 reti

rem cycle 0 waiting for ringing
rem This is idle. No checking is done

1400 return

rem

Cycle 1, 2, or 3

rem Looking for CONNECT, password, or command.
rem Look for NO CARRIER flag. If set, then reset modem
rem Check 10 second counter atim and compare with ctim

1500 atim = atim+1 :rem the '1' is changed based on current ON TICK time
1510 if nocfg = 1 then 1550 : rem if no carrier, reset all
1520 if atim < ctim then return

rem no communication received Hang up and reset modem

rem DEBUG

1540 print : print "no CONNECT, password, or command in time"

1550 cycle = 4
1560 htim = 0
1570 nocfg = 0
1590 return

rem

cycle 4

rem Wait 2 seconds, send esc, look for OK, send hang up
rem look for OK

rem ATIM value is used to determine what part of cycle
rem 2 seconds are allowed for each step
rem first wait htim=0
rem send esc htim = 2
rem look for OK, send hangup htim = 5
rem look for OK, send reset htim = 8
rem look for OK. got into cycle 0 htim = 11

1600 htim = htim + 1
1610 if htim = 2 then 1650
1620 if htim = 5 then 1700
1630 if htim = 8 then 1750
1635 if htim = 11 then 1850
1640 if htim > 12 then htim = 0 : return :rem if really large, then reset
1645 return : rem if none of the above

rem send out escape sequence. Look for OK

1650 uo 1
1660 print "+++",
1670 uo 0
1680 okflg = 0 : rem reset flag

rem DEBUG