Pages: 1 ... 10 11 [12] 13 14 ... 19   Go Down
Author Topic: Sure Electronics new 32x16 bi-color display: 3216 RG -Cont. from read only forum  (Read 51947 times)
0 Members and 1 Guest are viewing this topic.
Sunnyvale, CA
Offline Offline
Full Member
***
Karma: 0
Posts: 147
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote

doubledaffy... look here: https://code.google.com/p/ht1632c/  thats the "current" library.  works FANTASTIC for 1, 2 displays, but major issues with 3 or 4.    Performance for 2 displays on an arudino uno is about 122 FPS according to the built in FPS program.   There seems to be a bug however if you use "RIGHT" for text direction, vs "LEFT", where it shows dots remaining at the top and bottom of the text path, almost like a ghost of the top and bottom pixels (forms a straight line across the panels)

If you can't figure out how to use the library, I'll post my code for you, but it's really easy.

evanrich, I'm running into some issues just trying to compile that library. This is the sample code I'm using. I'm also using an Arduino Uno and one 3216 RG board.


Are you using arduino 1.0?  if so pm me your email and I'll send you the fixed library.  can't attach or paste, paste is too long and attachment folder says it's full?
« Last Edit: January 10, 2012, 07:36:02 pm by evanrich » Logged

My first major project (looking for people who would like to help contribute) Bluetooth Sure 32x16 LED Displays!: https://github.com/evanric

Sunnyvale, CA
Offline Offline
Full Member
***
Karma: 0
Posts: 147
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

florinc, forgive me for being thick, but after reading your site, I still can't figure it out.


on the site, it gives an example of bitmap[7][14].   If i understand correctly, its the number of lines (there are 14 lines in that one pacman character).   
Code:
uint16_t PROGMEM bitmap[7][14] = {
  {
    0x02E0,    // ____XXXXX_____
    0x0FF8,    // __XXXXXXXXX___
    0x07FC,    // ___XXXXXXXXX__
    0x03FC,    // ____XXXXXXXX__
    0x01FE,    // _____XXXXXXXX_
    0x00FE,    // ______XXXXXXX_
    0x007E,    // _______XXXXXX_
    0x007E,    // _______XXXXXX_
    0x00FE,    // ______XXXXXXX_
    0x01FE,    // _____XXXXXXXX_
    0x03FC,    // ____XXXXXXXX__
    0x07FC,    // ___XXXXXXXXX__
    0x0FF8,    // __XXXXXXXXX___
    0x02E0,    // ___XXXXX______
  },

If I look at the font from the library, there are 8 lines..

Code:
unsigned char PROGMEM font_8x16[95][14] = {
{0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000}, //   
{0x0000,0x0000,0x7e02,0x7fe7,0x7e02,0x0000,0x0000,0x0000}, // !

so should it not be
Quote
unsigned char PROGMEM font_8x16[95][8]
?

it looks like it has to be unsigned char, because the existing fonts in the old code (my2font), look like this:
Code:
unsigned char PROGMEM my2font[256][8]={
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x00
{0x7E,0x81,0xA9,0x8D,0x8D,0xA9,0x81,0x7E}, // 0x01

again only 8.

Now onto the code.  In the main pde, there is a variable that defines the number of columns:
Code:
// insert here the number of columns of your font files
// the compiler will comment how large the number of columns
// should be
#define NCOLUMNS 8

my guess is that this should be 8, to match the font variable, correct?  I've tried other values, but the compiler errors if it doesn't match the number in brackets in the font.h file.

The second location in code is this:
Code:
scrolltextsizexcolor(8,"ABCDEFG    ",1,GREEN, 0,font_8x16,8,8,'T',0);

the font_8x16 is the referenced font name, and then the first 8 is "number of columns", second 8 is "number of rows"

no matter what I try for any of these settings, I either get garbled crap on the screen, or it displays the wrong characters...for example if i enter "ABCDEFG", it shows "abcdefg"... if I enter "!@#$%"...I get "1" followed by a buncha crap.
Logged

My first major project (looking for people who would like to help contribute) Bluetooth Sure 32x16 LED Displays!: https://github.com/evanric

0
Offline Offline
Edison Member
*
Karma: 7
Posts: 1411
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

The example in the post is not strictly linked to the functions in the HT1632 code you/we are using here. Just showing the principle.

I couldn't find this code you are referring to:
Code:
unsigned char PROGMEM font_8x16[95][14] = {
{0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000}, //   
{0x0000,0x0000,0x7e02,0x7fe7,0x7e02,0x0000,0x0000,0x0000}, // !

But, at a glance, this is what I take from it:
1. it is an attempt to define each character as an array of 8 values (as you correctly noticed, should be font_8x16[95][8]);
2. this means that each character is defined as a sequence of columns (one character is 8 columns x 16 rows);
3. to define a column, you need 16 bits; this is more than a char (8 bits), so you would need an unsigned int; therefore, "unsigned char PROGMEM font_8x16" is wrong, it should be "unsigned int PROGMEM font_8x16";

And I did not have an in-depth look at the function "scrolltextsizexcolor", which looks pretty hard-to-understand to me (I did not write that).

You give it a few more tries and if you don't get it working, I will make an effort to dive into that function.
Logged

Sunnyvale, CA
Offline Offline
Full Member
***
Karma: 0
Posts: 147
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

My feeble non C brain still can't figure it out, I've tried about 5 different ways of changing stuff, and although it compiles, I get garbage smiley-confuse  The only way I can get a "big" font, is to scale the text by changing the integer from 1 to 2 in the message, but this is NOT desired, because it slows the display down a lot. really would like to have larger font natively ata 8x15 or 8x16, instead of scaling up 5x7 stuff.

On the other hand, I've started to post all my work on github, if anyone is interested in collaborating, or seeing what I've done, please feel free to take a look at my github page here:https://github.com/evanrich/Bluetooth-LED-Sign

Let me know if you have any questions, I'm going to continue posting stuff all week.
Logged

My first major project (looking for people who would like to help contribute) Bluetooth Sure 32x16 LED Displays!: https://github.com/evanric

0
Offline Offline
Edison Member
*
Karma: 7
Posts: 1411
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Evan,
Take a look at the file fontLarge.h. It defines a font 11(wide)x14(high). It also has functions to manipulate it (although I don't think I wrote them myself).
Logged

Sunnyvale, CA
Offline Offline
Full Member
***
Karma: 0
Posts: 147
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

where is the fontlarge.h file?  i dont see it in the old code .zip's
Logged

My first major project (looking for people who would like to help contribute) Bluetooth Sure 32x16 LED Displays!: https://github.com/evanric

0
Offline Offline
Edison Member
*
Karma: 7
Posts: 1411
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

You are right, it's not in the original code.
PM me with your email address and I will send it to you.
Logged

Sunnyvale, CA
Offline Offline
Full Member
***
Karma: 0
Posts: 147
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

ok..   This is dumb.    I took a look at fontLarge.h,  and I can see the characters with my eyes.   But it still won't work with the "old code".  Here's the lay of it.

In your font file, as well as the new "font.h" from the library,  text is defined as uint_16t..

Code:
uint16_t  PROGMEM largeFont[96][11]

However in the "old" code, all the functions are defined as such:
Quote
void scrolltextsizexcolor(int y,char Str1[ ], char size, byte color, byte secondcolor,  unsigned char fontname[][NCOLUMNS], int columncountfont, char rowcountfont, char oddeven, int delaytime)

and
Quote
void ht1632_putcharsizecolor(int x, int y,unsigned char c,  char size, byte color, byte secondcolor, unsigned char fontname[][NCOLUMNS],  int columncountfont, char rowcountfont, char oddeven)

I've underlined and bolded the difference.  with these settings, the sketch won't compile.  so I went and changed your font to unsigned char.  This resulted in garbage.   I then changed all the routines to reflect "unint16_t", but this resulted in garbage too.

per your file, being 11 columns, I tried the following:

Code:
// insert here the number of columns of your font files
// the compiler will comment how large the number of columns
// should be
#define NCOLUMNS 8

I changed the 8 to 11 for your largefont file.


I then changed
Code:
scrolltextsizexcolor(2,"12345   ",1,GREEN, 0,largeFont,8,8,'G',0);

to

Code:
scrolltextsizexcolor(2,"12345   ",1,GREEN, 0,largeFont,11,14,'T',0);

to reflect the 11 columns, 14 rows.   


Compile the sketch, run it.  Garbage.  My feeling is that the routine that pulls the characters from the PROGMEM and displays them is pulling them funny, but i'm not sure wtf is going on as I don't know C that well.  I know it's probably something retardedly simple as well, but I can't seem to figure out what the issue is.  see vid below

« Last Edit: January 24, 2012, 12:28:09 pm by evanrich » Logged

My first major project (looking for people who would like to help contribute) Bluetooth Sure 32x16 LED Displays!: https://github.com/evanric

Sunnyvale, CA
Offline Offline
Full Member
***
Karma: 0
Posts: 147
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Further, here is the equivlent function from the new code, which uses uint16_t

Code:
void ht1632c::hscrolltext(int y, char *text, byte color, int delaytime, int times, byte dir)
{
  byte showcolor;
  int x, len = strlen(text);
  register byte width = font_width;
  width++;
 
  while (times) {
    for ((dir) ? x = - (len * width) : x = x_max; (dir) ? x <= x_max : x > - (len * width); (dir) ? x++ : x--)
    {
      for (int i = 0; i < len; i++)
      {
        showcolor = (color & RANDOMCOLOR) ? random(1,4) : color;
        showcolor = ((color & BLINK) && (x & 2)) ? BLACK : (showcolor & ~BLINK);
        putchar(x + width * i,  y, text[i], showcolor);
      }
      sendframe();
      delay(delaytime);
    }
    times--;
  }
}

Code:
#ifdef FONT_8x16
    case FONT_8x16:
        wfont = (prog_uint16_t *) &font_8x16[0];
        font_width = 8;
        font_height = 16;
        break;

Code:
byte ht1632c::putchar(int x, int y, char c, byte color, byte attr)
{
  word dots, msb;

  if (x < -font_width || x > x_max + font_width || y < -font_height || y > y_max + font_height)
    return 0;
 
  register byte width = font_width;
  register byte height = font_height;

  c -= 32;
  msb = pow2(height-1);
  //attr = PROPORTIONAL; // TESTPOINT
 
  // some math with pointers... don't try this at home ;-)
  prog_uint8_t *addr = font + c * width;
  prog_uint16_t *waddr = wfont + c * width;
  for (register char col = 0; col < width; col++) {
    dots = (height > 8) ? pgm_read_word_near(waddr + col) : pgm_read_byte_near(addr + col);
    if (attr & PROPORTIONAL) {
      if (dots)
      {
        for (register char row = 0; row < height; row++) {
          if (dots & (msb>>row)) {
            plot(x+col, y+row, (color & MULTICOLOR) ? random(1,4) : color);
          } else {
            plot(x+col, y+row, BLACK);
          }
        }
      } else {
        width--;
        x--;
      }
    } else {


now I'm really  confused.   I think in the meantime, I'm going to put a 20 Mhz crystal in and try to use the font scaling (x2) to get a full-display font, as this stuff is hurting my head.


grrrrr
Logged

My first major project (looking for people who would like to help contribute) Bluetooth Sure 32x16 LED Displays!: https://github.com/evanric

Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So I got the library working (thanks evanrich), but I have a few more questions. I noticed in a few previous posts that scrolling right was a little bugged, has anyone come up with a fix for that yet? Also, my project involves reflecting the display off a mirror, so I was wondering if there was a quick simple way to modify the "putchar" function to either invert or reflect letters? Just want to consider all my options before I go through the process of changing the bitmaps in font.h.

Thanks in advance.
« Last Edit: January 26, 2012, 08:14:45 pm by AznPrince » Logged

The Appearance of Reason Induces Compliance

0
Offline Offline
Edison Member
*
Karma: 7
Posts: 1411
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Evan,
The file I sent you has everything you need for scrolling large fonts. You just need to add and modify a few lines in the original code (as I did):
Code:
char* msgLine = "           Hello world - demo for large font scrolling on dual 3216 display.";
int crtPos = 0;
int crtColor = GREEN;
...

void loop ()
{
  displayLargeScrollingLine();

  if (crtPos >= strlen(msgLine))
      crtPos = 0;
}

Here is the result:


Logged

Minnesota
Offline Offline
Newbie
*
Karma: 0
Posts: 16
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Can either of you post the code so others can use it?
Logged

0
Offline Offline
Edison Member
*
Karma: 7
Posts: 1411
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Please find the link to the code at the end of this post:
http://timewitharduino.blogspot.com/2012/01/scrolling-message-sign-display-with.html
Logged

Minnesota
Offline Offline
Newbie
*
Karma: 0
Posts: 16
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank You.
Logged

Sunnyvale, CA
Offline Offline
Full Member
***
Karma: 0
Posts: 147
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Can either of you post the code so others can use it?

Also,

Look in my sig, for a link to my github repo for the project I'm working on.  It includes schematics & board layouts (Eagle Cad and DSN), parts lists, code (arduino, .NET, and Android), as well as some wiki info on how to use sure displays (or a custom 96x16 display I put together) and your pc/android phone with bluetooth to send messages to the displays.

It's a work in progress, and so far I'm the only person committing to it, hopefully that will change later on as people check it out and have ideas, enhancements, etc.  I'd encourage you to follow it for updates (and so I don't feel like I'm wasting my time =))

Florinc,

Thanks for the reply, it's been kicking my butt.  Will take a look at it tonight if I can get some time.   

Logged

My first major project (looking for people who would like to help contribute) Bluetooth Sure 32x16 LED Displays!: https://github.com/evanric

Pages: 1 ... 10 11 [12] 13 14 ... 19   Go Up
Jump to: