User Tools

Site Tools

한국어

cubloc:getstr2:index

GetStr2( )

variable = GetStr(channel, byteLength, stopChar)

variable String Variable to store results
channel RS-232 Channel
byteLength Length of data to receive
stopChar Stop character ASCII code

Same as the GetStr command, except it will stop reading data when it encounters stopChar, even if the data received is less than byteLength. If stopChar is not found, then it will operate just like GetStr.

Const Device = CB280
Dim A As String * 10
OpenCom 1,115200,3,50,10
Set Until 1,8, 10         '10 is a required dummy value, it will be ignored
On Recv1 GoSub GOTDATA
Do
  Do While In(0) = 0
  Loop                    ' Wait until press button (Connect P0)
  PutStr 1,"CUBLOC Controller",Cr
  Do While In(0) = 1
  Loop
Loop
 
GOTDATA:
  A = GetStr2(1,8,0x30)  ' Get 8 byte until 0x30 (space)
  Debug A
  Return

Go CUBLOC home

cubloc/getstr2/index.txt · Last modified: 2016/04/14 11:07 (external edit)