Problems with 08x32 display

Been tinkering with the Sure Electronics LED Matrix. Been through a bunch of the posts here on it, I have the ht1632 libraries and quite a few demos. It's displaying the information weird though.


The longer the demos run the more corrupt the characters become. I've tried several different demos with different wiring schemes, but all display some sort of garbage.

Any help would be appreciated .

Webby

Without any schematics, links to the hardware you are using, code, or a list of what you have tried (along with the exact outcome: "it didn't work" doesn't count) there are not many suggestions to give.

You really have to provide the code and connection information mentioned in reply #1 if you expect to get much help from anyone else.

but all display some sort of garbage.

You didn't get what you expected but what you did get is certainly not 'garbage'.

It is obvious that you are trying to display the word 'HELLO'. Also, in the first photo it looks like the display starts with row 3 and in the second it starts with row 6.

This observation of what is happening, when compared to what you expected to happen, should help you start troubleshooting. We can't help you any further without the aforementioned information.

Don

Sorry, Not much of a poster. Plus I've tried so many different things I had to get it straight.

What you are seeing is the rolling demo from the HT1632 Arduino "Matrix Display" Library for the Sure 2416 and 0832, found here MilesBurton.com

wiring is 10,11 from the Arduino to the 5 and 7 of the Sure board, and of course power. Pin 8 goes to the CS2 of the Sure board and pin 9 goes to the CS1 pin of the Sure. But I don't think they do anything since it will do the same thing with or without them hooked up.

Also, I do agree with you on the fact it looks like it's starting on the wrong row and column. and the more it runs the further off it becomes.
What I'm wondering is if something has been changed in this hardware that makes it not work with these libraries correctly.

if something has been changed in this hardware that makes it not work with these libraries correctly.

It could be or more likely it is being asked to update information faster than the maximum speed. Have you any control over the scrolling rate? Try slowing it down.
Does it work when you just have a static, non scrolling display?

Here is the code:

#include "MatrixDisplay.h"
#include "DisplayToolbox.h"
#include "font.h"

#define DEMOTIME 30000  // 30 seconds max on each demo is enough.
#define DISPDELAY 100    // Each "display" lasts this long
#define LONGDELAY 1000  // This delay BETWEEN demos

// Macro to make it the initDisplay function a little easier to understand
#define setMaster(dispNum, CSPin) initDisplay(dispNum,CSPin,true)
#define setSlave(dispNum, CSPin) initDisplay(dispNum,CSPin,false)

// 4 = Number of displays
// Data = 10/
// WR == 11
// True. Do you want a shadow buffer? (A scratch pad)

// Init Matrix
MatrixDisplay disp(4,11,10, true);
// Pass a copy of the display into the toolbox
DisplayToolbox toolbox(&disp);

// Prepare boundaries
uint8_t X_MAX = 0;
uint8_t Y_MAX = 0;

void setup() {
  // Fetch bounds (dynamically work out how large this display is)
  X_MAX = disp.getDisplayCount() * (disp.getDisplayWidth()-1)+1;
  Y_MAX = disp.getDisplayHeight();

  // Prepare displays
  disp.setMaster(0,4);
 // disp.setSlave(1,5);
 // disp.setSlave(2,6);
 // disp.setSlave(3,7);
}



void loop() {
   demoText(); // Bouncy hello

  demoBouncyCircle(); 

  demo_bouncyline(); // Bouncy line
  
  demo_life(); // Basic life demo
}


/*
 * demo_life
 * Run the "life" game for a while, demonstrating the
 * ability of the AVR to update every pixle of the display
 * after having done some computation to figure out the new
 * value.  Also demonstrates the use of the snapshot ram.
 */
void demo_life ()
{
  byte x,y, neighbors, newval;

  toolbox.setPixel(10,3,1);  // Plant an "acorn"; a simple pattern that
  toolbox.setPixel(12,4,1); //  grows for quite a while..
  toolbox.setPixel(9,5,1);
  toolbox.setPixel(10,5,1);
  toolbox.setPixel(13,5,1);
  toolbox.setPixel(14,5,1);
  toolbox.setPixel(15,5,1);

  delay(LONGDELAY);   // Play life
  disp.copyBuffer(); // Copy the back buffer into the shadow buffer (basically create a backup of the CURRENT display)

  for (int i=0; i < (DEMOTIME/DISPDELAY)/4; i++) {
    for (x=1; x < X_MAX; x++) {
      for (y=1; y < Y_MAX; y++) {
        neighbors = toolbox.getPixel(x, y+1, true) +
          toolbox.getPixel(x, y-1, true) +
          toolbox.getPixel(x+1, y, true) +
          toolbox.getPixel(x+1, y+1, true) +
          toolbox.getPixel(x+1, y-1, true) +
          toolbox.getPixel(x-1, y, true) +
          toolbox.getPixel(x-1, y+1, true) +
          toolbox.getPixel(x-1, y-1, true);

        switch (neighbors) {
        case 0:
        case 1:
          newval = 0;   // death by loneliness
          break;
        case 2:
          newval = toolbox.getPixel(x,y, true); // Fetch pixel from the SHADOW buffer
          break;  // remains the same
        case 3:
          newval = 1;
          break;
        default:
          newval = 0;  // death by overcrowding
          break;
        }

        toolbox.setPixel(x,y, newval);
      }
    }
    // Write out display
    disp.syncDisplays(); 

    // Copy buffer
    disp.copyBuffer(); // Copy the back buffer into the shadow buffer (basically create a backup of the CURRENT display)

    delay(DISPDELAY);
  }
}




/*
 * demo_bouncyline
 * Do the classic "bouncing line" demo, where the endpoints of a line
 * move independently and bounce off the edges of the display.
 * This should demonstrate (more or less) the performance limits of
 * the line drawing function.
 */
void demo_bouncyline ()
{
  char x1,y1, x2,y2, dx1, dy1, dx2, dy2;

  disp.clear();
  x1 = random(0,X_MAX);
  x2 = random(0,X_MAX);
  y1 = random(0,Y_MAX);
  y2 = random(0,Y_MAX);
  dx1 = random(1,4);
  dx2 = random(1,4);
  dy1 = random(1,4);
  dy2 = random(1,4);
  for (int i=0; i < DEMOTIME/DISPDELAY; i++) {
    toolbox.drawLine(x1,y1, x2,y2, 1);
    disp.syncDisplays(); 
    delay(DISPDELAY);
    toolbox.drawLine(x1,y1, x2,y2, 0);

    x1 += dx1;
    if (x1 > X_MAX) {
      x1 = X_MAX;
      dx1 = -random(1,4);
    } 
    else if (x1 < 0) {
      x1 = 0;
      dx1 = random(1,4);
    }

    x2 += dx2;
    if (x2 > X_MAX) {
      x2 = X_MAX;
      dx2 = -random(1,4);
    } 
    else if (x2 < 0) {
      x2 = 0;
      dx2 = random(1,4);
    }

    y1 += dy1;
    if (y1 > Y_MAX) {
      y1 = Y_MAX;
      dy1 = -random(1,3);
    } 
    else if (y1 < 0) {
      y1 = 0;
      dy1 = random(1,3);
    }

    y2 += dy2;
    if (y2 > Y_MAX) {
      y2 = Y_MAX;
      dy2 = -random(1,3);
    } 
    else if (y2 < 0) {
      y2 = 0;
      dy2 = random(1,3);
    }
  }
}

// Text bouncing around
void demoText()
{
  int y=Y_MAX-7;
  int x=X_MAX;
  boolean textDir = false;
  boolean textRight = false;
  for (int i=0; i < (DEMOTIME/DISPDELAY)/4; i++) 
  {
    if(y<=0) textDir = true;
    else if(y>=(Y_MAX-7)) textDir = false; 


    if(x>=X_MAX) textRight = false;
    else if(x<=0) textRight = true;

    if(textDir) y++;
    else y--;

    if(textRight) x++;
    else x--;

    drawString(x,y,"Hello");
    disp.syncDisplays(); 

    delay(100);
    disp.clear(); 
  } 
}




// Small circle bouncing around the bounds
void demoBouncyCircle()
{
  int radius = 3; 
  int y=Y_MAX-(radius*2);
  int x=X_MAX;

  boolean textDir = false;
  boolean textRight = false;
  for (int i=0; i < (DEMOTIME/DISPDELAY)/4; i++) 
  {
    if(y<=radius) textDir = true;
    else if(y>=(Y_MAX-radius)) textDir = false; 


    if(x>=X_MAX) textRight = false;
    else if(x-24<=0) textRight = true;

    if(textDir) y++;
    else y--;

    if(textRight) x++;
    else x--;

    toolbox.drawCircle(x, y, radius);
    disp.syncDisplays(); 

    delay(100);
    disp.clear(); 
  }  

}



/*
 * Copy a character glyph from the myfont data structure to
 * display memory, with its upper left at the given coordinate
 * This is unoptimized and simply uses setPixel() to draw each dot.
 */
void drawChar(uint8_t x, uint8_t y, char c)
{
  uint8_t dots;
  if (c >= 'A' && c <= 'Z' ||
    (c >= 'a' && c <= 'z') ) {
    c &= 0x1F;   // A-Z maps to 1-26
  } 
  else if (c >= '0' && c <= '9') {
    c = (c - '0') + 27;
  } 
  else if (c == ' ') {
    c = 0; // space
  }
  for (char col=0; col< 5; col++) {
    dots = pgm_read_byte_near(&myfont[c][col]);
    for (char row=0; row < 7; row++) {
      if (dots & (64>>row))            // only 7 rows.
        toolbox.setPixel(x+col, y+row, 1);
      else 
        toolbox.setPixel(x+col, y+row, 0);
    }
  }
}


// Write out an entire string (Null terminated)
void drawString(uint8_t x, uint8_t y, char* c)
{
    for(char i=0; i< strlen(c); i++)
    {
        drawChar(x, y, c[i]);
        x+=6; // Width of each glyph
    }
}

Here is the code:

In what way does this answer my question?
You have the hardware so you know what it is doing. I don't have the hardware so I don't know what it is doing.
There are four demos here what happens when you run the others?

Switched to these libraries : HT1632-AVR : A library to interface HT1632 LED Driver ICs and AVR micro controllers

http://www.makehackvoid.com/member-projects/ht1632-avr-library-interface-ht1632-led-driver-ics-and-avr-micro-controllers

After I got this working I was able to get the other script working, I must have screwed up one of the library files or something.

Congrats on getting it working. Could you tell me how you connected power to the display. Through the ribbon cable or through the 2 holes on the side.

Through the ribbon cable.

Cheers for the reply. What are the other connections that you have made in the working state. I can't get mine to do anything. I have Arduino pins 10 + 11 hooked up to sure pins 5(WR) + 7(Data) respectively are these the only connections you made as well?

@dansxmods

I personally use GitHub - devdsp/HT1632-AVR: Driver library to support Holtek's HT1632 LED Driver IC on AVR micro controllers. :wink:

The wiring for that is
| Display Label | Arduino DIO | Sure's Connector |
| CS1 | 4 | 3 |
| CS2 | 5 | 1 |
| CS3 | 6 | 2 |
| CS4 | 7 | 4 |
| WR | 8 | 5 |
| DATA | 9 | 7 |
| RD | 10 | 6 |
| GND | gnd | 11 |
| +5V | +5V | 12 |