PDA

View Full Version : Multi diomencinal array



morphyn
- 11th February 2009, 19:43
I'd like to create a multi dimensional array in pic basic. Is it possible? And how?
What i mean is something like this. A var byte[9][5]

Dave
- 11th February 2009, 19:54
morphyn, Think about it... Just multiply one element by the other....

Dave Purola,
N8NTA

mackrackit
- 11th February 2009, 19:54
It is sort of possible in a round about way...

This may help
http://www.picbasic.co.uk/forum/showthread.php?t=544

morphyn
- 11th February 2009, 21:08
mackrackit and dave thanks for your replies.Mackrackit, It was also something that i wonder but it won`t be usefull for my problem i guess. I have 2 variables that will help me to refer to a byte.
For example: i will need a number from the array and i will call it via these two variables.
Lets say what i need is something like this.
1 10 15 20
10 15 1 20
20 1 10 15
15 20 1 10
When my x-axis of the array is 2 and and y axis of the array is 3 i will get 20.
The value of the axis` will be defined by my variables. And the value of my variables will be up to the device that i will communicate with.(there are more than one devices so...)
Dave, I couldn`t get what you mean. Can you give an example?

mackrackit
- 11th February 2009, 21:17
I do not quite follow you.
But... have you looked at a LOOKUP table?

morphyn
- 11th February 2009, 21:19
I guess i`ve found a solution to my problem.
FIRSTARY VAR BYTE[7]
SECONDARY VAR BYTE[7]
THIRDARY VAR BYTE[7]
' DEFINE ARRAYS HERE...
ROW VAR BYTE
COLUMN VAR BYTE
DATA VAR BYTE
SELECT CASE ROW
CASE 1
DATA=FIRSTARY[COLUMN]
CASE 2
DATA=SECONDARY[COLUMN]
CASE 3
DATA=THIRDARY[COLUMN]
ENDSELECT

Thanks for your help guys...