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: AustraliaPosts: 14 |
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: AustraliaPosts: 844 |
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: AustraliaPosts: 14 |
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 KingdomPosts: 2794 |
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 WW For everything Micromite visit micromite.org Direct Email: whitewizzard@micromite.o |
||||
ion507 Newbie Joined: 05/12/2014 Location: AustraliaPosts: 14 |
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 ZealandPosts: 2289 |
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 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 :-) |
||||
Print this page |