Home
JAQForum Ver 20.06
Log In or Join  
Active Topics
Local Time 22:18 28 Apr 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : E100 Max Program Line Length

Author Message
ion507
Newbie

Joined: 05/12/2014
Location: Australia
Posts: 14
Posted: 11:19pm 27 Feb 2017
Copy link to clipboard 
Print this post

I'm getting into my first E100 project and I'm using single dimension arrays to hold data that gets loaded, depending on which menu selection is made. I want to be able to display a descriptive banner that will be unique for each value of X as I step through each timer sequence. The problem I have found is that I get "ERROR - line is too long" if I load from MMEdit with more than about 16 elements. I can abbreviate the banners to make it fit but longer, more descriptive banners are better. Is there a way of splitting this over several lines? I'm running V5.3B

DIM Series(X) AS STRING = ("BANNER_0", "BANNER_1", "BANNER_2", ....) ' Could be up to 20 elements
 
disco4now

Guru

Joined: 18/12/2014
Location: Australia
Posts: 844
Posted: 11:30pm 27 Feb 2017
Copy link to clipboard 
Print this post

Try this. Dimension the array but load the values individually.


DIM Series(X) AS STRING
Series(0)="BANNER_0"
Series(1)="BANNER_1"
etc

Regards
Gerry
Latest F4 Latest H7
 
ion507
Newbie

Joined: 05/12/2014
Location: Australia
Posts: 14
Posted: 11:45pm 27 Feb 2017
Copy link to clipboard 
Print this post

At the moment X will be between 8 and 14. I did think of trying of trying to load half and half (the first 8 then the remaining elements on another line) but I can see that this won't work. I will have a look at data statements to see if I can use them in a FOR - NEXT loop.

Cheers
 
WhiteWizzard
Guru

Joined: 05/04/2013
Location: United Kingdom
Posts: 2794
Posted: 12:50am 28 Feb 2017
Copy link to clipboard 
Print this post

Gerry has coded the same 'outcome. as your OP, but you just need to use different index values. Unless there is other unknown information, this will overcome your issue.

DIM Series(X) AS STRING
Series(8)="BANNER_0"
Series(9)="BANNER_1"
etc


WWEdited by WhiteWizzard 2017-03-01
For everything Micromite visit micromite.org

Direct Email: whitewizzard@micromite.o
 
ion507
Newbie

Joined: 05/12/2014
Location: Australia
Posts: 14
Posted: 01:33am 28 Feb 2017
Copy link to clipboard 
Print this post

Data statements didn't work as I expected so I will work with WW's solution to enter the elements of my Series() array. Thanks for your help.
 
robert.rozee
Guru

Joined: 31/12/2012
Location: New Zealand
Posts: 2289
Posted: 02:19am 28 Feb 2017
Copy link to clipboard 
Print this post

  ion507 said   Data statements didn't work as I expected so I will work with WW's solution to enter the elements of my Series() array. Thanks for your help.


you tried something like the below?

X=6
Dim S$(X) length 32

Data "first label", "second label", "this is the third"
Data "fourth one here", "number five is alive", "last label in list"

For I=1 To X
Read S$(I)
Next I


For I=1 To X
Print S$(I)
Next I

Print
Memory

End

> run
first label
second label
this is the third
fourth one here
number five is alive
last label in list

Flash:
1K ( 1%) Program (38 lines)
59K (99%) Free

RAM:
1K ( 1%) 3 Variables
0K ( 0%) General
49K (99%) Free
>


when defining arrays of strings it is wise to specify the maximum length of the strings in order to avoid chewing through all your free RAM. without specifying the maximum length, each string will default to consuming 255 bytes (plus overheads). so a 100 element array of strings will take up some 25k or RAM. with the maximum string length set to 16, this comes down to 1.6k or thereabouts.

note: there does seem to be something odd in the way arrays of strings are dimensioned. dim A$(6) as STRING LENGTH 32 seems to ignore the length specified (instead using the default of 255), and the "$" sign at the end is not mandatory.


cheers,
rob :-)Edited by robert.rozee 2017-03-01
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024