Datentabelle im Flash
const F_CPU = 16000000 avr.device = atmega328p avr.clock = F_CPU avr.stack = 64 uart.baud = 19200 uart.recv.enable uart.send.enable dim i,v(9) as byte dim result as word dim txt as string print 12;"data table example" 'read 10 bytes from data table into array for i=0 to 9 v(i) = tabelle.ByteValue(i) print "tabelle.ByteValue(";str(i);"): ";str(v(i)) next print result = tabelle.WordValue(10) 'read word value (0xffac) print "tabelle.WordValue(10): 0x";hex(result) result = tabelle.WordValue(12) 'read word value (0x4711) print "tabelle.WordValue(12): 0x";hex(result) txt = tabelle.PString(14) ' read string print "txt = ";34;txt;34 halt() 'set data table in flash memory data tabelle .db 1,2,3,4,5,6,7,8,9,10 .dw 0xffac,0x4711 .db 5,"hallo" 'the first byte is the string length enddata
Siehe auch: Datenablage im Flash mit Strukturen.