====== GetStr( ) ====== ''variable = GetStr(channel, length)'' | //variable// |String Variable to store results | | //channel// | RS-232 Channel | |//length //| Length of data to receive | Same as [[..:Get:]], except the variable to store results can only be a String and the length of data is not limited to 4 bytes. ''GetStr()'' will return even even if there is not enough data in the receive buffer. Therefore, it may be necessary to use the [[:cubloc:blen:|BLen]] function to test for data in the receive buffer before calling ''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",Cr Do While In(0) = 1 Loop Loop GOTDATA: A = GetStr(1,8) Debug A Return In order to run the program above, please connect Rx to Tx as shown below. {{ :cubloc:getstr:geta.png?nolink |}} [[cubloc:index#system_library:|Go CUBLOC home]]