Two Green 0832 LED Matrix's from Sure Electronics

Hi, I have two Green 0832 LED Matrix’s from Sure Electronics Interfaced this way to an Arduino Duemilanove:
| Display Label | Arduino DIO | Sure’s Connector |
| CS1 | 4 | 3 |
| CS2 | 5 | 1 |
| WR | 8 | 5 |
| DATA | 9 | 7 |
| RD | 10 | 6 |
| GND | gnd | 11 |
| +5V | +5V | 12 |

The Data Sheet can be found here:http://alastair.d-silva.org/system/files/DE-DP105_Ver1.0_EN_0.pdf

I have been able to display text on one display.
What I want to do is display text on both of the displays.

From your datasheet, it seems to be possible to cascade the displays so that it can be controlled as a 864 or a 1632 display. I would go that way and save my Arduino-pins. As an added benefit, you already have the software done mostly.

Korman

Here is my code:

*/
#include <ht1632.h>
#include "font.h"
#include <stdlib.h> 

#include <MHV_io_ArduinoDuemilanove328p.h>

void * operator new(size_t size); 
void operator delete(void * ptr); 

void * operator new(size_t size) { 
  return malloc(size); 
} 

void operator delete(void * ptr) { 
  free(ptr); 
} 

uint8_t revbits(uint8_t arg) { 
  uint8_t result=0;
  if (arg & (_BV(0))) result |= _BV(7); 
  if (arg & (_BV(1))) result |= _BV(6); 
  if (arg & (_BV(2))) result |= _BV(5); 
  if (arg & (_BV(3))) result |= _BV(4); 
  if (arg & (_BV(4))) result |= _BV(3); 
  if (arg & (_BV(5))) result |= _BV(2); 
  if (arg & (_BV(6))) result |= _BV(1); 
  if (arg & (_BV(7))) result |= _BV(0); 
  return result;
}

HT1632 *matrix[4];

uint8_t max_cols = 127;
int16_t col_offset = max_cols;

HT1632 *cur_mat = 0;
char *string = "Welcome to Make, Hack, Void. Have a safe and productive day.";
char *first_char = string;
uint8_t first_char_col = 0;
char *cptr = first_char;
uint8_t char_col = first_char_col;

void setup ()
{  
  digitalWrite(4,HIGH);
  digitalWrite(5,HIGH);
  digitalWrite(6,HIGH);
  digitalWrite(7,HIGH);
  
  matrix[0] = new HT1632( MHV_ARDUINO_PIN_4,MHV_ARDUINO_PIN_8,MHV_ARDUINO_PIN_10,MHV_ARDUINO_PIN_9, HT1632::pmos_8commons );
  matrix[1] = new HT1632( MHV_ARDUINO_PIN_5,MHV_ARDUINO_PIN_8,MHV_ARDUINO_PIN_10,MHV_ARDUINO_PIN_9, HT1632::pmos_8commons, false );
  matrix[2] = new HT1632( MHV_ARDUINO_PIN_6,MHV_ARDUINO_PIN_8,MHV_ARDUINO_PIN_10,MHV_ARDUINO_PIN_9, HT1632::pmos_8commons, false );
  matrix[3] = new HT1632( MHV_ARDUINO_PIN_7,MHV_ARDUINO_PIN_8,MHV_ARDUINO_PIN_10,MHV_ARDUINO_PIN_9, HT1632::pmos_8commons, false );
}

void loop ()
{
  uint8_t char_index, char_width;      
  uint16_t char_offset;
  uint8_t first_char_width;

  if( *first_char > DEDP105_FONT_FIRST_CHAR + DEDP105_FONT_CHAR_COUNT || *first_char < DEDP105_FONT_FIRST_CHAR ) {
    char_index = DEDP105_FONT_CHAR_UNKNOWN;
  } else {
    char_index = *first_char - DEDP105_FONT_FIRST_CHAR;
  }
         
  first_char_width = pgm_read_byte( &dedp105_font_widths[char_index] );
  
  if( col_offset < 0 ) {
    if( ++first_char_col > first_char_width ) {
      first_char_col = 0;
    
      if( *(++first_char) == '\0' ) {
        first_char = string;
        col_offset = max_cols;
      }
      if( *first_char > DEDP105_FONT_FIRST_CHAR + DEDP105_FONT_CHAR_COUNT || *first_char < DEDP105_FONT_FIRST_CHAR ) {
        char_index = DEDP105_FONT_CHAR_UNKNOWN;
      } else {
        char_index = *first_char - DEDP105_FONT_FIRST_CHAR;
      }
         
      first_char_width = pgm_read_byte( &dedp105_font_widths[char_index] );
    }
  }
  cptr = first_char;
  char_col = first_char_col;
  char_width = first_char_width;
  char_offset = pgm_read_word(&dedp105_font_offsets[char_index]);
  
  
  uint8_t pixels;
  
  for( byte col = 0; col < max_cols+1; ++col ) {
    switch(col) {
      case 0:
      case 32:
      case 64:
      case 96:
        if( cur_mat )
          cur_mat->deselect();
        cur_mat = matrix[(int)(col/32)];
        cur_mat->set_mode( HT1632::write_mode );
        cur_mat->send_address( 0 );
      break;
    }
    if( cur_mat ) {
      pixels = 0;
      if( col_offset < col && *cptr != '\0' ) {
        
        if( char_col < char_width ) {
          pixels = pgm_read_byte(&dedp105_font[(int)(char_offset + char_col)]);
        }
  
        ++char_col;
  
        if( char_col > char_width ) {
          char_col = 0;
          cptr++;
          if( *cptr > DEDP105_FONT_FIRST_CHAR + DEDP105_FONT_CHAR_COUNT || *cptr < DEDP105_FONT_FIRST_CHAR ) {
            char_index = DEDP105_FONT_CHAR_UNKNOWN;
          } else {
            char_index = *cptr - DEDP105_FONT_FIRST_CHAR;
          }
  
          char_width = pgm_read_byte(&dedp105_font_widths[char_index]);
          char_offset = pgm_read_word(&dedp105_font_offsets[char_index]);
        }
      }
      cur_mat->send_data(pixels);
      cur_mat->send_data(pixels>>4);
    }
  }
  col_offset--;
}

Continued in next post…

My font.h:

#ifndef FONT_H_
#define FONT_H_



/*
 *
 * new Font
 *
 * created with FontCreator
 * written by F. Maximilian Thiele
 *
 * http://www.apetech.de/fontCreator
 * me@apetech.de
 *
 * File Name           : test2
 * Date                : 09.12.2009
 * Font size in bytes  : 2758
 * Font width          : 10
 * Font height         : 8
 * Font first char     : 32
 * Font last char      : 128
 * Font used chars     : 96
 *
 * The font data are defined as
 *
 * struct _FONT_ {
 *     uint16_t   font_Size_in_Bytes_over_all_included_Size_it_self;
 *     uint8_t    font_Width_in_Pixel_for_fixed_drawing;
 *     uint8_t    font_Height_in_Pixel_for_all_characters;
 *     unit8_t    font_First_Char;
 *     uint8_t    font_Char_Count;
 *
 *     uint8_t    font_Char_Widths[font_Last_Char - font_First_Char +1];
 *                  // for each character the separate width in pixels,
 *                  // characters < 128 have an implicit virtual right empty row
 *
 *     uint8_t    font_data[];
 *                  // bit field of all characters
 */

#include <inttypes.h>
#include <avr/pgmspace.h>

#ifndef DEDP105_FONT_H
#define DEDP105_FONT_H

#define DEDP105_FONT_WIDTH 10
#define DEDP105_FONT_HEIGHT 8

#define DEDP105_FONT_WIDTH_OFFSET      6
#define DEDP105_FONT_FIRST_CHAR            0x20
#define DEDP105_FONT_CHAR_COUNT            0x60
#define DEDP105_FONT_CHAR_UNKNOWN      0x20

static const uint8_t dedp105_font_widths[] PROGMEM = {
          0x01, 0x01, 0x01, 0x05, 0x05, 0x06, 0x05, 0x01, 0x02, 0x02,
          0x01, 0x03, 0x02, 0x02, 0x01, 0x03, 0x04, 0x02, 0x04, 0x04,
          0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x01, 0x02, 0x04, 0x04,
          0x04, 0x05, 0x08, 0x05, 0x04, 0x05, 0x04, 0x04, 0x04, 0x06,
          0x04, 0x01, 0x03, 0x04, 0x03, 0x05, 0x04, 0x06, 0x04, 0x06,
          0x04, 0x05, 0x05, 0x04, 0x05, 0x07, 0x05, 0x05, 0x05, 0x02,
          0x03, 0x02, 0x03, 0x04, 0x01, 0x04, 0x03, 0x04, 0x04, 0x04,
          0x02, 0x04, 0x03, 0x01, 0x02, 0x03, 0x01, 0x05, 0x03, 0x04,
          0x03, 0x03, 0x02, 0x04, 0x02, 0x03, 0x03, 0x05, 0x03, 0x04,
          0x04, 0x03, 0x01, 0x03, 0x05, 0x00,
};

static const uint16_t dedp105_font_offsets[] PROGMEM = {
              0,   1,   2,   3,   8,  13,  19,  24,  25, 27,
             29,  30,  33,  35,  37,  38,  41,  45,  47, 51,
             55,  59,  63,  67,  71,  75,  79,  80,  82, 86,
             90,  94,  99, 107, 112, 116, 121, 125, 129, 133,
            139, 143, 144, 147, 151, 154, 159, 163, 169, 173,
            179, 183, 188, 193, 197, 202, 209, 214, 219, 224,
            226, 229, 231, 234, 238, 239, 243, 246, 250, 254,
            258, 260, 264, 267, 268, 270, 273, 274, 279, 282,
            286, 289, 292, 294, 298, 300, 303, 306, 311, 314,
            318, 322, 325, 326, 329, 334
};

static const uint8_t dedp105_font[] PROGMEM = {
    0x00, // 32
    0x2F, // 33
    0x03, // 34
    0x12, 0x3F, 0x12, 0x3F, 0x12, // 35
    0x12, 0x25, 0x7F, 0x29, 0x12, // 36
    0x23, 0x13, 0x08, 0x04, 0x32, 0x31, // 37
    0x10, 0x2A, 0x2D, 0x32, 0x28, // 38
    0x03, // 39
    0x7E, 0x81, // 40
    0x81, 0x7E, // 41
    0x03, // 42
    0x08, 0x1C, 0x08, // 43
    0x40, 0x20, // 44
    0x10, 0x10, // 45
    0x20, // 46
    0xE0, 0x18, 0x07, // 47
    0x1E, 0x21, 0x21, 0x1E, // 48
    0x02, 0x3F, // 49
    0x22, 0x31, 0x29, 0x26, // 50
    0x12, 0x21, 0x25, 0x1E, // 51
    0x0C, 0x0A, 0x3F, 0x08, // 52
    0x12, 0x25, 0x25, 0x39, // 53
    0x1E, 0x29, 0x29, 0x3A, // 54
    0x01, 0x31, 0x0D, 0x03, // 55
    0x1A, 0x25, 0x25, 0x1A, // 56
    0x26, 0x29, 0x29, 0x1E, // 57
    0x24, // 58
    0x40, 0x24, // 59
    0x08, 0x14, 0x14, 0x22, // 60
    0x14, 0x14, 0x14, 0x14, // 61
    0x22, 0x14, 0x14, 0x08, // 62
    0x02, 0x01, 0x29, 0x09, 0x06, // 63
    0x3C, 0x42, 0xBD, 0xA5, 0xA5, 0xBD, 0x22, 0x1C, // 64
    0x30, 0x0E, 0x09, 0x0E, 0x30, // 65
    0x3F, 0x29, 0x29, 0x1E, // 66
    0x1C, 0x22, 0x21, 0x21, 0x12, // 67
    0x3F, 0x21, 0x21, 0x1E, // 68
    0x3F, 0x29, 0x29, 0x21, // 69
    0x3F, 0x09, 0x09, 0x01, // 70
    0x0C, 0x32, 0x21, 0x29, 0x29, 0x1A, // 71
    0x3F, 0x04, 0x04, 0x3F, // 72
    0x3F, // 73
    0x10, 0x20, 0x3F, // 74
    0x3F, 0x0C, 0x12, 0x21, // 75
    0x3F, 0x20, 0x20, // 76
    0x3F, 0x02, 0x04, 0x02, 0x3F, // 77
    0x3F, 0x04, 0x08, 0x3F, // 78
    0x0C, 0x12, 0x21, 0x21, 0x12, 0x0C, // 79
    0x3F, 0x09, 0x09, 0x06, // 80
    0x0C, 0x12, 0x21, 0x29, 0x12, 0x2C, // 81
    0x3F, 0x09, 0x09, 0x36, // 82
    0x12, 0x25, 0x29, 0x29, 0x12, // 83
    0x01, 0x01, 0x3F, 0x01, 0x01, // 84
    0x3F, 0x20, 0x20, 0x3F, // 85
    0x03, 0x1C, 0x20, 0x1C, 0x03, // 86
    0x0F, 0x30, 0x0C, 0x03, 0x0C, 0x30, 0x0F, // 87
    0x21, 0x12, 0x0C, 0x12, 0x21, // 88
    0x01, 0x06, 0x38, 0x06, 0x01, // 89
    0x21, 0x31, 0x2D, 0x23, 0x21, // 90
    0xFF, 0x81, // 91
    0x07, 0x18, 0xE0, // 92
    0x81, 0xFF, // 93
    0x06, 0x01, 0x06, // 94
    0x80, 0x80, 0x80, 0x80, // 95
    0x01, // 96
    0x3A, 0x2A, 0x2A, 0x3C, // 97
    0x3F, 0x24, 0x3C, // 98
    0x18, 0x24, 0x24, 0x24, // 99
    0x18, 0x24, 0x24, 0x3F, // 100
    0x1C, 0x2A, 0x2A, 0x2C, // 101
    0x3E, 0x05, // 102
    0x48, 0x94, 0x94, 0x7C, // 103
    0x3F, 0x04, 0x3C, // 104
    0x3A, // 105
    0x80, 0x74, // 106
    0x3F, 0x08, 0x34, // 107
    0x3F, // 108
    0x3C, 0x04, 0x3C, 0x04, 0x3C, // 109
    0x3C, 0x04, 0x3C, // 110
    0x18, 0x24, 0x24, 0x18, // 111
    0x7C, 0x14, 0x1C, // 112
    0x1C, 0x14, 0x7C, // 113
    0x3C, 0x04, // 114
    0x24, 0x2A, 0x2A, 0x12, // 115
    0x1F, 0x24, // 116
    0x3C, 0x20, 0x3C, // 117
    0x0C, 0x30, 0x0C, // 118
    0x0C, 0x30, 0x0C, 0x30, 0x0C, // 119
    0x34, 0x08, 0x34, // 120
    0x4C, 0x90, 0x90, 0x7C, // 121
    0x24, 0x34, 0x2C, 0x24, // 122
    0x08, 0x76, 0x81, // 123
    0xE7, // 124
    0x81, 0x76, 0x08, // 125
    0x08, 0x04, 0x08, 0x10, 0x08, // 126
};

#endif


#endif /* FONT_H_ */

I need help modifying these.

Hello, I really need help.

I need help modifying these.

OK. Change all the 7s to 3s.

Or, maybe you had some other change in mind. My crystal ball is dirty, and I'm out of Windex.

With the font?

try using the matrix display library found here:

http://milesburton.com/index.php/Arduino_%26_the_Sure_2416_Information_Display

The library is fairly easy use. '

If you want to scroll the text across the two screens check out this thread:

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1275865385/0

Right now there are some issues with the scrolling function being limited to 11 characters. I have some crude work arounds if you are interested.

:(Ok, I have tried so hard to get this to work. I have searched for hours, tested for hours, and I cant get this thing to work!!>:(

Change HT1632 *matrix[4]; to HT1632 *matrix[2];

and Take the 'false' statement out of the matrix[1] = new HT1632(MHV_ARDUINO_PIN_5,MHV_ARDUINO_PIN_8,MHV_ARDUINO_PIN_10,MHV_ARDUINO_PIN_9, HT1632::pmos_8commons, false ); Think That's it.

Is the #1 display working now?

Sadly that does not work :'(

if you

comment out or delete

case 64 case 96

And the kicker

unit8_t max col=128;

to

unit8_t max col=64;

That should do it.

it's now working on mine.

Ok I now have it displaying messages. I now need a 16 point font since my displays are stacked. Also how would I modify the code to display as 32x16? And it would be great if some one could use this program: http://www.retromodelisme.com/photo/font.zip to make me a 16 point font, as I am using a Mac.

donkahones

Right now there are some issues with the scrolling function being limited to 11 characters. I have some crude work arounds if you are interested.

Ironically just enough for "hello world"

I'm interested in you workaround?