51 of 323
ZBasic System Library 41 ZX Microcontroller Family CloseCom Type Subroutine Invocation CloseCom(channel, inQueue, outQueue) Parameter Method Type Description channel ByVal Byte The serial channel to close. inQueue ByRef array of Byte The input queue associated with the channel. outQueue ByRef array of Byte The output queue associated with the channel. Discussion This routine shuts down the specified serial channel. All communication is terminated even if there are still characters in the output queue that have not yet been sent. This call does not clear the queues. If that is a requirement, calls to ClearQueue() will need to be made. Alternately, you may want to use the value returned by StatusCom() to wait for all queued characters to be transmitted before invoking CloseCom(). Invoking this subroutine for Com1 (channel = 1) does not actually close the Com1 channel. Rather, doing so causes Com1 to revert to the default speed (19.2K baud) and to using the default I/O queues. If the specified serial channel is not open or if an invalid channel number is given the call has no effect. If the channel being closed is the only one of the software-based channels (Com3-Com6) that is open, the Serial Timer will be turned off and the corresponding timer busy flag will be set to False indicating that the Serial Timer is available for other uses. See Also ClearQueue, DefineCom, OpenCom, StatusCom