82 of 318
ZBasic System Library 72 ZX Microcontroller Family Debug.Print Type Special Purpose Invocation Debug.Print stringList Parameter Method Type Description stringList ByVal String One or more strings or values to send out Com1. Discussion Debug.Print is neither a subroutine nor a function. It has more in common with ZBasic statements but it described here for ease of reference. This special purpose method is useful for outputting debugging information and other data to Com1. The arguments provided to the command consist of zero or more strings or values each separated by a semicolon. If non-string values are supplied, they are converted to strings automatically using the CStr() function. Unless the list ends with a semicolon, a carriage return/new line will also be output after all of the strings have been output. When this statement is invoked, execution of the current task will not continue and no other task will be allowed to run until the string’s characters have been transferred to the system output queue. This caveat applies independently to each string in the semicolon-separated list as well as to the end-of-line string, if applicable. The latency-inducing effect described above can be mitigated by preparing a new output queue that is sufficiently large such that there is always enough free space in the queue when this method is invoked. See the example below. In contrast to other System Library routines that copy data to a queue, the string length is not limited to the system output queue length. Examples Debug.Print "Hello, world! " This prints the given string followed by a carriage return/new line. Debug.Print "The value is ";CStr(val); This prints the string followed immediately by the string equivalent of the value. Note that since the command ends with a semicolon, no carriage return/new line will be generated. Dim iq(1 to 20) as Byte Dim oq(1 to 100) as Byte Call OpenQueue(iq, SizeOf(iq)) Call OpenQueue(oq, SizeOf(oq)) Call OpenCom(1, 19200, iq, oq) This example code shows how to increase the size of the output queue in order to reduce latency. The default input could be retained by replacing the last line above with the following line and deleting the other lines that refer to the variable iq. Call OpenCom(1, 19200, CByteArray(Register.RxQueue), oq) See Also Console.Write, Console.WriteLine