Reaper2050
Programmer
- May 25, 2012
- 12
Good Day,
Can someone help me convert the following to Clarion? Any help would be highly appreciated.
Thanks in advance.
getstatus:
locate 4,40rint" ";
open "com1:4800,e,8,1" as #1
print #1,chr$(240+unitnumber%); 'FX X=unit number
delay 0.01
print #1,chr$(16*curhose%); 'Y0 Y=hose number
delay 0.01
print #1,chr$(176); 'B0 End of command
delay 0.1 'Wait for reply
buff%=loc(1) 'Length of input buffer
if buff%=0 then 'NO REPLY (OPEN LOOP)
S%=14
close #1
return
end if
on error goto stayalive1
recstrg$=input$(buff%,#1)
if buff%=4 then ' Should be xmitted plus rec'd bytes
if mid$(recstrg$,2,1)=chr$(16*curhose%) then 'Check echo
select case right$(recstrg$,1)
case chr$(224) 'ERR
S%=0
locate 4,40rint "ERR";
case chr$(225) 'OFF
S%=1
locate 4,40rint "OFF";
case chr$(226) 'CALL
S%=2
locate 4,40rint "CALL";
case chr$(227) 'BUSY
S%=3
locate 4,40rint "BUSY";
case chr$(228) 'FIN
S%=4
locate 4,40rint "FIN";
case chr$(229) 'ALONE
S%=5
locate 4,40rint "LONE";
case chr$(230) 'LEAK
S%=6
locate 4,40rint "LEAK";
case chr$(231) 'PERR
S%=7
locate 4,40rint "PERR";
case chr$(232) 'AUND
S%=8
locate 4,40rint "AUND";
case else 'UNDEFINED
S%=15
locate 4,40rint "UNDEFINED";
end select
else 'ECHO INCORRECT
S%=13
end if
else
S%=12 'INCORRECT NUMBER OF CHARACTERS
end if
recover1:
close #1
return
stayalive1:
S%=11 'TRANSMISSION ERROR
resume recover1
Can someone help me convert the following to Clarion? Any help would be highly appreciated.
Thanks in advance.
getstatus:
locate 4,40rint" ";
open "com1:4800,e,8,1" as #1
print #1,chr$(240+unitnumber%); 'FX X=unit number
delay 0.01
print #1,chr$(16*curhose%); 'Y0 Y=hose number
delay 0.01
print #1,chr$(176); 'B0 End of command
delay 0.1 'Wait for reply
buff%=loc(1) 'Length of input buffer
if buff%=0 then 'NO REPLY (OPEN LOOP)
S%=14
close #1
return
end if
on error goto stayalive1
recstrg$=input$(buff%,#1)
if buff%=4 then ' Should be xmitted plus rec'd bytes
if mid$(recstrg$,2,1)=chr$(16*curhose%) then 'Check echo
select case right$(recstrg$,1)
case chr$(224) 'ERR
S%=0
locate 4,40rint "ERR";
case chr$(225) 'OFF
S%=1
locate 4,40rint "OFF";
case chr$(226) 'CALL
S%=2
locate 4,40rint "CALL";
case chr$(227) 'BUSY
S%=3
locate 4,40rint "BUSY";
case chr$(228) 'FIN
S%=4
locate 4,40rint "FIN";
case chr$(229) 'ALONE
S%=5
locate 4,40rint "LONE";
case chr$(230) 'LEAK
S%=6
locate 4,40rint "LEAK";
case chr$(231) 'PERR
S%=7
locate 4,40rint "PERR";
case chr$(232) 'AUND
S%=8
locate 4,40rint "AUND";
case else 'UNDEFINED
S%=15
locate 4,40rint "UNDEFINED";
end select
else 'ECHO INCORRECT
S%=13
end if
else
S%=12 'INCORRECT NUMBER OF CHARACTERS
end if
recover1:
close #1
return
stayalive1:
S%=11 'TRANSMISSION ERROR
resume recover1