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.
I know it's not right but it does work.
I am going to reduce the letter size and look at several options using Swordfish. It was suggested to use a buffer (thinking the EEprom) but want to investigate what BYREF is exactly. Using short bits of code to see just what it does. Have seen this used in other moving matrix codes.
I am learning and experimenting as I go as well as using ALL the suggestions that come this way.
I have a sample piece of code in C+ that I am trying to decipher. Also discovered the >> which is ??? but experimenting with it I found it might be of use as I have seen in similar coding as well.
 
Geez oh grief.

"Buffer" is exactly what I explained to you a hundred posts ago. It's an array where you store the entire message so that it can be scrolled.

Rather than "looking at several different codes" it might work well for you to do whatever it takes to understand what people have explained to you.

Here's a thought question for you:

A scrolling message would scroll letters across the LED matrix with perhaps one blank column between them. Correct? How can the possibly occur if you're only working on one character at a time? If one character scrolls completely off the matrix before the next appears, what's it going to look like? "Crap" would be the most socially acceptable term. I can think of a number of more accurate but less acceptable terms.

You might also edit your post with the video. Anyone with epilepsy should probably not view it. For that matter, anyone with a queasy stomach should also be warned.
 
I need some direction as I have not found much info on using a buffer. Am thinking that the EEPROM can be used??
I am drowning trying to find a solution. Will do more research for buffer.
 
Geez oh grief.

"Buffer" is exactly what I explained to you a hundred posts ago. It's an array where you store the entire message so that it can be scrolled.

Referring back to messages 17 & 18 about 100 posts ago.....not that this will help....

scrolling idiots.jpg
 
Am thinking that the EEPROM can be used??
Sure. Why not? We're only four pages into this saga, so it's definitely time to start throwing some more randomly selected terms into the mix.

How about a CONST BYREF EEPROM buffer? THAT should fix you right up.
 
I found an application that looks like it will work.
I was under the impression that the BUFFER was either additional chip or utilizing the EEPROM in the pic.
Looking over Brads code I can see where I went astray. I am lost or was until I found this link. As far as number of pages, yes but not having schooling in coding, the code I have working is an accomplishment in my book and reviewing Post 17, my method to achieve scrolling accomplishes the same basic principal but the long way around.
Brads Electronic Projects Forum • View topic - Electronic Dice for the SPB
 
... As far as number of pages, yes but not having schooling in coding, the code I have working is an accomplishment in my book and reviewing Post 17, my method to achieve scrolling accomplishes the same basic principal but the long way around...

No, no, no it does not. Read the fifth paragraph of post #62 above.

Scrolling one letter off into the sunset before starting the next isn't scrolling a message across the matrix display. You must start the following letter one column from the end of the last letter....not after the first letter vanishes.

You have accomplished a great thing in you video – the ability to induce vomiting. Beyond that, not so much.
 
I realize my video is basic crap and I realize I need to have a single space between letters.
Have been looking at Brads code which does exactly what you are stating so using bits of it as an example, realizing that Brads code utilizes shift registers, I am redoing my CONST arrays all in one as Brad has done. He then stuffs the data into a buffer then outputs that data. Trying to decipher why the data can't be displayed directly from the CONST array but going with the buffer and one long CONST array with one space between letters. Looking at 206 bytes plus bytes for the spaces.
 
?..Trying to decipher why the data can't be displayed directly from the CONST array.....


Do you think I draw these pictures for my own benefit? Do you think I've tried to explain this several times because I like to type?

If you have each character in a constant array that's 8 bytes wide (i.e., 8 columns wide) and you can work with only one at a time, how can you possibly have half of one character and half of the next on the matrix at a time?. What magic elves are you expecting to merge them in your code?

Look at the illustrations I've posted and engage your mind at the same time. Everything you need is right there.

Of course, you need to understand that you can set a variable (be it a single value or an array) to equal a constant. This point seems lost on you. As does any effort to explain it.
 
Am putting together a short code with a buffer. I wonder if Brad is using a buffer when he joins all the letters together in one CONST array. Am going to try using a buffer as you suggested as it makes sense as I need more than one letter displayed at a time.
I got lost with the DICE GAME code I linked but the code has the general idea of what your saying.
As for setting a variable (be it a single value or an array) to equal a constant, I already crossed that path using a CASE SELECT.
 
Making a little progress. This code is scrolling but not the Sentence_Data in the CONST array.
It is displaying 5 lines as it is supposed to and the lines scroll (blink from right to left)
Need to figure out why the CONST array Sentence_Data is not loading? Thinking its not loading into the buffer correctly??
Code:
{
*****************************************************************************
*  Name    : UNTITLED.BAS                                                   *
*  Author  : [select VIEW...EDITOR OPTIONS]                                 *
*  Notice  : Copyright (c) 2014 [select VIEW...EDITOR OPTIONS]              *
*          : All Rights Reserved                                            *
*  Date    : 3/4/2014                                                       *
*  Version : 1.0                                                            *
*  Notes   :                                                                *
*          :                                                                *
*****************************************************************************
}
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 "SUART.bas"
// Arrays                                                                                  
// Arrays
                                                                                 
// Arrays
        
// Desired sentence  (ANODES)
CONST Sentence_Data(96) AS BYTE =    (%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%01111110,%01001010,%01001010,%01000010,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%01111110,%01000010,%01000010,%01000010,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00111100,%01000010,%01000010,%00111100,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%01111110,%01000010,%01000010,%01000010,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%01111110,%01000010,%01000010,%01000010,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000,%00000000)


// CATHODES
CONST Row1Data(8) AS BYTE =    (%11111110,%11111101,%11111011,%11110111,%11101111,%11011111,%10111111,%01111111)


DIM Display_Buffer(8) AS BYTE
DIM Data_Display AS BYTE
DIM Colum_start AS portc
DIM Cathode_Data AS portb
DIM x AS BYTE
DIM y AS BYTE
DIM Speed AS BYTE

//SUB ROUTINES
      SUB Draw_Data()
          FOR x = Colum_start TO (Colum_start+7)   ' COLUMS ON PORT C
           Data_Display= Sentence_Data(x)
           Data_Display = Display_Buffer(x)          ' LOAD BUFFER WITH "Sentence_Data" CONST array
           Cathode_Data = 0
           Cathode_Data.bits(7 - (x- Colum_start)) = 1  ' cycle the cathodes from 0 to 7
           'SetBaudrate(sbr9600)
           'UART.Write("Value = %", BinToStr(Display_Buffer(x) ,40),13,10)
           delayms(100)
           NEXT
      END SUB
     
SUB Scroll_Text()
    IF Speed <> 0 THEN
    DEC(Speed)
    ELSE
        Speed = 6
        Colum_start = Colum_start + 1
        IF Colum_start + 8 = 96 THEN     ' # of elements in CONST array
           Colum_start = 0
           END IF
        END IF
    END SUB
'SetTX(PORTC.6)
'SetRX(PORTC.7)
'SetBaudrate(sbr9600)
'SetMode(umTrue)        

SetAllDigital                       // Make all Pins digital I/O's
TRISC = %00000000                   // Make PORTD all outputs
TRISB = %00000000                   // Make PORTB all outputs
y = 0
Speed = 50
Colum_start = 0

WHILE true
    Draw_Data()
   
    Scroll_Text()
WEND
 
The logic of your scroll_text subroutine is beyond my ability to comprehend.

Can you explain step-by-step, line-by-line what you're trying to accomplish here? "Scrolling text" won't cut it. Explain in detail what you think it's doing and maybe someone can help you.
 
Making a little progress
That's debatable

There is no way this is correct:
Code:
DIM Data_Display AS BYTE
DIM Colum_start AS portc
Colum_start is declared as PORTC, but it's used as a variable.
Your anode driver output port is going to be jibberish.


The Draw_Data() subroutine doesn't make any sense...
Code:
SUB Draw_Data()
   FOR x = Colum_start TO (Colum_start+7)  ' COLUMS ON PORT C
     Data_Display= Sentence_Data(x)
     Data_Display = Display_Buffer(x)  ' LOAD BUFFER WITH "Sentence_Data" CONST array
     Cathode_Data = 0
     Cathode_Data.bits(7 - (x- Colum_start)) = 1  ' cycle the cathodes from 0 to 7
  delayms(100)
  NEXT
END SUB
Your Sentence_Data never goes anywhere except for the variable Data_Display which gets clobbered on the next line,
Display_Buffer is never set to anything, your index for the Display_Buffer array is completely wrong, your cathode data output
is now active high where it was active low before (but it probably matches the hardware change you made and never mentioned),
and it takes 800ms to scan a single character.

Whatever you copied this from you goofed it up completely.
 
I have to agree with both of you that I misinterpreted the code from http://www.bradsprojects.com/forum/viewtopic.php?f=31&t=692 But the code linked uses shift registers. I have been making my train wreck worse but am making a little progress.
In the code I posted (my mess) I found several issues that I have since corrected. I discovered what the XOR %11111111 is used for. The original code is using the CONST array data to control the cathodes I think??
What I think is supposed to happen with scrolling is
extract the data from the CONST ARRAY then use that data to control the Anodes (one of two arrays).
Will call it Anodes_Data. To scroll you cycle through the Anode_Data bits while cycling through the Cathode bytes . Each Cathode will enable all 8 LEDs in that row thus scrolling across the matrix. After the 8 bits of the Anodes_Data is complete then it starts on the next 8 bits etc.
The link I posted has some similarity but I am not interpreting it correctly.
Goofed up completely is an understatement.
 
I have always found understanding other's code is difficult, especially when I don't understand the fundamental principles of what it's attempting to do.

At this point, I think you have two options on for this project:

1. Highlight all of your code from beginning to end. Press the [delete] key. Go back to posts #17 & #18, understand what you need to do and start over from scratch.

2. Beg/pay/pester someone to write the code for you.

Taking code not designed to do what you want with hardware you don't have and changing the code you don't understand to do something you don't understand how to do doesn't seem to be working for you. Imagine that.
 
I have always found understanding other's code is difficult, especially when I don't understand the fundamental principles of what it's attempting to do.

At this point, I think you have two options on for this project:

1. Highlight all of your code from beginning to end. Press the [delete] key. Go back to posts #17 & #18, understand what you need to do and start over from scratch.

2. Beg/pay/pester someone to write the code for you.

Taking code not designed to do what you want with hardware you don't have and changing the code you don't understand to do something you don't understand how to do doesn't seem to be working for you. Imagine that.


The last time I mentioned this I got into trouble, but I think its worth saying again.
Your problem isnt the code, not being rude but EVERY TIME you attempt a project you start at the code and work back, you have proven time after time that approach will not work.
CONST this array that, forget it all. Mr Deb you need to plan your projects, you need to fully get what the technique involved is about, I would start with say a 5 dot diagonal line.
Make it slowly APPEAR from the left, then move it to the right, dont aim for a nice speed do it very slowly.
If you think about it a diagonal line will answer most of your questions and tell you why your code dosnt work.
So why diagonal?
Because there is only 1 led lit in each column at a time ;). If you think about it the diagonal line wont appear on the bottom left led to start with ;), think about which square you would first see it. Draw a diagonal line on square paper from top left to bottom right. infact draw each frame on square paper one by one as if the paper were the LED units. It WILL show you exactly what your doing wrong, and exactly how to correct it. You cant code this by trying to keep the image in your head, some can you cant, PROPER PLANNING is the key, fully grasp the technique your trying
 
Already did the straight line as well as the diagonal line across the matrix.
Also have letters scrolling across the matrix BUT it is not very good as it only has one letter per frame. Using this code I posted in #71 which uses shift registers and converting it to run with out shift registers is the issue at this time.
The project is scrolling but doesn't seem to display the letters in the CONST array. And no I have not made any hardware changes, only code changes.
I have a code that is written in C+ but totally Greek to me is why I am not using it.
Code:
#include <pic.h>                // pic specific identifiers
#define _XTAL_FREQ  20000000    // Xtal speed
__CONFIG(0x37F2);                // Config bits

#define ROW_PORT        PORTB            //
#define ROW_TRIS        TRISB
#define COL_PORT        PORTC            //
#define COL_TRIS        TRISC

extern const unsigned char fnt[];   // delclare as external (in another file)

    // Required prototypes
void DelayMs(int x), scroll(char dir), invert(void);
void clear(void), display(const char* str);

    // Variables
unsigned char pos;                // keep tabs on rows
unsigned char leds[8];            // led buffer
unsigned char leds2[8];            // 2nd led buffer
unsigned char pow[] = {1,2,4,8,16,32,64,128}; // power array

void main(void)                            // program entry
    {
    char x,y,z,t;
    ADCON1 = 0x6;
    ROW_TRIS = 0b00000000;                // row port as outputs
    COL_TRIS = 0b00000000;                // col port as outputs
    T2CON = 0x16;                        // setup timer 2
    ROW_PORT = 0;
    COL_PORT = 0xFF;                    // setup led array
    PR2 = 249;                            // timer preload value
    TMR2IE = 1;                            // enable timer 2 interrupt
    PEIE = 1;                            // enable peripheral interrupt
    GIE = 1;                            // enableglobal interrupt
    pos = 0;                            // start at beginning
    while(1)                            // endless Loop
        {
        display("Hello world!!");        // display a message
        clear();                        // start again
        DelayMs(1000);
        }
    }

void display(const char* str)
    {
    int addr;                            // large table (requires an int)
    int z;                                // looping variable
    while(*str!=0)
        {
        addr = ((int)*str++ - 0x20);    // locate character in table
        addr *= 8;                        // 8 bytes in each char
        for(z=0;z<8;z++)
            leds2[z] = fnt[addr+z];        // load em up!!
        for(z=0;z<8;z++)
            scroll(1);                    // scroll right.
        }
    }

void interrupt ISR()
    {
    if(TMR2IF)            // omly do if timeout occured
        {
        ROW_PORT = 0xff;
        COL_PORT = leds[pos];            // Retrive current array
        ROW_PORT -= pow[pos];            // Keep powers in table
        if(pos++ == 7) pos = 0;            // cycle through array buffer
        TMR2IF = 0;                        // clear interrupt
        }
    }

void clear()        // clear buffer
    {
    char x;
    for(x=0;x<8;x++)
        leds[x] = 0;

    }
void scroll(char dir)
    {
    char x;
    switch (dir)
        {
        case 0:                    // scroll left
            for(x=0;x<8;x++)
                {
                if(leds2[x] & 1)
                    leds[x]+=128;
                leds[x] >>= 1;
                leds2[x]>>= 1;
                }
            DelayMs(100);
            break;
        case 1:                    // scroll right
            for(x=0;x<8;x++)
                {
                if(leds2[x] & 128)
                    leds[x]+=1;
                leds[x] <<= 1;
                leds2[x] <<= 1;
                }
            DelayMs(100);
            break;
        case 2:                    // scroll up
            for(x=7;x>0;x--)
                leds[x] = leds[x-1];
            leds[0] = leds2[7];
            for(x=7;x>0;x--)
                leds2[x] = leds2[x-1];
            leds2[0] = 0;
            DelayMs(100);
            break;
        case 3:                     // scroll down
            for(x=0;x<8;x++)
                leds[x] = leds[x+1];
            leds2[7] = leds[0];
            for(x=0;x<8;x++)
                leds2[x] = leds2[x+1];
            leds2[7] = 0;
            DelayMs(100);
        }

    }

void DelayMs(int x)
    {    // wrapper function for larger delays.
    while(x--)
        __delay_ms(1);
    }
 
MrDEB has an elliptical filter for what he doesn't want to hear.
 
I have seen that video before when I was working on my bike turn signal project. I tried same principal but didn't pick up the next letters.
Just woke up this morn and it dawned on me that I was using Colum_start in the wrong context
Code:
    FOR x = Colum_start TO (Colum_start+7)   ' COLUMS ON PORT b counter
              buffer = Anodes_Data               '  const data
           Data_Bus = Display_Out XOR $11111111              ' inverts the CONST array data at the portb
         
           Data_Bus = 0                              ' data bus
           Data_Bus.bits(7 - (x- Colum_start)) = 1  ' cycle the cathodes from 0 to 7
           Anode_Data =
          DELAYMS(10)
           Anode_Data = 0
         
           NEXT

Colum_start is a "pointer" to the CONST array data not portb. After church I plan to work on this.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top