Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 22:15 03 May 2025 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 : 8x8 Matrix LED Display Fun

     Page 3 of 3    
Author Message
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3299
Posted: 09:40pm 07 May 2020
Copy link to clipboard 
Print this post

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: Australia
Posts: 1636
Posted: 09:46pm 07 May 2020
Copy link to clipboard 
Print this post

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: Australia
Posts: 6213
Posted: 10:06pm 07 May 2020
Copy link to clipboard 
Print this post

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: Canada
Posts: 41
Posted: 10:40pm 07 May 2020
Copy link to clipboard 
Print this post

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: Australia
Posts: 1636
Posted: 11:40pm 07 May 2020
Copy link to clipboard 
Print this post

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 States
Posts: 326
Posted: 02:44am 08 May 2020
Copy link to clipboard 
Print this post

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: Australia
Posts: 1636
Posted: 03:15am 08 May 2020
Copy link to clipboard 
Print this post

  Justplayin said  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.


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: Canada
Posts: 41
Posted: 04:03pm 10 May 2020
Copy link to clipboard 
Print this post

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 Kingdom
Posts: 2137
Posted: 07:59am 08 Jun 2020
Copy link to clipboard 
Print this post

  Justplayin said  I have been playing around with some 8x8 matrix LEDs with MAX7219 driver boards and thought I would share some of the code.


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 States
Posts: 326
Posted: 04:04am 09 Jun 2020
Copy link to clipboard 
Print this post

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!!
 
     Page 3 of 3    
Print this page


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

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025