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

Page 156

Advertising
background image

RPBASIC-52 PROGRAMMING GUIDE

B-7

2240 cycle =4

rem DEBUG

2255 print "No CONNECT received. Input string=",$(0)

2260 return

rem hold off any xmission for 3 seconds before sending sign on

2270 cycle =5
2280 passw = 0

2290 return

rem

cycle 2

rem Looking for password.
rem If tried 3 times, hang up

2300 $(1) = "password"
2310 cia = str(8,$(0),$(1))
2320 if cia > 0 then 2350
2330 passw = passw + 1
2335 uo 1 : print "Invalid password. Re-enter" : uo 0
2340 if passw = 3 then cycle = 4 : htim = 0 : passw = 0
2345 return

rem check on length to make sure its all correct

2350 if str(0,$(0)) <> str(0,$(1)) then 2330

rem successful log in. Tell user to put in valid command

2360 cycle = 3
2370 uo 1
2380 print "Password accepted. Enter command"
2390 uo 0
2395 return

rem

Cycle 3

rem Process a command. If valid, set flag(n)

rem To make sure no erroneous data looks like a command, all commands are
rem prefixed with ">03". Idea is the likely hood of 4 random characters
rem making a valid command is unlikely compared to just 1

2400 $(1) = ">03"
2410 if str(8,$(0),$(1)) <> 0 then 2450
2420 uo 1 : print "Invalid command. Re-enter"
2430 uo 0
2440 return

rem command is number in 4th position
rem Line 2460 checks for valid command limit

2450 cia = asc($(0),4)-48
2460 if (cia < 0) .or.(cia > 2) then goto 2420
2470 flag(cia) = 1 : rem indicate do this

2490 return

Advertising