TABLE with 08M2

nick12ab

Senior Member
I get that too.

If you press F1, you get a dialog with quick help for the commands and it says that none of the M2 parts are compatible! But it does say that of the M2 parts, only the 14M2 and 20M2 are shown to be compatible however the new 18M2 is as well.

The manual seems to be correct though.
 
Last edited:

hitsware

Member
' in qbasic it would be ~

for x=0 to 3: read c(x): next x
for x=0 to 3: read m(x): next x
for x=0 to 3: read d(x):next x

data 24,4,32,4,
data 0,48,28,48
data 0,0,4,0

??????????
 

nick12ab

Senior Member
How to do that with Picaxe ?
Code:
for x=0 to 3: read c(x): next x
for x=0 to 3: read m(x): next x
for x=0 to 3: read d(x):next x
So c, m and d are these arrays? :
Code:
c[] = {24,4,32,4}
m[] = {0,48,28,48}
n[] = {0,0,4,0}
PICAXE doesn't support arrays like that, but the lookup command does a similar thing, although you'll have to use a gosub if you want to repeatedly use the lookup throughout the program.

Example 1:
Code:
symbol x = b4
symbol targetvariable = b5


	for x = 0 to 3 : lookup x,(24,4,32,4),targetvariable : next
	for x = 0 to 3 : lookup x,(0,48,28,48),targetvariable : next
	for x = 0 to 3 : lookup x,(0,0,4,0),targetvariable : next
Example 2:
Code:
symbol x = b4
symbol targetvariable = b5


	for x = 0 to 3 : gosub array_c : next
	for x = 0 to 3 : gosub array_m : next
	for x = 0 to 3 : gosub array_n : next
	do : loop

array_c:
	lookup x,(24,4,32,4),targetvariable
	return

array_m:
	lookup x,(0,48,28,48),targetvariable
	return

array_n:
	lookup x,(0,0,4,0),targetvariable
	return
Alternative methods include using the scratchpad (X1 and X2 parts) where the scratchpad is loaded with the data at the beginning of the program using a for : next loop and ptr as the loop variable (and assigning values to @ptr using a lookup) although that is a bit messy and you have to use lookup or some other method to get the data into RAM anyway so why not just use lookup etc. in the first place! Same goes for using the general purpose RAM (with bptr and @bptr variables).

An alternative to table is eeprom - it works in a similar way to table, but you use the read command instead of readtable and you can also modify the contents of EEPROM at runtime. Like table, the contents of eeprom is not lost when the power is removed.
 

westaust55

Moderator
So should TABLE work with 08M2 or not ?
In short NO.

Long answer - see manual 2 and the M2 briefing note - both accessible via the "Manuals" link at the top of this forums pages.
It is only the on-line Command website pages that do not tell the full story as the diagrams given in manual 2 at the left side of every page are not included in the online webpages.
As I have recently mentioned, it needs Rev Ed to add a few more words to the o line Commands webpage to clarify this situation.

Rev Ed are usually pretty quick to alter the web pages if something comes to their attention but with the Chrustmas/New Year period it may take a little longer.

I am puzzled why you are still asking this after post 3 in this thread and you own post 5 here:
http://www.picaxeforum.co.uk/showthread.php?22938-Table-vs-Data
Yesterday declaring you get an error when you try to use the TABLE command with an 08M2 and my response.
 
Last edited:

hitsware

Member
> I am puzzled why you are still asking this after
> post 3 in this thread and you own post 5 here:
> http://www.picaxeforum.co.uk/showthr...-Table-vs-Data
> Yesterday declaring you get an error when you try to use
> the TABLE command with an 08M2 and my response.

I see now that Manual 2 uses the chip pics on the left to
signify which chips have access to the command being
discussed .... I hadn't noticed that and thought perhaps
the editor needed an update .........
 

westaust55

Moderator
@hitsware,
I am not sure what you are using to insert a quote from an earlier post however if you click the "Reply with Quote" button at the bottom right of the post you will auto open a new post with the earlier posts content in quote tags which appears as a sub balloon in your post,

Good to do that as the balloon also in lures the author of the quoted words and a link to the post.
However, in doing that, try to remove the redundant words and just leave the pertinent words to which you are replying.
Some folks tend to "reply with Quote" at every post resulting in great Tracy's of text being duplicated at every post
 
Last edited:
Top