Pages: 1 ... 20 21 [22] 23 24 25   Go Down
Author Topic: Arduino to 384 LED display module (MCU Interface)  (Read 39604 times)
0 Members and 1 Guest are viewing this topic.
netherlands
Offline Offline
Newbie
*
Karma: 0
Posts: 14
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello Kari, glad you made progress.

I did also !

THe problem is solved if I skiped the boundaries and make them fixed to 23 and 15....

This small peace of partly stolen code works well !
Code:
#include "MatrixDisplay.h"
#include "DisplayToolbox.h"

// Easy to use function
#define setMaster(dispNum, CSPin) initDisplay(dispNum,CSPin,true)
#define setSlave(dispNum, CSPin) initDisplay(dispNum,CSPin,false)

// 1 = Number of displays
// Data = 10
// WR == 11
// False - we dont need a shadow buffer for this example. saves 50% memory!

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

// Prepare boundaries
uint8_t X_MAX = 23;
uint8_t Y_MAX = 15;

void setup() {
  Serial.begin(9600);


  // Prepare displays
  // The first number represents how the buffer/display is stored in memory. Could be useful for reorganising the displays or matching
  he physical layout
    // The number is a array index and is sequential from 0. You can't use 4-8. You must use the numbers 0-4
  // The second number represents the "CS" pin (ie: CS1, CS2, CS3, CS4) this controls which panel is enabled at any one time.
  disp.setMaster(0,4);
  //disp.setSlave(1,5);
  //disp.setSlave(2,6);
  //disp.setSlave(3,7);
}


void loop()
{
  /*
            The MatrixDisplay library treats each display individually. As a result you can set
               each display by it's seperate coordinates. For example:
               
               disp.setPixel(0, 5, 10, 1);
               
                This sets display 0 (which you defined above)
                Coordinate x = 5
                Coordinate Y = 10
                Turn the LEDs on = 1 (0 for off)
         
               Alternatively you may wish to use the ToolBox. The toolbox assumes that each of your displays
               are set out horizontally. Display 0 is the first through n. Using the toolbox you can access the display as
               if it were on big virtual display. For example:
               
               toolbox.setPixel(5, 46, 1);
               
               Coordinate x = 5
               Coordinate y = 46 (notice that's a virtual coordinate, larger than 23)
               Turn the Leds on = 1 (0 for off)
               
               Once you have set the pixels you'd like on. You need to sync the displays (basically write the buffer to the device).
               
               disp.syncDisplays();
               
               Alternatively there's a few tricks you can use. If you sync the displays, the ENTIRE buffer is written out - that is hugely slow (comparatively).
               It may more efficient to write each pixel as you go. For example:
               
               Just as shown above but you can add a "paint" argument. If you set this to true the library will write the pixel straight to the display.
               You wont need to use disp.syncDisplays(); if you don't want to.
               toolbox.setPixel(5, 46, 1, true);
         */

  // Write outside box to display
  for(int i = 0 ; i < (X_MAX + 1); i++)
  {
    toolbox.setPixel(i, 0, 1, true); //Top Hor line
    toolbox.setPixel(i,Y_MAX,1,true);//Bottom Hor line
  }
  for(int i = 0 ; i < (Y_MAX + 1); i++)
  {
    toolbox.setPixel(0,i, 1, true); //Left Ver line
    toolbox.setPixel(X_MAX,i,1,true);//Right Ver line
  }
  // ...and write the result to the displays
  disp.syncDisplays();

  // Now we're here. Why don't we try out another simple function. SetBrightness
  for(int i=0; i<16; ++i) // The displays have 15 different brightness settings
  {
    // This will set the brightness for ALL displays
    toolbox.setBrightness(i);
    // Alternatively you could set them individually
    // disp.setBrightness(displayNumber, i);
    delay(400); // Let's wait a bit or you'll miss it!
  }

  delay(500); // Wait 500 ms

  // Okay lets clear the buffer
  disp.clear();
  // ...and write the result to the displays
  disp.syncDisplays();
  
  delay(500); // Wait 500 ms


  // We're all done. let's start looping
}


So now I can look for writing sprites and text to the display!

Hope you are gooing well, I show my progress ! smiley-grin
Logged

netherlands
Offline Offline
Newbie
*
Karma: 0
Posts: 14
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

And a little more to show progress.
Now I go study on making text and sprites with the use of arrays!
Code:
/*      First demo program for Holtek HT1632 Led driver chip
 *      Sure 2416 display 24*16 leds
 *      September 2010 pa0akv
 */


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

// Easy to use function
#define setMaster(dispNum, CSPin) initDisplay(dispNum,CSPin,true)
#define setSlave(dispNum, CSPin) initDisplay(dispNum,CSPin,false)

// 1 = Number of displays
// Data = 10
// WR == 11
// False - we dont need a shadow buffer for this example. saves 50% memory!

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

// Prepare boundaries
uint8_t X_MAX = 23;
uint8_t Y_MAX = 15;

void setup()
{
  Serial.begin(9600);
  disp.setMaster(0,4);  
}

// Let's start

void loop()
{
  // Write outside box to display
  for(int i = 0 ; i < (X_MAX + 1); i++)
  {
    toolbox.setPixel(i, 0, 1, true); //Top Hor line
    toolbox.setPixel(i,Y_MAX,1,true);//Bottom Hor line
  }
  // Write both sides to display
  for(int i = 0 ; i < (Y_MAX + 1); i++)
  {
    toolbox.setPixel(0,i, 1, true); //Left Ver line
    toolbox.setPixel(X_MAX,i,1,true);//Right Ver line
  }

  // let's write figure 1
    toolbox.setPixel(3,3,1,true);
    toolbox.setPixel(4,3,1,true);
    toolbox.setPixel(2,4,1,true);
    toolbox.setPixel(4,4,1, true);
    toolbox.setPixel(4,5,1,true);
    toolbox.setPixel(4,6,1,true);  
    toolbox.setPixel(4,7,1,true);
    toolbox.setPixel(4,8,1, true);
    toolbox.setPixel(4,9,1,true);
    toolbox.setPixel(4,10,1,true);  
    toolbox.setPixel(3,10,1,true);
    toolbox.setPixel(2,10,1,true);
    toolbox.setPixel(5,10,1,true);
    toolbox.setPixel(6,10,1,true);  
}



:smiley
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 42
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,

If you change this
Code:
MatrixDisplay disp(4,11,10, false);
to
Code:
,
MatrixDisplay disp(1,11,10, false);
then you don't have to hard code the buffer size.
The first parameter is the number of panels.

Nice that you got it working.

I am now testing the Sure "Demo Board for LED Dot Matrix Based on HT1632". It controls the 0832 panels. Have not had much luck yet. The driver has a 'nice' feature that it hangs the computer if power is removed from the board or usb cable disconnected.

Has anyone tested it?

Is there anyone else who has used PICs?

Best Regards
Kari
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 1
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello, i got a problem with the milesburton lib. It seems like the last screen wont show the first and last row. Anyone got any ideas on why?
(Using arduino 0020 and a Diecimila)
Logged

London, UK
Offline Offline
Newbie
*
Karma: 1
Posts: 41
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello All,

Just got the new version of Sure's 2416 Green display with the Holtek H1632C IC. They don't suffer from the dimming issues the old display did - the newer Holtek chip can provide more current.

Interestingly the LED panels in the displays I received are bi-colour red and green, but only the green LEDs are connected. Shorting the right pins with a screwdriver does light the red LED's though!

If anyone is thinking of using these displays, I found you need to change WestfW's code slightly. In the ht1632_setup() function:

Code:
Remove the following 5 lines:

ht1632_sendcmd(d,HT1632_CMD_SYSDIS);   // Disable system
ht1632_sendcmd(d, HT1632_CMD_COMS11);  // 16*32, PMOS drivers
ht1632_sendcmd(d, HT1632_CMD_MSTMD);       // Master Mode
ht1632_sendcmd(d, HT1632_CMD_SYSON);       // System on
ht1632_sendcmd(d, HT1632_CMD_LEDON);       // LEDs on

Replace them with:

ht1632_sendcmd(d, HT1632_CMD_SYSON);        // System on
ht1632_sendcmd(d, HT1632_CMD_LEDON);        // LEDs on
ht1632_sendcmd(d, HT1632_CMD_COMS01);       // NMOS Output 24 row x 24 Com mode

Sure have sorted out the address mapping on the new green display too, so you can use the simple mapping like the red LED displays use. I.e. if like me you had a line like this is your ht1632_plot or get_shadowram functions:

Code:
addr = ((x<<2) + (y>>2)) ^ 28;

... you can revert it back to...

Code:
addr = ((x<<2) + (y>>2));


Hope this helps someone, will post a vid of my clock running the new displays. Hopefully they are now bright enough that I can put them in a translucent plastic box.

Nick



Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 4
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

this is very cool!! good luck smiley
Logged

North Yorkshire, UK
Offline Offline
Faraday Member
**
Karma: 104
Posts: 5531
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Interestingly the LED panels in the displays I received are bi-colour red and green, but only the green LEDs are connected. Shorting the right pins with a screwdriver does light the red LED's though!
Interesting indeed.  smiley-grin
Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 638
Posts: 50319
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Shorting the right pins with a screwdriver does light the red LED's though!
Maybe you should try a hammer. No, a bigger hammer. Come on, get a real hammer. Now, short those pins.
Logged

London, UK
Offline Offline
Newbie
*
Karma: 1
Posts: 41
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Are you saying I should be more careful with these delicate components  smiley
Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 638
Posts: 50319
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Are you saying I should be more careful with these delicate components
Absolutely not. Keep the economy going as you buy replacements.
Logged

London, UK
Offline Offline
Newbie
*
Karma: 1
Posts: 41
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

OK OK, I didn't just short any old pins! Maybe I should have said - After looking at the data sheet I carefully connected pins 23 and 24 of the top left LED matrix to put the columns of red and green LED's in parallel. Telling the HT1632C to light the top left LED then lit both the green and red LEDs.

Logged

Offline Offline
Jr. Member
**
Karma: 2
Posts: 85
(╯°□°)╯︵ ┻━┻
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have the same problem as Jensah. First and last row of displays 2 to 4 don't light. Setting all the displays as the first makes the rows light, so it's not a hardware problem. Any known fix?
Logged

The Big Smoke
Offline Offline
Sr. Member
****
Karma: 0
Posts: 260
Hacking and Slashing
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi Guys,

I've just updated the library to fix an off by one error on the display toolbox. That could fix the problem you guys are seeing.

At the moment I dont support the green displays. If anyone has the code to handle the pixel mapping drop me a line. Unfortunately I dont have these displays any more to do testing.
Logged

Offline Offline
Jr. Member
**
Karma: 2
Posts: 85
(╯°□°)╯︵ ┻━┻
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Awesome job mate. You'll also need to fix the demos now. For example the "Simple" demo won't light the 3 last columns.

Here's the fix:
Code:
...
// Fetch bounds
X_MAX = disp.getDisplayCount() * disp.getDisplayWidth();
Y_MAX = disp.getDisplayHeight();
...
Logged

The Big Smoke
Offline Offline
Sr. Member
****
Karma: 0
Posts: 260
Hacking and Slashing
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Ops, done smiley-wink
Logged

Pages: 1 ... 20 21 [22] 23 24 25   Go Up
Jump to: