213 of 307
ZBasic System Library 203 ZX Microcontroller Family PutQueue Type Subroutine Invocation PutQueue(queue, var, count) Parameter Method Type Description queue ByRef array of Byte The queue to which to write data. var ByRef any type The variable from which to read data to be written to the queue. count ByVal int16 The number of bytes to write to the queue. Discussion This routine reads data from the variable and writes it to the specified queue. If there is insufficient space in the queue, the calling task will suspend until space becomes available. Note, particularly, that no data will be written until there is room for all the data to be written. This has two important ramifications. Firstly, if the number of bytes to be written is larger than the data capacity of the queue, the write will never complete. Secondly, if data is never taken out of the queue thus making room for the additional data, the write will also never complete. Note that the number of bytes to write may be larger than the named variable. If this is the case, data will be taken from subsequent memory locations until the write count is satisfied. This may or may not be what you intended to occur. Note, also, that before any queue operations are performed, the queue data structure must be initialized. See the discussion of OpenQueue() for more details. Also, attempting to put data in a queue that has been assigned to a Com port as the receive queue will produce undefined results. Example Dim outQueue(1 to 40) as Byte Dim lval as Long Call OpenQueue(outQueue, SizeOf(outQueue)) lval = &H55aa Call PutQueue(outQueue, lval, SizeOf(lval)) Compatibility BasicX allows any type for the first parameter. This implementation requires that it be an array of Byte. See Also PutQueueByte, PutQueueStr