lookup function

Texy

Senior Member
Manual 2 states
" Each lookup is limited to 256 entries, but each entry may be a bit byte of wordconstant or variable."
That isn't very clear, or is it a typo. Should it say "may be a bit, byte or word constant or variable".
I,m at work at the moment, so can't try it in PE, so what I,m asking is, can the lookup function be 256 entries of word length?

Cheers,
Texy

 

hippy

Ex-Staff (retired)
Looks like it got a bit jumbled there and your interpretation is correct; each LOOKUP can contain 256 word length entries.
 

Texy

Senior Member
OK, thanks for the clarification, altho I,m very surprised Westy hasn't already pointed it out:eek:
With the ever increasing program memory available to the picaxe range,are there any plans to increase the potential storage of the eeprom/table/lookup functions?
Of course with a bit of clever programming,ie multiple lookup commands, program memory can be used to cover as space as is required, but it would be more efficient if a single table or lookup command would cover a few k rather than 256 bytes.
Cheers,
Texy
 

Texy

Senior Member
Hmm, it seems the lookup function doesn't like negative numbers -
lookup b23,(503,-64,-75,-85,-96,-106,-116,-127,-137,-147,-158,-168,-178),w5
brings up a syntax error pointing to -64. There's ways round it of course, but more code will be required.

Texy
 

papaof2

Senior Member
Hmm, it seems the lookup function doesn't like negative numbers -
lookup b23,(503,-64,-75,-85,-96,-106,-116,-127,-137,-147,-158,-168,-178),w5
brings up a syntax error pointing to -64. There's ways round it of course, but more code will be required.

Texy
PICAXE doesn't use negative numbers. In byte-sized math, 0 - 1 = 255, not -1. Same concept for word-sized math: 0 - 1 = 65535, not -1. You'll have to do the "math" on the negative numbers for LOOKUP to be able to process them.

John
 
Top