318 of 318
ZBasic System Library 308 ZX Microcontroller Family ZXCmdMode Type Subroutine Invocation ZXCmdMode() ZXCmdMode(highSpeed) Parameter Method Type Description highSpeed ByVal Boolean A flag controlling the communication speed in command mode. Discussion This routine causes the ZX to stop executing your application and enter “command mode”. When in command mode, the ZX will respond to download commands and other special commands. If the highSpeed parameter is specified and it is True, command mode is invoked and the baud rate of Com1 is changed to 115.2K baud (the standard download baud rate). If the highSpeed parameter is False or omitted, command mode is invoked and the baud rate is left unchanged (however, see the Compatability section, below). Note: for compatibility with the IDE and the zload utility, this subroutine must be invoked with a False or omitted parameter. The highSpeed parameter is provided in case a custom downloader might require it. You can use this routine in your application to facilitate downloading triggered by some particular event, e.g. receipt of a certain character or sequence of characters, the occurrence of an external signal, etc. You can use the downloader DLL source code (installed as part of ZBasic) to construct a special purpose downloader for your application. Alternately, if your application detects receipt of an “ATN character” and then invokes ZXCmdMode(), you can use the ZLoad command line utility or the ZBasic IDE to perform downloading without needing to have DTR connected to the device. Example Call ZXCmdMode() Compatibility With VM versions prior to v3.0.4 and with native mode bootloaders prior to v1.4, invoking this subroutine with a False or omitted parameter results in the baud rate switching to 19.2K, the standard debug baud rate. In most cases, this change will be insignificant because in order for the download to succeed the serial channel would be set to 19.2K baud and the Com1 baud rate would be 19.2K baud as well. Since the new behavior does not change the Com1 baud rate, existing applications should continue to work as they did before. The new behavior was implemented for compatibility with fixed-speed communication links such as BlueTooth and XBee. Since the baud rate doesn’t get changed, you can configure your system for any desirable baud rate and perform downloading over the fixed-speed link. The VM version can be determined using the SerialNumber() subroutine. The bootloader version number can be determined using Register.BootVersion.