Command |
LOAD |
|
|
Description |
Copy Pages and Groups into a previously defined Page or Group.
The background and page attributes for 'Dest' apply to the result so
only entities are copied from previous pages. This allows simple
templates to be merged to form a complex page.
Combine Variables, Buffers and Text and copy the result to a Variable or
Buffer.
This allows absolute text and variables to be joined together and sent
to an interface. |
|
|
Syntax/Parameters |
Load(Dest,Name,Name,...); |
|
|
Options |
Text to Integer/Float
LOAD(MyInt,MyText); //The text string is parsed until a non-valid numeric value.
LOAD(MyInt,"1","2","3"); //MyInt = 123
If the string does not start with a number or +/- then the result is 0.
Example Pointers
To set/change which entity the entity pointer is pointing to you use '>' instead of ','.
LOAD( EntPtr1>"Var1" ); // Set EntPtr1 to point to Var1
LOAD( EntPtr1>"Var1",num,"3" ); // Set EntPtr1 to point to Var123 (very powerful, not found in C)
To put data or an entity name into the entity pointed to by the entity pointer use quotes.
LOAD( EntPtr1, "ABC" ); // Load the Entity pointed to by EntPtr1 with "ABC"
Change Setup Parameters
To change setup parameters use the dot operator. Do not change size and watchdog parameters.
This operator works for: RS2, RS4, AS1, AS2, DBG, I2C, SPI, USB, PWM, ADC, KEYIO, SYSTEM
LOAD( SYSTEM.bled, 50 ); // set backlight to 50% brightness
LOAD( RS2.baud, 9600); // change data rate
LOAD( RS2.baud, baudvar); //use a variable
Change Style Parameters
To change style parameters use the dot operator. Some parameters, such as maximum lengths, are not changeable.
LOAD( stText.col, blue ); // change text colour to blue
LOAD( stImg.curRel, CC );; // change cursor relative position (and update display ';;')
LOAD( stDraw.width, 2 ); // change border width to 2
Write files to NAND
Files can also be transferred from SDHC or serial port to NAND flash
LOAD(NAND,"SDHC/TU480A.mnu"); //use in conjunction with FPROG
LOAD(NAND,"EXT/filename.ext?size=xxx&timedate=yyy&usechecksum=0&useack=1");<CR>zzzzzzzzzzzzzzz
Reads xxx bytes of zzzzzz data from the current serial port and saves the data to the specified file in NAND, setting the file date to yyy
yyy is the file date/time string "YYYY:MM:DD:hh:mm:ss" as used by the RTC.
If usechecksum = 1 the file data must be followed by a 16 bit checksum of the file data (2 bytes, MSB first). The file is only written to NAND if the sent checksum matches the received data checksum.
If useack = 1 a single byte is returned after the file is written to indicate success / failure. 06h (ACK) is returned on success, 15h (NAK) is returned on failure.
Important, the data must follow immediately after the carriage return <CR> (0Dh). Unlike other commands, the optional line feed (0Ah) must not be sent as this will be interpreted as the first byte of data.
The
command that is used to write any file to NAND flash via an interface is
LOAD(NAND, "EXT/filename.ext?size=x&usechecksum=x&useack=x");<cr><file
data>
Description of parameters :-
‘size’ is the file length in bytes.
‘usechecksum’ must be either 1 or 0. If set to 1 then a two byte,
16 bit sum (msb first) of the file data must be sent after the file data.
‘useack’ must be either 1 or 0. If set to 1 then the standard ASCII
ACK or NACK code is sent back to the host to indicate success or
failure of the NAND write.
The file data is sent as raw data and is buffered in RAM and once
the correct number of bytes has been received the file is written to NAND.
When sending more than one file it is best to set ‘useack’ to 1.
The host then waits for ACK before sending the next file.
Example to write a file called 'test.txt' containing the string
'ABC' to NAND :-
LOAD(NAND, "EXT/test.txt?size=3&usechecksum=0&useack=0");<0Dh><41h><42h><43h>
Firmware Updating - v49.00
Support has been added to update the module firmware via a serial port / USB.
> LOAD( NAND, "EXT/xxxxxxxx.tft?size=xxxx&usechecksum=xx" );
> LOAD( NAND, "EXT/nandboot.bin?size=xxxx&usechecksum=xx" );
> LOAD( NAND, "EXT/iuloader.bin?size=xxxx&usechecksum=xx" );
Note: The checksum parameter should be used to help detect problems with data corruption.
Note: It is important that power is not removed during the updates.
Packed Project File (PPF) - v49.08
PPF file can now be loaded via serial port, eg LOAD( NAND, ''EXT/file.ppf?size=xxxx'' );.
UART Enable / Disable - v49.16
Added active=Y/N parameter to RS2/RS4/AS1/AS2/DBG/USB setup. Default is Y for backward compatibility. Allows the associated interface port pins to be disabled by using LOAD(port.active, N);
LOAD from NAND - v49.18
Added support for LOAD( NAND, "NAND/file.ppf" ); which allows a Packed Project File to be loaded and files extracted.
This also allows for LOAD( SDHC, "NAND/file.ext" ); which copies file from NAND to SDHC, though FILE( "COPY"... ) should be used in preference.
LOAD from serial port - v49.18
Files can now be loaded from serial ports using LOAD( NAND, "RS2/file.ext?size=1234" );
This allows file data to be read when not operating from command mode, ie can use RUN( "LOAD( NAND, \\22RS2/file.ext?size=1234\\22 );" ); then receive data on RS232 port.
NAND/NANDMNU/NANDLIB - v49.25
Load source of NAND/NANDMNU/NANDLIB now supported LOAD(SDHC,"NAND/file.ext");
Write files to NANN form VAR - v49.25
LOAD(NAND,"VAR/file.ext?size=xxxx",varBuf); added where the file contents are stored in a text variable.
If the file has the .ppf extension then it is processed and the containing files stored.
Text VAR Source - v49.32
Added ability to use same source text variable as the destination text variable:
LOAD( txtVarA, txtVarB, txtVarA );
Text entities - v49.32
Text entities now supported in LOAD() commands:
LOAD( txtVar, txtEnt, ... ); and LOAD( txtEnt, txtVar, ... ); and LOAD( RS2, txtEnt );
Support for LOAD( BUZZ, ON ); and LOAD( BUZZ, OFF ); - v49.42
* LOAD( BUZZ, ON ); and LOAD( BUZZ, OFF ); (ie ON and OFF without quotes) now
supported. |
|
|
Example |
LOAD(num,2); //load variable num with value 2
LOAD(EditText,EditText,"D"); //Concatonate contents of EditText with D
LOAD(RS2, "DATE=", DTIME, "; TEMP=", ACTVAL, ";\\0D\\0A"); //send concatenated data to RS232
LOAD(NumImg,"Image",num,".bmp"); //Create a name like Image2.bmp
LOAD(BasePage,BaseBack,BaseEnglish); //Create page from template pages
ARRAYS
LOAD( C, Var );
LOAD( C.1, Var );
LOAD( C.1.1, Var );
LOAD( Var1, C );
LOAD( Var1, C.0.1 );
|
|
|
|