View previous topic :: View next topic |
Author |
Message |
ellieakim
Joined: 09 Sep 2015 Posts: 15
|
Posted: Thu Oct 01, 2015 10:07 am Post subject: Multi Dim Array |
|
|
I am very confuse because I'm beginner.
Do BASCOM-AVR support multi-dimensional array?
a(4,3)
test(10,11)...
I find all of document and help, but I can’t find.
If someone know how can define multi-dimensional array, please help me
Thanks.
(BASCOM-AVR version : 2.0.7.8 ) |
|
Back to top |
|
|
i.dobson
Joined: 05 Jan 2006 Posts: 1570 Location: Basel, Switzerland
|
Posted: Thu Oct 01, 2015 10:36 am Post subject: |
|
|
Hello,
Bascom supports multi dim arrays, with some/many limitations.
You can define the array using
dim a(20,10)
You can only use the array for read/assignments, such as
a(1,2)=5
Var=a(1,2)
But you can't use it for more complex commands:-
print a(1,2) 'doesn't work
See the history.txt file (in your Bascom program directory) for more information.
Regards
Ian Dobson _________________ Walking on water and writing software to specification is easy if they're frozen. |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Thu Oct 01, 2015 1:48 pm Post subject: |
|
|
the problem with print was resolved. you can try this with a version from the SLA area. _________________ Mark |
|
Back to top |
|
|
ellieakim
Joined: 09 Sep 2015 Posts: 15
|
Posted: Thu Oct 01, 2015 11:22 pm Post subject: I can't access SLA Service access |
|
|
I can't access SLA Service access.
I bought BASCOM product last month.
How I can access SLA Service access area?
Thanks |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Thu Oct 01, 2015 11:35 pm Post subject: |
|
|
my comment was for Ian who mentioned the problem with print. Ian has access.
The SLA is an optional service(see shop). it offers high priority support and access to beta releases. But no worry, it is rolled in the next update. _________________ Mark |
|
Back to top |
|
|
ellieakim
Joined: 09 Sep 2015 Posts: 15
|
Posted: Mon Oct 05, 2015 10:42 am Post subject: What is multi-dimensional array type |
|
|
I define
Dim Inputarray(2, 10) As string * 15
Main:
Gosub Basedata
Gosub DisplayData1
.......
Basedata:
For I = 1 to 10
S = "Input Data " + Str(I)
Inputarray(I, 1) = "1"
Inputarray(I, 2) = S
Next
return
DisplayData1:
For I = 1 To 3
K = Offset + I
J = I - 1
J = J * 24
J = J + 10
IF Inputarray(K, 1) = "1" then
Showpic 15, J, DCheck
Else
Showpic 15, J, Check
End IF
Locate I* 3 , 5 : Lcd Inputarray(K, 1);
Locate I* 3 , 5 : Lcd Inputarray(K, 2);
Next
-----------------
I respect display
1 Inout Data 1
1 Inout Data 2
1 Inout Data 3
But result is
1
1
1
How I can defile data type for my wanted result |
|
Back to top |
|
|
bzijlstra
Joined: 30 Dec 2004 Posts: 1179 Location: Tilburg - Netherlands
|
Posted: Mon Oct 05, 2015 12:41 pm Post subject: Wrong |
|
|
Your K value gets a value bigger than you dimmed the array. |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Mon Oct 05, 2015 9:17 pm Post subject: |
|
|
using string that way is a waste of space.
you can best use an additional byte array and keep the string array to the required size and single dimensioned.
you can also put the data into the string with a delimiter. _________________ Mark |
|
Back to top |
|
|
ellieakim
Joined: 09 Sep 2015 Posts: 15
|
Posted: Wed Oct 07, 2015 5:17 am Post subject: I divide multi array to two of single array |
|
|
I solve this question.
I divide as single array prevent to waste of space and my confusion.
Thanks. |
|
Back to top |
|
|
Zitronenfalter
Joined: 23 Aug 2010 Posts: 12
|
Posted: Wed Oct 21, 2015 8:44 am Post subject: |
|
|
Hello
I use the version 2. 0. 7. 9 with multidimensional Arrays (e. g. C(4, 6) or X(2, 4, 3) with an ATmega1284P and have the following problem.
As long as the programme needs less than 50% of the Flash memory, this functions as expected.
Requires the program more than 50% of the flash memory does a correct reading (for example: fc = E_ConfigSW(fY, fX) and a subsequent output by Print Hex(fC); no longer correct (usually is as always 255. although other are values stored).
E_ConfigSW is an Array in the ERAM which with Dim E_ConfigSW(3, 185) as byte ERAM was created.
If one shortens the programme again so (while at quite different place in the programme just text editions are shortened), so that the programme remains all together less than 50% of Flash need, this functions select again correctly.
Where there is an error or how can this be fixed? |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Wed Oct 21, 2015 9:02 am Post subject: |
|
|
you can best write to support.
I suspect that the problem is related to the lookup table that is used. most likely the data for the array is at a page boundary. _________________ Mark |
|
Back to top |
|
|
|