154 of 208
ZBasic Language Reference 146 ZX Microcontroller Family Perform ATN testing using COM2. zload –c2 –a The default serial port may be specified by setting an environment variable named ZLOAD_PORT. The value of this environment variable should be a series of decimal digits specifying the serial port number (1-99). The method used to set an environment variable varies depending on the operating system. Consult your OS documentation for more information. Example ZLOAD_PORT=2 If no default serial port is specified and the –c option is not specified, COM1 is used by default. Source code is provided in the distribution for the zload utility. It is a fairly simple program written in C and C++ targeted to the Windows platform. The utility may be able to be ported to another operating system by a skilled programmer who is familiar with programming for both Windows and the target platform. 9.1 Firmware Updates The firmware of VM-mode ZX devices (as opposed to native mode ZX devices) is designed to be field- upgradeable. This allows the control program to be updated with newer versions as enhancements are made and problems are fixed. An update can be installed in the ZX using the –u option of the zload command line utility and specifying the name of a file to install. The file must contain specially formatted data, the integrity of which is verified before downloading to the ZX. It is important to note that the separate update files are provided for the various models. Be sure that you have the correct update file for your ZX device. To perform a normal firmware update the ZX must be powered up and must be connected to your PC by a serial cable. An example invocation of zload to perform a normal firmware update is shown below. The example shows the use of the -c option to also specify the serial port to use. The file zx24_1-10- 2.zvm is an example of the specially formatted update file for the ZX-24. zload –c2 –u zx24_1-10-2.zvm On the 24-pin ZX devices, during the update process the red LED will be illuminated continuously and the green LED will blink at a rate of about twice per second. Note that since the LEDs are also connected to pins 25 and 26, if you have circuitry connected to these pins that would be adversely affected by the LEDs being activated you can suppress the activation of the LEDs by using the –U option to instead of using –u. It is important to ensure that the update process, once begun, is allowed to run to completion. Powering down the ZX or resetting it during the update may leave it in an unusable state. It is possible that the ZX may no longer be able to properly interact with the zload program to effect a subsequent complete update. In such a case, you may be able to use the special emergency update procedure described below. 9.1.1 Emergency Update Procedure To prepare a 24-pin ZX device for an emergency update you must ground the center terminal and the bottom terminal on the left end of the ZX device as shown in the diagram below. This can usually be done with a temporary connection like a test wire with alligator clips or similar connectors. When the ZX is powered up with these connections it enters the emergency update mode instead of operating normally.