'---------------------------------------------------------------------------------------- ' Name: TFLASH_DYNAMIC_USE.TIG ' Type: TIGER-BASIC(tm) Source Code ' Release: V1.01 ' ' Purpose: Demonstrate how to administrate changing flash data in a simple ' but unsecure mode. ' ' ' (C) - Copyright Wilke Technology, P.O.Box 1727, D-52018 Aachen, Germany '---------------------------------------------------------------------------------------- ' ' Thank you for using BASIC-Tiger(tm) in your products. If you have questions, ideas ' or special needs, please contact your next distributor or the Tiger support team ' and visit our web site: ' ' Wilke Technology GmbH ' The Tiger Support Team ' P.O.Box 1727, D-52018 Aachen, Germany ' Krefelder Str. 147, D-52070 Aachen, Germany ' ' email: support@wilke-technology.com (English) ' email: support@wilke.de (German) ' Phone: +49 (241) 918 900 Mo to Fr, 7:00 to 16:00 (GMT) ' Fax: +49 (241) 918 9068 ' ' New information, new drivers and free downloads see: ' ' www.wilke-technology.com (English) ' www.wilke.de (German) ' ' Sincerely, ' ' Your Tiger Support Team ' ' '---------------------------------------------------------------------------------------- ' !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ' ' Please mind that there is no absolute data security during the operation of flash ' erasure. To ensure enduring data security you have to save the data by turns in ' two different flash sectors and mark the actual one. Before flash erasure of one ' sector the data must be saved in the other one! ' ' !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! user_var_strict #include define_a.inc ' global string array array a$(5) of strings(200) task main byte blNumSec long llSecSize long llAddr, llAddrDataSec byte i long llRes '***************************************** ' Initializations '***************************************** ' get number of sectors in user flash blNumSec = sysvarn(FLASH_DSEC, 0) ' get size of flash sectors llSecSize = sysvarn(FLASH_SSIZE, 0) ' calculate first position in last user flash sector llAddrDataSec = (blNumSec-1)*llSecSize ' get data from flash for i=0 to 4 a$(i) = peek_flash$( llAddrDataSec + i*200, 200 ) a$(i) = remove$( a$(i), "FF"% ) ' remove unpoked flash bytes next '***************************************** ' modify data '***************************************** ' fill string array with random values for i=0 to 4 a$(i) = str$(rnd(0)) next '***************************************** ' update flash data '***************************************** ' erase last flash sector erase_flash llAddrDataSec, llSecSize ' put string array in flash for i=0 to 4 ' Address, Value, Index, No_of_Bytes, Mode llRes = pokem_flash( llAddrDataSec + i*200, a$(i), 0, 200, 0 ) next end