Page 305 of 346 Start Back Next End ZBasic System Library 293 ZBasic Microcontrollers StatusCom Type Function returning Byte Invocation StatusCom(chan) Parameter Method Type Description chan ByVal Byte The serial channel of interest. Discussion This function returns a set of flag bits that indicate the status of the specified serial channel. The meaning of each of the flag bits is shown in the table below. Serial Channel Status Bit Values Value Meaning &H01 The channel number is valid but may or may not be open. &H02 The channel is open. &H04 The channel has data yet to be transmitted. &H08 The channel is a software UART channel. &H10 The channel’s receive flow control pin is in the inactive state. &H20 The channel’s transmit flow control pin is in the inactive state. The remaining bits are currently undefined but may convey additional information in the future. It is strongly advised that you apply an AND mask to the returned value before comparing it to a fixed value. Doing so will prevent the future addition of bits from affecting your existing code. Note that use of this function can be combined with StatusQueue() to determine when all characters have been completely transmitted on a serial channel. The example code below illustrates this technique. Example ' wait until all characters are transmitted Do While StatusQueue(oq) Loop Do While CBool(StatusCom(chan) And &H04) Loop Compatibility This function is not available in BasicX compatibility mode. See Also CloseCom, ComChannels, ControlCom, DefineCom, OpenCom