73
4.6.4 PROGRAM MANIPULATION
These two functions can be used as the basis of remote update of BASIC applications.
Programs can be downloaded to the file system and activated immediately or later.
DOWNLOAD_BASIC
Purpose To read a new BASIC program from a specific COM port and store it to
specified transaction file.
Syntax A% = DOWNLOAD_BASIC(file%, port%)
Remarks “A%” is an integer variable to be assigned to the result.
0 Success
-1 Invalid transaction file
-2 Invalid COM port
-3 No response from COM port
-4 Fail to read version of BASIC program
-5 Fail to read program header (.ini)
-6 Fail to read object file (.syn)
-7 Write error – insufficient space in SRAM.
“file%” is an integer variable, indicating to which transaction file
file on 8200, 8400, 8700) in the file system the application is saved to.
1~6 Application program saved to file system
18 Application program saved to SRAM
, which is not accessible to
users but can only be used with UPDATE_BASIC(18)
(currently supported on 8000, 8200, 8300, 8400, 8700 only)
“port%”
is an integer variable, indicating from which COM port the application
is to be read.
1 Serial IR, IrDA or RS-232
2 Bluetooth
5 USB Virtual COM (8200, 8400, 8700)
Note that the tran
saction file to receive the program must be empty or cleared
out, for example, using EMPTY_TRANSACTION_EX(). Use SET_COM() and
SET_COM_TYPE() to set the COM port properties. To start with the download
process on your computer, run the download utility Synl
Compile | Download via the BASIC Compiler.
Example
Error_Code% = DOWNLOAD_BASIC(6, 1)