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

RPBASIC-52 PROGRAMMING GUIDE
A-4
1700 $(2) = "A"
1710 GOTO 1510
rem Bad data
1750 $(2) = "N4"
1760 goto 1510
REM set a line according to data
rem For this example, line 8 is assumed to be controlled
rem Get desired status. Position 5 in string is 1 or 0
2000 oc = asc($(1),5) - 48
rem make sure data is 0 or 1
2010 if oc < 0 then 1750
2020 if oc > 1 then 1750
rem Set line according to input and send back acknowledge
2030 line 8,oc
2040 goto 1700
rem Command B
rem Set analog output
rem Command format: >XXBcdddd??
rem ||||||-dddd = data 1 to 4 numbers
rem || - channel no. 0 or 1
rem | - this command no
rem get the channel no.
2500 oc = asc($(1),5) - 48
rem Data starts at position 6 and could be 1-4 numbers long
rem Extract the last part of the string into $(4)
2510 od =str(0,$(1))
:rem get length of string
2520 od =str(7,$(4),$(1),6,od-7) :rem get only data
rem convert string number into usable number then output it
rem Check limits. If out of range, then return error
2530 od = str(3,$(4))
2540 if (od < 0) .or. (od > 4095) then 1750
2550 if (oc < 0) .or. (oc > 1) then 1750
2560 aot oc,od
2590 goto 1700
rem Command C
rem Return counter value
rem Command format: >xxCc??
rem |-counter number 0 or 1 (RPC-330)
rem (could be 4-11 also)
rem change limit check in 3010 for your card
rem get the channel no.
3000 oc = asc($(1),5) - 48
3010 if (oc < 0) .or. (oc > 1 ) then 1750
3020 oc = count(oc)
rem convert number to a string and output