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

RPBASIC-52 PROGRAMMING GUIDE
B-6
rem ON COM$ processing
rem get current input
2000 $(0) = com$(1)
2010 atim = 0 : rem if anything came in, reset actual com time
rem ignore any
2020 if str(0,$(0)) = 0 then return
rem if first character is lf, then filter it out
2030 if asc($(0),1) <> 10 then 2060
2040 cia = str(7,$(0),$(0),2,str(0,$(0))-1) :rem get rid of
2050 goto 2020:rem check for any length of string
rem DEBUG
2060 print : print "Received string:",$(0)," Cycle=",cycle
rem Check for NO CARRIER string. If there, then set flag and
rem continue. Other parts of program may use flag
2070 cia = str(8,$(0),$(2))
2075 if cia > 0 then nocfg = 1
rem process according to current cycle
rem CYCLE is defined as follows:
rem 0 = waiting for RING
rem 1 = looking for CONNECT
rem 2 = looking for password. If ok send log on. If not, tell user
rem 3 = looking for command. If ok, set MCYCLE. If not, tell user
rem 4 = Send esc, look for OK, send hang up, look for OK, send reset,
rem look for OK This routine just looks for OK
rem 5 = send out sign on message after 2 second delay for CONNECT
rem cycle = 0 1 2 3 4 5 6
2080 on cycle gosub 2100,2200,2300,2400,2500,2600
2090 return
rem check if RING message. If so, then set cycle for 1
2100 $(1) = "RING"
2120 cia = str(8,$(0),$(1))
2130 if cia = 0 then return :rem if something else, just ignore it
2140 cycle = 1
rem DEBUG
2150 print "Got RING. To cycle 1"
2190 return
rem
cycle = 1
rem check for CONNECT message
rem if not, hang up by setting cycle 4
rem if CONNECT, then wait before sending sign on
2200 $(1) = "CONNECT"
2210 htim = 0
2220 cia = str(8,$(0),$(1))
2230 if cia > 0 then 2270