131 of 172
ZBasic Language Reference 124 ZX Microcontroller Family 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 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. 8.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. 8.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. Finally, the zload command must be invoked in emergency update mode, an example of which is shown below. zload –c2 –e zvm_1-12.zvm When the emergency update completes successfully the ZX may be powered off and the grounding jumpers may be removed. When it is powered up again it will begin running the newly installed control program normally. Note that the emergency mode may be used any time but because of the extra connections that are required it is primarily intended for extraordinary circumstances when the normal update mode cannot be employed.