Show Posts
Pages: 1 ... 18 19 [20] 21
286  Forum 2005-2010 (read only) / Interfacing / Re: SureElectronics 3216 Led Matrix on: December 20, 2010, 09:44:17 pm
florinc,

do you have an idea of how to only plot after check shadowram value to see if it's already there?

at plot function:
Code:
   case GREEN:
      // clear the bit in both planes;
      ht1632_shadowram[addr][nChip-1] |= bitval;
      ht1632_senddata(nChip, addr, ht1632_shadowram[addr][nChip-1]);
      addr = addr + 32;
      ht1632_shadowram[addr][nChip-1] &= ~bitval;
      ht1632_senddata(nChip, addr, ht1632_shadowram[addr][nChip-1]);
      break;

Is it possible to change this to only plot after check shadowram and see if it's already there? I'm trying to do this because to rewrite all display each second is slow(last more than 1 second on my code).

My loop is this way:
Code:
void loop ()
{
  byte second, minute, hour, dayOfWeek, dayOfMonth, month, year;
  getDateDs1307(&second, &minute, &hour, &dayOfWeek, &dayOfMonth, &month, &year);
  
  char STRING1[ ]="        ";
  char STRING2[ ]="        ";
  sprintf(STRING1, "%02d/%02d/%02d", dayOfMonth, month, year);
  sprintf(STRING2, "%02d:%02d:%02d", hour, minute, second);
  
  int x,i,j;
  for(x=1;x<sizeof(STRING1);x++) {
    null_buffer();
    for(i=0;i<8;i++){
      for(j=0;j<8;j++){
        set_buffer(STRING1[x-1]);
        if (~buffer[i][j] & (1<<0)) {
          ht1632_plot(j+(8*(x-1))-1,i,RED);
        } else {
          ht1632_plot(j+(8*(x-1))-1,i,BLACK);
        }
      }
    }
  }
  for(x=1;x<sizeof(STRING2);x++) {
    null_buffer();
    for(i=0;i<8;i++){
      for(j=0;j<8;j++){
        set_buffer(STRING2[x-1]);
        if (~buffer[i][j] & (1<<0)) {
          ht1632_plot(j+(8*(x-1))-1,i+8,GREEN);
        } else {
          ht1632_plot(j+(8*(x-1))-1,i+8,BLACK);
        }
      }
    }
  }
  delay(1000);
}

(I don't know if you understand, my english is not that good, sorry)
287  Forum 2005-2010 (read only) / Interfacing / Re: SureElectronics 3216 Led Matrix on: December 20, 2010, 08:33:36 pm
date/clock on 3216:


I'm cleaning my code and I'll update the playground page when I finish.

Thank you all guys!
288  Forum 2005-2010 (read only) / Interfacing / Re: SureElectronics 3216 Led Matrix on: December 20, 2010, 11:30:19 am
florinc... I make your code to work with dual display(8 chips and 64/16). I have to modify the plot function:
Code:
 if (x>=32) {
    nChip = 3 + x/16 + (y>7?2:0);
  } else {
    nChip = 1 + x/16 + (y>7?2:0);
  }

Video showing bouncy line here:

I posted the video in 720p, give a second to youtube make the higher resolutions videos available.
289  Forum 2005-2010 (read only) / Interfacing / Re: SureElectronics 3216 Led Matrix on: December 19, 2010, 11:01:46 pm
your code is much better than mine.

I made it this way with char val as parameter to check if I need to clean the led when I call the function using val as 0:
Code:
void ht1632_plot (byte x, byte y, char val, byte color)
{
  if (x<0 || x>X_MAX || y<0 || y>Y_MAX)
    return;
  
  if (color != BLACK && color != GREEN && color != RED && color != ORANGE)
    return;
  
  byte nChip = 1 + x/16 + (y>7?2:0) ;
  
  x = x % 16;
  y = y % 8;
  byte addr = (x<<1) + (y>>2);
  byte bitval = 8>>(y&3);  // compute which bit will need set
  switch (color)
  {
    case BLACK:
      // clear the bit in both planes;
      ht1632_shadowram[addr][nChip-1] &= ~bitval;
      ht1632_senddata(nChip, addr, ht1632_shadowram[addr][nChip-1]);
      addr = addr + 32;
      ht1632_shadowram[addr][nChip-1] &= ~bitval;
      ht1632_senddata(nChip, addr, ht1632_shadowram[addr][nChip-1]);
      break;
    case GREEN:
      // set the bit in the green plane and clear the bit in the red plane;
      if (val) {
        ht1632_shadowram[addr][nChip-1] |= bitval;
      } else {
        ht1632_shadowram[addr][nChip-1] &= ~bitval;
      }
      ht1632_senddata(nChip, addr, ht1632_shadowram[addr][nChip-1]);
      addr = addr + 32;
      ht1632_shadowram[addr][nChip-1] &= ~bitval;
      ht1632_senddata(nChip, addr, ht1632_shadowram[addr][nChip-1]);
      break;
    case RED:
      // clear the bit in green plane and set the bit in the red plane;
      ht1632_shadowram[addr][nChip-1] &= ~bitval;
      ht1632_senddata(nChip, addr, ht1632_shadowram[addr][nChip-1]);
      addr = addr + 32;
      if (val) {
        ht1632_shadowram[addr][nChip-1] |= bitval;
      } else {
        ht1632_shadowram[addr][nChip-1] &= ~bitval;
      }
      ht1632_senddata(nChip, addr, ht1632_shadowram[addr][nChip-1]);
      break;
    case ORANGE:
      // set the bit in both the green and red planes;
      if (val) {
        ht1632_shadowram[addr][nChip-1] |= bitval;
      } else {
        ht1632_shadowram[addr][nChip-1] &= ~bitval;
      }
      ht1632_senddata(nChip, addr, ht1632_shadowram[addr][nChip-1]);
      addr = addr + 32;
      if (val) {
        ht1632_shadowram[addr][nChip-1] |= bitval;
      } else {
        ht1632_shadowram[addr][nChip-1] &= ~bitval;
      }
      ht1632_senddata(nChip, addr, ht1632_shadowram[addr][nChip-1]);
      break;
  }
}

this way the code works with some samples I have here(bouncyline, cross, bres_line, randomwalk, ...).

now I need to figure out how to display characters and scrolling. but I'll try it tomorrow. it's too late in Brazil(02:00 am)! smiley

Thank you florinc!
290  Forum 2005-2010 (read only) / Interfacing / Re: SureElectronics 3216 Led Matrix on: December 19, 2010, 10:33:28 pm
I think I made it!  ;D
Code:
void plot2(char x, char y, char val, char color)
{
  char addr, bitval;
  unsigned int display;

  ASSERT(x >= 0);
  ASSERT(x <= X_MAX);
  ASSERT(y >= 0);
  ASSERT(y <= y_MAX);

  if (x<16 && y<8) {
    display = 1;
  } else if (x>=16 && y<8) {
    display = 2;
    x = x-16;
  } else if (x<16 && y>=8) {
    y = y-8;
    display = 3;
  } else if (x>=16 && y>=8) {
    x = x-16;
    y = y-8;
    display = 4;
  }
  addr = (x<<1) + (y>>2);  // compute which memory word this is in
  bitval = 8>>(y&3);  // compute which bit will need set
  if (color==2)
    addr = addr+0x20;
  if (val) {  // Modify the shadow memory
    ht1632_shadowram[addr] |= bitval;
  }
  else {
    ht1632_shadowram[addr] &= ~bitval;
  }
  // Now copy the new memory value to the display
  ht1632_senddata(display, addr, ht1632_shadowram[addr]);
  if (color==3)
    ht1632_senddata(display, addr+0x20, ht1632_shadowram[addr+0x20]);
}
291  Forum 2005-2010 (read only) / Interfacing / Re: SureElectronics 3216 Led Matrix on: December 19, 2010, 09:12:16 pm
I setup a page on playground wiki to organize the things when it's finished:
http://www.arduino.cc/playground/Main/HT1632C
292  Forum 2005-2010 (read only) / Interfacing / Re: SureElectronics 3216 Led Matrix on: December 19, 2010, 08:49:18 pm
I'm very bad dealing with hex, bit in C.

I made an address, value mapping to help:
Code:
                               // x,y
  ht1632_senddata(1, 0x0, 0x8); // 0,0
  ht1632_senddata(1, 0x2, 0x8); // 1,0
  ht1632_senddata(1, 0x4, 0x8); // 2,0
  ht1632_senddata(1, 0x6, 0x8); // 3,0
  ht1632_senddata(1, 0x8, 0x8); // 4,0
  ht1632_senddata(1, 0xa, 0x8); // 5,0
  ht1632_senddata(1, 0xc, 0x8); // 6,0
  ht1632_senddata(1, 0xe, 0x8); // 7,0
  
  ht1632_senddata(1, 0x0, 0x8+0x4); // 0,1
  ht1632_senddata(1, 0x0, 0x8+0x4+0x2); // 0,2
  ht1632_senddata(1, 0x0, 0x8+0x4+0x2+0x1); // 0,3
  ht1632_senddata(1, 0x1, 0x8); // 0,4
  ht1632_senddata(1, 0x1, 0x8+0x4); // 0,5
  ht1632_senddata(1, 0x1, 0x8+0x4+0x2); // 0,6
  ht1632_senddata(1, 0x1, 0x8+0x4+0x2+0x1); // 0,7
  
  ht1632_senddata(1, 0x3+0x20, 0x1); // 1,7 RED
  ht1632_senddata(1, 0x5+0x20, 0x1); // 2,7 RED
  ht1632_senddata(1, 0x7+0x20, 0x1); // 3,7 RED
  ht1632_senddata(1, 0x9+0x20, 0x1); // 4,7 RED
  ht1632_senddata(1, 0xb+0x20, 0x1); // 5,7 RED
  ht1632_senddata(1, 0xd+0x20, 0x1); // 6,7 RED
  ht1632_senddata(1, 0xf+0x20, 0x1); // 7,7 RED

I didn't know how to write the plot function smiley-sad

Also, we can make this function like this:
Code:
void plot2(char x, char y, char val, char color)
293  Forum 2005-2010 (read only) / Interfacing / Re: SureElectronics 3216 Led Matrix on: December 19, 2010, 06:10:12 pm
It works! Thanks.

Now I'll try to rewrite the plot function to select the correct chip. After this I have 2 3216 so I'll connect both and try to control 8 HT1632C.
294  Forum 2005-2010 (read only) / Interfacing / Re: SureElectronics 3216 Led Matrix on: December 19, 2010, 06:01:07 pm
I'll appreciate the code!  ;D

I tried to rewrite the chipselect function too but without success.
295  Forum 2005-2010 (read only) / Interfacing / Re: SureElectronics 3216 Led Matrix on: December 19, 2010, 05:45:27 pm
Quote
I am having problems with selecting the chip that is supposed to receive the data/command. Basically, all commands/data I send go to all chips at once.
I'm with the same problem here.

I didn't understand the datasheet. If I have more than one HT1632C how do I select the chip I want to control? Cycle the CLK pin? I tried to do this then I went to this problem(all commands/data goes to all chips).
296  Forum 2005-2010 (read only) / Interfacing / Re: SureElectronics 3216 Led Matrix on: December 18, 2010, 09:41:08 pm
I think I found the trick in http://forums.parallax.com/showthread.php?117423-Electronics-I-O-(outputs-to-common-anode-RGB-LED-matrix)-question/page4:

The HT1632_CMD_MSTMD in HT1632 sets the IC to master mode. But in the new HT1632C it sets it to slave, so to set master mode on the new HT1632C you have to change HT1632_CMD_MSTMD to HT1632_CMD_RCCLK in initialization code of all this 0832, 2416 arduino codes/libraries already available.

I'm without my arduino stuff here(I'm traveling) so I can't test it. I'll try it tomorrow.
297  Forum 2005-2010 (read only) / Interfacing / Re: SureElectronics 3216 Led Matrix on: December 18, 2010, 01:44:59 pm
Quote
See the Parallax forum for the latest link to my software:

http://forums.parallax.com/showthread.php?128037-Sure-Electronics-new-32x16-bi-c...

You can open the *.sxb file with any text editor such as Notepad.

I'll try to make an arduino code from this.

Thank you!
298  Forum 2005-2010 (read only) / Interfacing / SureElectronics 3216 Led Matrix on: December 17, 2010, 11:46:55 am
If you buy a P4 32X16 RG Bicolor LED Dot Matrix Unit Board SPI Like from sureelectronics, you'll note that it does not work with any existing arduino code.

In this thread we'll discuss and try to make a working library and all hardware connections.

westfw said in http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1225239439/354:
Quote
This board uses the same HT3216 driver chip as the other boards that have been under discussion here, so it is no more "true SPI" that those (and no less.  When I wrote the first sample code, the main reason for avoiding existing SPI libraries is that the chip commands were of unusual lengths (not a multiple of 8 bits.)  (The "sample" code in Sure's documentation only seems to use the HW SPI support for some of the early initialization of the display.)

The 32x16  has FOUR of the HT3216 controllers, with each one driving the LEDs (red and green) in only two of the 8x8 arrays, so the mapping to dots is going to be significantly different.  And you have to figure out which one to write to, and how.  And deal with the multiple colors somehow.  The existing code between the "draw a dot" logic and above the "send a command to an HT1632" is probably pretty useless.
299  Forum 2005-2010 (read only) / Interfacing / Re: Arduino to 384 LED display module (MCU Interface) on: December 17, 2010, 11:32:11 am
I'll open another thread in this forum to the "group" development of 3216 library.

[edit]
New thread for 3216 things:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1292604415/0
[/edit]
300  Forum 2005-2010 (read only) / Interfacing / Re: Arduino to 384 LED display module (MCU Interface) on: December 17, 2010, 12:01:32 am
I received two 3216 LED display and there is no way to make any library or code in this forum make it work.

This board has a true SPI interface so the "old" ones makes it incompatible?

I just get garbage on screen. Do you guys have any idea how I fix this or how do I start fixing the libraries?
Pages: 1 ... 18 19 [20] 21