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 : Problem using ERASE in Command mode
Author | Message | ||||
flip Senior Member Joined: 18/07/2016 Location: AustraliaPosts: 114 |
Hi all, Hope someone can help again I'm having trouble with ERASE. See following snippet of commands. > q%=5 > dim gg(q%) as float > for i= 0 to 5:gg(i)=i:next i > for i= 0 to 5:? gg(i):next i 0 1 2 3 4 5 > erase gg Error: Cannot find GG > ? gg(3) 3 > erase gg() Error: Cannot find GG() Is this something to do with the limited command environment? Regards Phil |
||||
Grogster Admin Group Joined: 31/12/2012 Location: New ZealandPosts: 9066 |
Probably. Put the exact same code in the editor, save that, and then RUN the code. When it stops at the command prompt, THEN type erase gg and see what happens. It is possible you have found a wee bug or something - who knows. I will have to find a MM and try this out myself now. Smoke makes things work. When the smoke gets out, it stops! |
||||
BobD Guru Joined: 07/12/2011 Location: AustraliaPosts: 935 |
The command refers to array variables not arrays. It looks to me that you have to specify every array variable that you wish to delete. GG is a non arrayed variable and GG() is invalid (I think). |
||||
flip Senior Member Joined: 18/07/2016 Location: AustraliaPosts: 114 |
Thanks for the quick responses !! I tried q%=5 so I could either clear or not, but still got failuredim gg(q%) as float For i= 0 to 5:gg(i)=i:next i for i= 0 to 5:? gg(i):next i if s=0 then clear gg Result on running above program (and manual) MMEDIT session: > run So it may be a bug...(ver as above)0 1 2 3 4 5 [5] If s=0 Then Clear gg Error: Unexpected text: gg > ? gg(3) 3 > clear gg Error: Unexpected text: gg > clear gg() Error: Unexpected text: gg() > clear gg(3) Error: Unexpected text: gg(3) > ? mm.device$;" ";mm.ver Micromite MkII 5.0404 |
||||
BobD Guru Joined: 07/12/2011 Location: AustraliaPosts: 935 |
Phil as your results and the manual show, CLEAR does not need parameters as it deletes all variables. The way I read it, if you wish to delete specific variables then you have to specify each one. ERASE gg(0), gg(1) etc. Bob |
||||
flip Senior Member Joined: 18/07/2016 Location: AustraliaPosts: 114 |
Thanks Bob, I got myself confused with CLEAR and ERASE...there seems to be no problem with CLEAR but I still can't make ERASE work >> list Clear q%=5 Dim gg(q%) As float For i= 0 To 5:gg(i)=i:Next i For i= 0 To 5:Print gg(i):Next i Erase gg q%=q%+1 Dim gg(q%) As float > run 0 1 2 3 4 5 [6] Erase gg Error: Cannot find GG > > Unfortunately when I tried ERASEing individual elements in the array gave same message. The way I read it though the entire array gets ERASEd. I deleted library as well in case that was causing a problem but no joy...maybe next I'll try re-flashing the chip. Thanks again for your help. Regards, Phil |
||||
flip Senior Member Joined: 18/07/2016 Location: AustraliaPosts: 114 |
Found the bug! array declared as type unable to be erased... see following... > dim ssss%(23) > erase ssss% > dim wwww(5) as float > erase wwww Error: Cannot find WWWW > Edit: Workaround really easy...use type-declaration character (or default). Geoff if you read this in my opinion this is very low priority... Regards, Phil |
||||
Geoffg Guru Joined: 06/06/2011 Location: AustraliaPosts: 3165 |
Thanks for the great detective work Phil, I have fixed it in the recently released V5.04.05 which also fixed a couple of other annoying niggles. Geoff Geoff Graham - http://geoffg.net |
||||
Print this page |