PICBASIC PLUS LITE Manual - Profe Saul
PICBASIC PLUS LITE Manual - Profe Saul
PICBASIC PLUS LITE Manual - Profe Saul
- No tags were found...
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
<strong>PICBASIC</strong> <strong>PLUS</strong> Compiler5.15. DATASyntax : DATA { alphanumeric data }Overview :Operators :Example :Defines a table of alphanumeric data.alphanumeric data can be any alphabetic character or string enclosedin quotes (“) or numeric data without quotes.DIM Var as BYTEDATA 5 , 8 , ”fred” , 12RESTOREREAD Var ‘ Variable Var will now contain the value 5READ Var ‘ Variable Var will now contain the value 8‘ Pointer now placed at location 4 in our data table i.e. “r”RESTORE 3‘ Var will now contain the value 114 i.e. the ‘r’ character in decimalREAD VarThe data table is defined with the values 5,8,102,114,101,100,12 as“fred” equates to f:102, r:114, e:101, d:100 in decimal. The tablepointer is immediately restored to the beginning of the table. This isnot always required but as a general rule, it is a good idea to preventtable reading from overflowing.The first READ Var, takes the first item of data from the table and incrementsthe table pointer. The next READ Var therefore takes thesecond item of data. RESTORE 3 moves the table pointer to thefourth location (first location is pointer position 0) in the table - in thiscase where the letter ‘r’ is. READ Var now retrieves the decimalequivalent of ‘r’ which is 114.Notes :DATA tables should be placed near the beginning of your program.Attempts to read past the end of the table will result in errors and unpredictableresults.Only one instance of DATA is allowed per program, however, they beof any length. If the alphanumeric contents of the DATA statement willnot fit on one line then the extra information must be placed directlybelow using another DATA statement: -DATA “HELLO ”DATA “WORLD”is the same as: -DATA“HELLO WORLD”See also:READ , RESTORE42Copyright Crownhill 2001