Start Back Next End
  
ZBasic Language Reference
48
ZBasic Microcontrollers
dimensions are deduced from the content of the initialization data and the lower bound of each index is
always 1.  The definition syntax for a Program Memory data item is:
{Public | Private | Dim} <name> as [New] <progmem-type>(<init-data>)
For Program Memory data items defined within a subroutine or function, the Public and Private keywords
are disallowed because they would serve no useful purpose.
The supported <progmem-type> items are:
One-dimensional types (vector types):
ByteVectorData
ByteVectorDataRW
IntegerVectorData 
IntegerVectorDataRW
LongVectorData
LongVectorDataRW
SingleVectorData
SingleVectorDataRW
StringVectorData
Two-dimensional types (table types):
ByteTableData
ByteTableDataRW
IntegerTableData
IntegerTableDataRW
LongTableData
LongTableDataRW
SingleTableData
SingleTableDataRW
StringTableData
The types ending with RW may be both read and written while the remaining types can read but they
cannot have values assigned to them.  (Of course, you can still modify the read-only types by using the
System Library routine PutProgMem() but this is generally only used for special circumstances.)
The initialization data may be provided in two ways.  The first way is to provide a file name, enclosed in
quote marks, as the <init-data> element in the syntax description above.  If the filename is not
specified using an absolute path (i.e. beginning with the root directory and/or a drive letter), the path
prefix (if any) of the current module is appended to the front of the filename.  Note, however, that if an
include path is specified on the command line, a filename that is specified with a relative path will,
instead, be sought in among the directories specified in the include path list.  See Section 10.2 for more
information on the include path option.
The content of the file should be a textual representation of the initialization data.  For integral types, the
data values may be expressed in decimal, in hexadecimal (using a &H or &h prefix), or in binary (using a
&B or &b prefix).  In the latter case, an underscore may exist between any pair of digits.  For real types,
the data values may be expressed in integral, decimal or scientific notation format.  See the ValueS()
System Library routine for a description and examples of the acceptable formats of values.  For string
types, the data values should be zero or more characters enclosed in quotation marks.  To include a
quotation mark in the string it must appear twice in succession.
For the one-dimensional types, one or more values may be specified per line.  When multiple values are
given per line they must be separated by a comma and/or white space (space or tab characters).  The
first value on a line may be preceded by white space.  Following the last value on a line, there may be a
comma and/or white space and/or a comment (introduced by an apostrophe).  The number of elements in
the vector will be exactly the number of properly formatted data values in the file.
For the two-dimensional types, the values for each row of the table must be placed on a separate line. 
The column values on each line must be separated by a comma and/or white space.  A comment may
follow the last column value on a line.  The number of valid column values must be the same for each
row.
For either type, the initialization data file may contain blank lines and lines containing only a comment
optionally preceded by white space.  For the Byte types, data values may also be specified using a
quoted string.  In this case, the ASCII value of each character of the string is used as a data value.  As
usual, a quote may be included in the string by using two quotes in succession.  For the string types,
values may be specified by concatenating strings and/or byte values by separating each pair of
components with a plus sign.  The examples below include samples of each of these special cases.
Previous page Top Next page