Page 27 of 229 Start Back Next End ZBasic Language Reference 17 ZBasic Microcontrollers Option Com1Speed Option Com1Speed [ <constant-expression> | Default ] Default: 19200 This option has been deprecated. Use Option ConsoleSpeed instead. Option Console Option Console <serial-channel-designator> Default: see discussion Option Console <pin-designator> [Inverted] Option Console None This option, available only on native mode ZBasic target devices, allows you to specify the serial channel (using the first form) 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. The default console channel is Com1 for devices with at least one hardware UART. The compile-time constant Option.ConsoleChannel can be used in your code when it is necessary to perform different actions depending on the console channel setting (1 implies Com1, 2 implies Com2, etc.). The value of zero for Option.ConsoleChannel means that a serial channel is not being used for console output. The second form allows you to specify a pin to be used for the transmission of console data using the “bit- bang” method. This is most useful on devices that do not have a hardware UART or when you don’t want to dedicate a timer for the software UARTs. When this form is used, the pin specified is made an output and set to the “idle” state (high for non-inverted mode, low for inverted mode). It is important to note that when the bit-bang mode is employed the console is transmit-only; data reception is not supported. Note, also, that there is no output queue associated with the console in this mode. The compile-time constant Option.ConsolePin can be used in your code if you need to refer to the specified pin; zero means that no console pin as been specified. The third form allows you to specify that your application won’t use the console at all. This can reduce the code size and RAM use of your application in that case. Examples Option Console Com2 ' use Com2 for console I/O Option Console A.2 ' use pin A.2 for console output Option Console Pin 12 Inverted ' use pin 12 for console output (inverted) Option ComChannels Option ComChannels [ <constant-expression> ] Default: 4 This directive, useful only on native mode devices, can be used to reduce the amount of RAM needed by an application by specifying a lower number of software UART channels to be supported. For example, if your application only uses one software UART channel you can save approximately 75 bytes of RAM by using this directive to specify that only one channel is needed. Example Option ComChannels 1 ' request support for one SW UART channel