Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

SEARCH feature is gone? Scrolling on an 8 x 8 matrix

Status
Not open for further replies.
This project is not for the Knights of Columbus per say. The state convention is approaching and only two of the 20 units I am building are going to be borrowed.
As for the Anti gay, I agree with you. That's why I am no longer involved with the Boy Scouts. I myself have several friends that are gay. I figure we are all made in Gods image regardless of sex, race or religion.
Going to review post 17, 18 again but I think I have tried almost everything. Can get leds to scroll across but can't get more than one row as the remaining leds(remaining parts of the letter) are missing.
 
This simple character set editor from from geocities.com/g13685/DMX_973_973B.html creates the data arrays for each character in the format I outlined in post 17. Data is by column, starting from the top. A constant array should be created for every character to be used.

Next, dimension a data array with enough bytes to hold all the characters of your message and add the character data to this array. This is the last time you use the constant data.

Now, display the first 8 bytes of the data array, continuously multiplexing the first 8 bytes. After the first 8 bytes have been displayed for the desired time, increment one byte in the array and display 8 bytes for the desired time. Increment. Display. Wait. Repeat.

8x8 matrix character set editor.jpg
 
THANKS that will aid in generating the CONST arrays.
I took a revisit to my code in post #29 https://www.electro-tech-online.com...on-an-8-x-8-matrix.139965/page-2#post-1169064 and after turning the letter right side up and scrolling from right to left . Looking at this code it basically does what you in post 22 https://www.electro-tech-online.com...on-an-8-x-8-matrix.139965/page-2#post-1168843. Slowed the scrolling down and it looks pretty good.
Problem now is changing the variable names.
Using a sub route I am needing to rename the different CONST array names but keep getting compiler errors.
Code:
SUB a1_data()
  FOR index = 0 TO bound(anodes_data)
     Anodes_data(index)= A_Data(index)
  NEXT     '0
    
END SUB
The sub route is a1_data. Need to change Anodes_data(x) to A_Data(x)
Had the Anodes_data(8) in a CONST array but realized the CONST array data can't be changed so I took out the CONST array Anodes_data so hopefully I can just rename Anodes_data(x) to what ever CONST array name I want to call it.
 
Why do I get the feeling that no amount of explanation or elaboration will make you understand this? I think four times is my limit.

You're on your own.
 
Well I got the multiplexing as in your suggestion post 22 https://www.electro-tech-online.com...on-an-8-x-8-matrix.139965/page-2#post-1168843
Now to figure out how to get it to scroll.
I have code that scrolls but really no multiplexing to conserve battery power.
In this posted code I have a short version and a long version that shows what the short version is doing. This is what I interrupt your suggestion in post #22

Code:
{
*****************************************************************************
*  Name    : UNTITLED.BAS                                                   *
*  Author  : [select VIEW...EDITOR OPTIONS]                                 *
*  Notice  : Copyright (c) 2014 [select VIEW...EDITOR OPTIONS]              *
*          : All Rights Reserved                                            *
*  Date    : 2/22/2014                                                      *
*  Version : 1.0                                                            *
*  Notes   : LONG and SHORT of multi plexing                                                               *
*          :                                                                *
*****************************************************************************
}
DEVICE = 18F2420

CLOCK = 8
 

// import LCD library...

'INCLUDE "convert.bas"
INCLUDE "InternalOscillator.bas"
INCLUDE "Utils.bas"       // Include this file when we compile so that we can use keywords like 'setalldigital'
'INCLUDE "shift.bas"
INCLUDE "SUART.bas"
// Arrays

INCLUDE "convert.bas"
INCLUDE "convert.bas" 
CONST A_Data(9)AS BYTE =(%00000000,        // K
                         %01000100,
                         %01001000,
                         %01010000,
                         %01100000,
                         %01010000,
                         %01001000,
                         %01000100,
                         %00000000)
                     
CONST Cathodes_Data(9)AS BYTE = (%01111111,       ' KEEP THESE AS THEY DON"T CHANGE PER LETTER
                                 %10111111,
                                 %11011111,
                                 %11101111,
                                 %11110111,
                                 %11111011,
                                 %11111101,
                                 %11111110,
                                 %11111111)
{                       
SUB Assign(BYREFCONST array() AS BYTE)
   DIM index AS BYTE
   DIM Anodes_Data(9) AS BYTE
   Anodes_Data = array
   FOR index = 0 TO BOUND(Anodes_Data)
      'USART.Write("Value = %", BinToStr(Anodes_Data(index), 8),13,10)
   NEXT
END SUB
}                      
' program start...

' dim cathodes_data(9) as byte
DIM Anodes_data(9) AS BYTE
DIM index AS BYTE
'DIM Anodes_data(9) AS BYTE
DIM y AS BYTE
DIM x AS BYTE
             
// Sub Routines
'USART.SetBaudrate(br9600)     
SetTX(PORTC.6)
SetRX(PORTC.7)
SetBaudrate(sbr9600)
SetMode(umTrue)
UART.SetTX(PORTB.7) ' matches the PICkit 2 UART tool input pin when connected to the ICSP connector           

// Start Of Program
'portc = 0
'portb = 1
SetAllDigital                       // Make all Pins digital I/O's
TRISC = %00000000                   // Make PORTD all outputs
TRISB = %00000000                   // Make PORTB all outputs
y = 0
// Main Loop
WHILE True()
 

     anodes_data =  A_Data
    '  SHORT VERSION
    FOR x = 0 TO 7
   ' FOR index = 0 TO 64 STEP 8
        portc = Anodes_data(x)          'LOAD Anodes data
        portb = Cathodes_Data(x)        'TURN ON CATHODES
    DELAYMS(1)
        portc = Anodes_data(8)          'turn off Anodes data
         NEXT 
      ' portc = %00000000       ' eliminate ghosting
wend  
{
'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
'LONG VERSION   
        portc = Anodes_data(0)          'LOAD Anodes data COLUM 1
        portb = Cathodes_Data(0)        'TURN ON CATHODES COLUM 1
      ' DELAYMS(5)
        portc = Anodes_data(8)          'turn off Anodes data COLUM 1
        portc = Anodes_data(1)          'LOAD Anodes data COLUM 2
        portb = Cathodes_Data(1)        'TURN ON CATHODES COLUM 2
        delayms(10)
         portc = Anodes_data(8)          'turn off Anodes data COLUM 2
        portc = Anodes_data(2)          'LOAD Anodes data COLUM 3
        portb = Cathodes_Data(2)        'TURN ON CATHODES COLUM 3
        delayms(10)
        portc = Anodes_data(8)          'turn off Anodes data COLUM 3
        portc = Anodes_data(3)          'LOAD Anodes data COLUM 4
        portb = Cathodes_Data(3)        'TURN ON CATHODES COLUM 4
        delayms(10)
        portc = Anodes_data(8)          'turn off Anodes data COLUM 4
        portc = Anodes_data(4)          'LOAD Anodes data COLUM 5
        portb = Cathodes_Data(4)        'TURN ON CATHODES COLUM 5
        delayms(10)
        portc = Anodes_data(8)          'turn off Anodes data COLUM 5
        portc = Anodes_data(5)          'LOAD Anodes data COLUM 6
        portb = Cathodes_Data(5)        'TURN ON CATHODES COLUM 6
        delayms(10)
        portc = Anodes_data(8)          'turn off Anodes data COLUM 6
        portc = Anodes_data(6)          'LOAD Anodes data COLUM 7
        portb = Cathodes_Data(6)        'TURN ON CATHODES COLUM 7
        delayms(10)
        portc = Anodes_data(8)          'turn off Anodes data COLUM 1
        portc = Anodes_data(7)          'LOAD Anodes data COLUM 2
        portb = Cathodes_Data(7)        'TURN ON CATHODES COLUM 2
        delayms(10)
      
        
    ' UART.Write("x =", binToStr(A_Data(x),13,10))
        ' portc = %00000000
//44444444444444444444444444444444444444 
  
  
 
WEND                  // Loop back to the while loop as long as we havent finished.
 
MrDEB, why don't you look at post 24...it references a tutorial on multiplexing a four digit LED display. Yes, I realize you want to multiplex an 8x8 matrix, but prehaps multiplexing an 8x8 matrix is similar to multiplexing a four digit LED display. Maybe you'll find the multiplexing a four digit LED display is similar to multiplexing an 8x8 matrix. *shrug* maybe multiplexing isn't the same as multiplexing but maybe you could learn something about multiplexing.

Now, saying your code is EXACTLY what I've been suggesting is a little hard to fathom. I have suggested a number of times the you built the font (i.e., the characters) as constant arrays (and even posted a link to a tool to help you do that) AND THEN build the message characters into a VARIABLE ARRAY containing the entire message. Since your code doesn't even dimension a character array, I don't have to struggle with trying to understand what the hell you are doing to know it has nothing to do with what I suggested.

Time for you to throw in the towel on this one I should think.
 
I like the idea of using a variable array then use the CONST arrays to fill in the variable array information.
Going to take a break and revisit post 16 and 18 as well as post 24. I started revamping the 7seg ,bas to fit the 18F2420 and get a better idea of where I went wrong on the multiplexing.
I was pretty sure this did the multiplexing but ?
Code:
    anodes_data =  A_Data
    '  SHORT VERSION
    FOR x = 0 TO 7
   ' FOR index = 0 TO 64 STEP 8
        portc = Anodes_data(x)          'LOAD Anodes data
        portb = Cathodes_Data(x)        'TURN ON CATHODES
    DELAYMS(1)
        portc = Anodes_data(8)          'turn off Anodes data
         NEXT
      ' portc = %00000000       ' eliminate ghosting
 
Oh MrDEB, you are amazing.

renaming a CONST array name

From David Barker, the developer of Swordfish:

Toyman - re-posting working code that I have already posted is of no use whatsoever. A specific request was made for you to post your code and we would try and help. I do not want this or any other thread on the Swordfish forum to degenerate like threads I have seen on other forums. I would respectfully ask all other users to only make a contribution if it will help this thread move closer to a solution. If invalid, inappropriate or just useless snippets of code are posted by the starter of this thread, then please refrain from posting any sort of reply at all, allowing us all to move on to more productive tasks...


scolling letters as your Merry Christmas

Somebody needs to code this for him....
 
I have tried lots of different methods to try and acomplish this.
Revisited your post about how this is done by scanning the cathodes or anodes etc. I tried both.
I tried loading one byte from the CONST arrays then cycle through the 8 bits then jump to the next byte. didn't work.
Looks like my clunky code I posted is what I am stuck with. At least it works.
 
In the quest to make the great code to show a word on a 8x8 led board. You have 16 pins you turn on one of each to flash a led then the next led till you made a letter show up want it to move easy you shift the rows
 
I tried that Burt but I lose the trailing edge of the letters. I tried several bits of code.
Let me get back to you, my wife is needing my assistance and be back in a few minutes.
 
First off you get one letter to light up like you want it say O you get it to show up clearly made sure your code blanks the port on the shift and then just shift it off to the right or the left it's that easy
 
Here is my latest code I have been trying but It is no way close.
Code:
{
*****************************************************************************
*  Name    : testing routine.BAS                                                   *
*  Author  : [select VIEW...EDITOR OPTIONS]                                 *
*  Notice  : Copyright (c) 2014 [select VIEW...EDITOR OPTIONS]              *
*          : All Rights Reserved                                            *
*  Date    : 2/4/2014                                                       *
*  Version : 1.0                                                            *
*  Notes   : letter testing routine                                                               *
*          :                                                                *
*****************************************************************************
}
DEVICE = 18F2420

CLOCK = 8
   

// import LCD library...

INCLUDE "convert.bas"
INCLUDE "InternalOscillator.bas"
INCLUDE "Utils.bas"       // Include this file when we compile so that we can use keywords like 'setalldigital'
INCLUDE "shift.bas"

// Arrays                                                                                  
// Arrays
                                                                                 
CONST CAT_Data(8)AS BYTE =     (%11111110,  ' top to bottom bit 7 = left
                                %11111101,                            
                                %11111011,
                                %11110111,
                                %11101111,
                                %11011111,
                                %10111111,
                                %01111111)
                              
CONST B_Data(8)AS BYTE =       (%01111111,    'top left
                                %10111111,
                                %11011111,     'cathodes
                                %11101111,
                                %11110111,
                                %11111011,
                                %11111101,
                                %11111110)    'bottom right

CONST ARRAYB (8) AS BYTE=      (%10000000,       'left to right bit 7 = left
                                %10000000,
                                %10000000,
                                %10000000,    
                                %10000000,       'anodes
                                %00000100,
                                %00000010,
                                %00000001)
                               
CONST T_Data(9)AS BYTE =         (%11111111,         // T
                                  %00010000,                              
                                  %00010000,
                                  %00010000,
                                  %00010000,
                                  %00000000,
                                  %00000000,
                                  %00000000,
                                  %00000000)
                                 
CONST Tc_Data(9)AS BYTE =        (%00000000,         // T
                                  %11101111,                              
                                  %11101111,
                                  %11101111,
                                  %11101111,
                                  %00000000,
                                  %00000000,
                                  %00000000,
                                  %00000000)                                  
                                 
{                    
SUB Display(BYREFCONST array() AS BYTE)
   DIM index AS BYTE
   FOR index = 0 TO BOUND(array)
 
      portc = ARRAYA (index)
   NEXT
END SUB
                     
                     
                     
  }                                             
                                      
                                                     
                             
// variable declaration                              
DIM x AS BYTE
DIM y AS BYTE
DIM index AS BYTE
DIM indexb AS BYTE
DIM bits AS BYTE
DIM C(64) AS BYTE
DIM b(64) AS BYTE
                    
// Sub Routines

              
y = 0
// Start Of Program
'portc = 0
'portb = 1
SetAllDigital                       // Make all Pins digital I/O's
TRISC = %00000000                   // Make PORTD all outputs
TRISB = %00000000                   // Make PORTB all outputs
'index = 7
// Main Loop
WHILE True()
     
    FOR index = 0 TO 7  ' anodes byte
      FOR x = 0 TO 7      ' anodes bit
          portc =T_Data(index).bits (x)  ' index changes the CONST array byte. The bits(x) turns each LED on /off in the byte that index has.
          portb =CAT_Data(x)         ' This scans the cathodes
         
      
          DELAYMS(500)        ' have it slowed down to SEE what is actually going on.
        
      NEXT
    NEXT  
   
      
      
WEND                  // Loop back to the while loop as long as we havent finished.
 
The whole idea you have there is wrong! Your make a array to hold your port data two bytes wide and do the for next to load and loop to show the letter based on loop count you shift right left up or down
 
If I understand you correctly, load two bits instead of just one byte? Is it an impossible idea to load the entire byte, Brad suggested making the letters only 5 bits wide and connect them all together so the alphabet would be 130 bits wide. Then insert spaces as needed. This would use less ram space.
Have seen really long CONST array LONGWORDS.
Going to research this after I redo the alphabet to 5 bits wide per letter instead of 8 bits wide.
 
5 don't add up to 8/8 I don't see that saving anything lol but maybe it's something I don't see but the pic is 8 bits so you'd waste 3 bits
You have to set two ports so I'd figure it as a word add load both ports at time till you see a nice letter then shiff the rows
He is saying make the letter 5 bits wide it's still a byte
 
Good point, the extra three bits are wasted but Still contemplating how to get tis scrolling from a better code. The code I posted works pretty well seeing how I wrote it but in the interest of learning to write better code I want to streamline it.
You referred to shifting the two bytes, are you suggesting using the shift.bas?. I was under the impression that's for shift registers??
Couldn't do anything with this yesterday as I was cooking a benefit breakfast with the Knights of Columbus, a family here in town lost their home to a fire.
 
Here is a short video of what I have so far using the code I posted. The letters need lots of work as does the smoothing out of the scrolling.

Am looking over lots of other codes but most are using shift registers or just duplicating each byte but shifting one bit to do so the scroll. This would entail 64 bytes per port or 512 bytes per letter.
th_Video10_zps1d34b69b.jpg
 
I would recommend watching that frame by frame ;), stick it into some video editing software. It will show you whats wrong
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top