Page 149 of 229 Start Back Next End ZBasic Language Reference 139 ZBasic Microcontrollers 9.5 Setting Device Options By default, the compiler generates code for the ZX-24 device. The target device may be changed either by adding a command line option to your project file or by adding a compiler directive to the first module to be compiled (usually the one containing the Main() routine). Alternatively, you may specify the target device by using the “Device Options…” entry on the Options menu. The resulting dialog contains a combobox with entries for the supported devices. Because of the large number of ZX and generic target devices that are supported, not all devices are initially displayed in the combobox. To add or remove devices from the combobox, click the “Edit Target List…” button on the Device Options dialog. After doing so, another dialog will appear that contains two listboxes. The listbox on the left contains the device names that will appear in the combobox on the Device Options dialog and the listbox on the right contains the remaining supported device names. Device names may be moved from one listbox to the other by selecting them (multiple selections via ctrl- click and shift click are allowed) and then clicking on the appropriate arrow button between the listboxes to effect the move. Clicking the OK button on this dialog will make your changes appear in the Device Options dialog. The Edit Targets dialog box also contains a “More>>” button in the lower righthand corner. Clicking on this button will expand the dialog to show some filtering options that can be used to reduce the number of target devices visible in the “omitted targets” listbox. Filtering makes it easier to find target devices of interest by reducing the total number shown. The Device Options dialog can also be used to update the firmware in your device or, for some ZBasic devices, to set configuration parameters like the Program Memory EEPROM characteristics or external RAM configuration. 9.6 Setting Target Options For generic target devices (i.e. targets that are not ZX devices), several device parameters need to be specified to allow the compiler to generate correct code for your specific target configuration. When a generic device is selected as the target device, the “Target Options…” entry on the Options menu is enabled. Selecting this entry will display the target options dialog. The dialog will be populated with either a set of default values or, if available, the values that would be seen by the compiler if it were run to compile the current project. The Help button on the dialog may be clicked to display an HTML file describing the dialog. Note that many calculations (such as baud rate and RTC accuracy) are deferred until the Apply button is clicked. At that time, a set of matching device parameters options is generated into an edit box in the dialog (expose this by clicking the More button in the lower right corner). The set of device parameters may be selected, copied to the clipboard and pasted into the desired file. 9.7 Setting the Downloader Command For target devices that do not contain a standard ZBasic bootloader, you must specify a downloader command if you want the IDE to perform downloads to the device. The downloader command is placed in the User Options file (load it into the IDE by selecting “Open User Options File” on the Options menu) and has the form shown below for a generic Atmel AVR device. command.project.avr.go=<command-line> An example downloading command using the Atmel STK500.exe utility is shown below. (Although this command appears to occupy several lines it is actually one long command line.) command.project.avr.go="c:\Program Files\atmel\avr tools\stk500\stk500.exe" - g -ccom1 -ms -I1MHz -d$(target_device) -e -if$(project.base).hex -pf -vf - ie$(project.base).eep -pe -ve .