![]() |
Forum Index : Microcontroller and PC projects : 8x8 Matrix LED Display Fun
![]() ![]() |
|||||
Author | Message | ||||
lizby Guru ![]() Joined: 17/05/2016 Location: United StatesPosts: 3299 |
In that "For i = 1 To 6" loop, after the read, put "print i; " "; govenor(i)". I'm uncertain where the DATA settings are that the READ is acting upon. PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed |
||||
Turbo46![]() Guru ![]() Joined: 24/12/2017 Location: AustraliaPosts: 1636 |
Canada_Cold, The govener array is DIMed with a size of 6: Dim chars(900), digi(8), clkcol(8,2), ASCIIptr(150,2), govenor(6) And there are 6 numbers read into it: For i = 1 To 6 Read govenor(i) Next i Data 19, 16, 12, 8, 4, 0 But dc (the index into it) can be set higher than 6: dc = 0 For i = 1 To 8 If Mid$(msg$, i,1) <> Mid$(oldtime$,i,1) Then ' what digit changed? digi(i) = 1 dc = dc + 1 Else digi(i) = 0 'reset back to 0 Endif Next i I would change the DIM of govenor to 8: Dim chars(900), digi(8), clkcol(8,2), ASCIIptr(150,2), govenor(8) And add 2 more entries for its data: For i = 1 To 8 Read govenor(i) Next i Data 19, 16, 12, 8, 4, 0, 0, 0 I think that should fix it. Keep warm. Bill Keep safe. Live long and prosper. |
||||
TassyJim![]() Guru ![]() Joined: 07/08/2011 Location: AustraliaPosts: 6213 |
A simple debug test would be to PRINT dc in a line before the error line. Using OPTION BASE only sets the start of the array. The maximum remains the same with OPTION BASE 1 and OPTION BASE 0 Jim VK7JH MMedit |
||||
Canada_Cold Regular Member ![]() Joined: 11/01/2020 Location: CanadaPosts: 41 |
Hi Bill (turbo46), Thanks, That worked! I’m not understanding why as yet, but that’s all part of the learning curve. Have a great day, thanks, Don |
||||
Turbo46![]() Guru ![]() Joined: 24/12/2017 Location: AustraliaPosts: 1636 |
An array is a collection of variables or data values. They must be of the same type: integer, floating point numbers or strings. DIM govenor(6) Creates an array with 6 different entries, govenor(1), govenor(2) through to govenor(6). They default to floating point numbers because the program does not specify otherwise (eg. AS INTEGER). If you do not use the command: OPTION BASE 1 there is also a govenor(0) entry which is often ignored – as it is in this program. In the program a variable dc is used as an index into that array. dc=1 PRINT govenor(dc) will print the first entry in that array. The trouble is that dc is being set to values higher than 6 and so the programs is trying to read values in the array that do not exist and that is why you are getting the ‘index out of bounds’ error. I just suggested that you add two more elements to that array to avoid the error. I hope that helps. Bill Keep safe. Live long and prosper. |
||||
Justplayin![]() Guru ![]() Joined: 31/01/2014 Location: United StatesPosts: 326 |
Okay, I setup a test rig and verified the code posted in this forum doesn't work. The setup for the variable oldtime$ is missing spaces. I think the forum must have reformatted the variable. In MAIN change: oldtime$ = " : : " 'non scrolling part of the clock display to: oldtime$ = "HH:MM:SS" 'non scrolling part of the clock display The array size of 6 is correct since the maximum number of digits which can change is 6. Even though the time displayed can be up to 8 characters long, the colons will never change. --Curtis I am not a Mad Scientist... It makes me happy inventing new ways to take over the world!! |
||||
Turbo46![]() Guru ![]() Joined: 24/12/2017 Location: AustraliaPosts: 1636 |
In that case, the sub Show_Time must be changed. The variable dc can become greater than 6 and that is causing the 'index out of bounds' error. Sub Show_Time Local i, j, k, m, dc 'do not make k, m Local here dc = 0 For i = 1 To 8 If Mid$(msg$, i,1) <> Mid$(oldtime$,i,1) Then ' what digit changed? digi(i) = 1 dc = dc + 1 Else digi(i) = 0 'reset back to 0 Endif Next i Great program. Thanks for sharing it. Bill Keep safe. Live long and prosper. |
||||
Canada_Cold Regular Member ![]() Joined: 11/01/2020 Location: CanadaPosts: 41 |
Hi All, Thanks so much for all your input, I really appreciate all the debugging tips and the detailed explanation from Bill. That's a great help for me in the understanding of the programming on the Mocromite. I agree, It's a great program, I have it working on a green dot-matrix display on my workbench and it is very cool, thanks again to Curtis for posting it. Don |
||||
CaptainBoing![]() Guru ![]() Joined: 07/09/2016 Location: United KingdomPosts: 2137 |
Cheers Curtis. I needed a clock for my workshop but I couldn't find anything I liked. Was bored yesterday and so I knocked up one on a mite using your code (and the proportional font!) as the basis. Have to say i got rid of the digit change animation... bit distracting. Credited you in the boot here . Big Thanks h |
||||
Justplayin![]() Guru ![]() Joined: 31/01/2014 Location: United StatesPosts: 326 |
Glad to know you found the clock code useful and thanks for the boot credit. ![]() --Curtis I am not a Mad Scientist... It makes me happy inventing new ways to take over the world!! |
||||
![]() ![]() |
![]() |
![]() |
The Back Shed's forum code is written, and hosted, in Australia. | © JAQ Software 2025 |