ZBasic Language Reference
16
ZX Microcontroller Family
300
600
1200
2400
4800
9600
14400
19200
28800
38400
57600
76800
115200
230400
It is important to note that for VM devices, the speed selection is made part of the download image and is
written to Persistent Memory when the code is downloaded. If, later, a program is downloaded that does
not contain Option Com1Speed directive, the Persistent Memory location containing the Com1 speed
indicator will be unchanged from the earlier setting.
For native mode devices, the speed can also be set to zero thereby requesting that Com1 not be open
initially. In this case, if you want to use Com1 you must specifically open it and if you later close Com1 it
will remain closed. This is in contrast to the normal ZX behavior of always keeping Com1 open. The
primary advantage to specifying the speed as zero is that it results in a smaller executable size provided
that your application does not explicitly open Com1.
Example
Option Com1Speed 9600
Option Console
Option Console <serial-channel-designator>
Default: Com1
This option, available only on native mode ZX devices, allows you to specify the serial channel to which
output will be routed when Debug.Print, Console.Write or Console.WriteLine are used and from which
input will be obtained when Console.Read or Console.ReadLine is used. If used, the directive must
appear in the first module compiled and it must appear after the target device is specified. Any serial
channel designator that is valid for the target device (e.g., Com1 through Com12) may be used. Note
that if the specified serial channel is not open with transmission enabled (i.e. a transmit queue has been
specified) at the time output is generated, the resulting character stream will be silently discarded. Also,
the console read functions will never return if the specified serial channel is either not open or not enabled
for reception.
Example
Option Console Com2
Option AtnChar
Option AtnChar [ <constant-expression> | Default ]
Default: &H00
This directive can be used to specify a special character that can be used instead of DTR signaling to
perform downloads to a ZX device. This is useful in situations where the communication channel does
not support DTR or is not capable of toggling DTR fast enough to be recognized as an attention signal.
The range of allowable values for the ATN character is 0 to 31 (&H00 to &H1F) with the value of zero
serving as the disabling value.
It is important to note that for VM devices, the ATN character is made part of the download image and is
written to Persistent Memory when the code is downloaded. If, later, a program is downloaded that does
not contain Option AtnChar directive, the Persistent memory location containing the ATN character value
will be unchanged from the earlier setting.
Example
Option AtnChar &H04