LED Matrix help

This is the English forum for all topics related to IO-Warrior. Please post in English only

Moderator: Guido Körber

Jon
Posts: 42
Joined: Thu Jul 06, 2006 12:43 pm
Location: downUNDER

Post by Jon »

Guido,
Thanks for taking the time to look at my board. I have made the suggested changes;
- added 'smoothing/filter' capacitor on 74hc595
- moved the cap on the Warrior,
- used a ceramic resonator
But I am still getting the same results.

Is there any way to examine the data coming from the warrior i.e. P1.0 - P1.3 without using a CRO (I dont have access to one) and check that it is OK there?

Has anyone sucsessfully built a matrix using the 74HC595?

Below is a link to the Express PCB files I created(removed), so that others may examine them and see if they can spot where I may be going wrong. You will need to d/l and install PCB express from http://www.expresspcb.com which I have found to be a great free tool for PCB design. Link the PCB to the circuit, and it even checks the connections, which is why I cant understand why It wont work.

Running out of ideas.........

Jon

Edit : Files removed because they are incorrect
Last edited by Jon on Tue Sep 12, 2006 1:39 am, edited 1 time in total.
Guido Körber
Site Admin
Posts: 2856
Joined: Tue Nov 25, 2003 10:25 pm
Location: Germany/Berlin
Contact:

Post by Guido Körber »

We have done such a matrix, it is really straight forward.

Are you sure you have wired the LEDs correctly to the circuit?
Jon
Posts: 42
Joined: Thu Jul 06, 2006 12:43 pm
Location: downUNDER

Post by Jon »

Guido Körber wrote:
Are you sure you have wired the LEDs correctly to the circuit?
Well,
If I power the LED anodes (common) and then ground each pin of the outputs on each of the 5821's the correct segment (A-dp) of the display lights correctly for each display, so I guess I have.

Yet, when I send 0,01100000,00000000,00000000,00000000, which should display "1"
I get the result.......00000010,00000000,00000000,00000000, which displays "-"
Same if I send it to bytes 3,4,or 5 of this row.

Maybe its my code? Is what I have earlier in this thread correct?
Guido Körber
Site Admin
Posts: 2856
Joined: Tue Nov 25, 2003 10:25 pm
Location: Germany/Berlin
Contact:

Post by Guido Körber »

Can you send the circuit schematic as PDF?

The program does not help a lot, I use Windows only for a small part of my work...

Did you try to send the data by using the SimpleHIDwrite program? That would remove any possible coding error.
Jon
Posts: 42
Joined: Thu Jul 06, 2006 12:43 pm
Location: downUNDER

Post by Jon »

The circuit schematic is included as a bmp file within the zip that I have linked to above. I cant convert it to pdf here at work, but will do so this evening.

Will look into the SimpleHIDwrite program this evening as well.

Thanks again
Jon
Jon
Posts: 42
Joined: Thu Jul 06, 2006 12:43 pm
Location: downUNDER

Post by Jon »

pdf of schematic added to zip file and aslo emailed to you Guido.

I also get exactly the same results using the SimpleHIDwrite program

Jon
wayoda
Posts: 362
Joined: Fri Dec 19, 2003 12:00 pm
Location: Wuppertal/Germany

Post by wayoda »

Hello Jon,


I had a quick look at your schematic and was wondering about the value of the resistors R17-R48 which limit the current through the Leds.

The resistors are stated with 470 Ohms and the Led-Supply is 5V.

The datasheets of 7-Segment Display I looked at (Kingbright) all state a Forward-Voltage of at least 1.7V depending on the color. Most of them are around 2V-2.5V.

If we take the median (2V) and calculate the current through the segments at a 5V supply we end up with a current through the individual segments of:

Code: Select all

I=(SupplyVc -FowardV)/470 Ohms
I=(5V-2V)/470Ohms=6,3mA
Which is already not very bright.

If we look at the formula in ApplicationNote for the Led-Matrix on page 2 to calculate to resulting current we get (DriverV being the Voltage stated as Vfddriver):

Code: Select all

I=(SupplyVc-ForwardV-DriverV)/470Ohms
I asked Guido for a hint where I could find this DriverV in the datasheet for the MIC5821 and he pointed me to the Collector-Emitter Staturation Voltage which would be 1.3V at 100mA (=12.5mA for each segment in a single display)

For the BD137 the datasheet states a value of 0.5V at 500mA.
So if I get this right we should end up with a DriverV=1.3+0.5=1.8V
This leads to a current of

Code: Select all

I=(5V-2V-1.8V)/470Ohms = 3mA
Which should already be rather dark.

Could it be that you probably not see the lighted segments in a bright environment?

The other thing that made me curious were the resistors at the Base of the BD137.
They are at 4.7 kOhms.
It is beyond my knowledge about semiconductors to calculate the current that must go into the base of a transistor to drive a specific current at its output, but could it be that the current into the base is too low (Resistors R1-R8) to drive enough current for the displays ?

Eberhard
Jon
Posts: 42
Joined: Thu Jul 06, 2006 12:43 pm
Location: downUNDER

Post by Jon »

Thanks for the detailed reply Eberhard.
While I agree that these R values are probably not correct, they do work, and the displays are not so dull that I cant see them. I'm getting quite a good light from the LEDs.
The result I get is the same for each segment whether I have 1 display or all 4 displays lit, so I doubt, altho I wont dismiss, that the current driving the displays is too low.
My guess is that there is something wrong with the data coming from the Warrior, or that there is something wrong with the input wiring to the 5821's, but I cant spot it. There are no stray solder joins either.

Jon
Guido Körber
Site Admin
Posts: 2856
Joined: Tue Nov 25, 2003 10:25 pm
Location: Germany/Berlin
Contact:

Post by Guido Körber »

Had a look at your schematic too. It looks OK so far, except for the resistor values as pointed out.

I can aussure you that there is nothing wrong with the data coming off the IO-Warrior we do have demos running with scrolling text and blinkenlights running on 32x8 LED matrixes.

Can you please again give an exact description of the data you are writing to the IO-Warrior and the result you see? Also knowing how you wired the displays to the drivers would be good.
wayoda
Posts: 362
Joined: Fri Dec 19, 2003 12:00 pm
Location: Wuppertal/Germany

Post by wayoda »

Then maybe you could try to mimic the Led-Matrix function by Hand.

I did the same procedure once for an SPI-Device that didn't seem to work porperly.

The general idea is:
You do not use the SpecialMode for the Led-Matrix, you send the data by switching the pins from a plain IO-write directly. You should end up with static data on the segments in the matrix:

You will have to write a small program to do this which in semi-code could look like

Code: Select all

//we send 16 bits of data to the matrix serially in order to light up a single led
//in the matrix
int data [1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0];

byte port1data;

//set output-enable P1.0 to high; strobe P1.1 to low;  clock P1.2 to low
//the data for port 1 should be [00000001]
port1data=0x01;
//we dont care for the data on port 0 (0x00)
port0data=0x00;

write(port0data,port1data);
for(int i=0;i<data.length;i++) {
  //now set the data to be written P1.3
  if(data[i]==1) {
     port1data=port1data | 0x08;  //send a 1 from serial data
   }
   else {
     port1data=port1data | 0xF7;  //send a 0 from serial data
   }
   write(port0data,port1data)
   //keeping the data to be send intact we mimic a clock
   port1data=port1Data | 0x04; // mimic a rising clock signal
   write(port0data,port1data)
   port1data=port1Data | 0xFB; //mimic a falling clock signal
   write(port0data,port1data)
}
//now latch the serial data into the registers strobe high, OE high
port1data=0x03;
write(port0data,port1data);
//and enable the outputs OE low
port1data=0x00;
write(port0data,port1data);

I hope you get the idea?

Edit
Forgot you have a full matrix.
You need to shift out 5 bytes (40 vlaues) so in the above code it shuld read

Code: Select all

//we send 40 bits of data to the matrix serially in order to light up a single led
//in the matrix
int data [1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0];
End Edit


Eberhard
Jon
Posts: 42
Joined: Thu Jul 06, 2006 12:43 pm
Location: downUNDER

Post by Jon »

OK, first the connection of the displays.

Using my schematic as a reference.....


Resistor .......... segment
17.....................a
18.....................b
19.....................c
20.....................d
21.....................e
22.....................f
23.....................g
24.....................h

25.....................a
26.....................b
27.....................c
28.....................d
29.....................e
30.....................f
31.....................g
32.....................h

33.....................a
34.....................b
35.....................c
36.....................d
37.....................e
38.....................f
39.....................g
40.....................h

41.....................a
42.....................b
43.....................c
44.....................d
45.....................e
46.....................f
47.....................g
48.....................h

where the display has segments

aaaaaa
f...........b
f...........b
f...........b
.gggggg
e...........c
e...........c
e...........c
.dddddd....hh

OK now for the data;

Using the SimpleHIDwrite program;
data sent ...................................... segements displayed (display/segment)
W 15 00 00 00 00 00 00 00............. none
W 15 00 FF 00 00 00 00 00............. 1/bcdefg
W 15 00 FF FF 00 00 00 00............. 1/bcdefgh 2/abcdefgh
W 15 00 FF FF FF 00 00 00 ............. 1/bcdefgh 2/abcdefgh 3/abcdefgh
W 15 00 FF FF FF FF 00 00 ............. 1/bcdefgh 2/abcdefgh 3/abcdefgh 4/abcdefgh
W 15 00 00 FF FF FF 00 00 ............. 2/bcdefgh 3/abcdefgh 4/abcdefgh


W 15 00 60 60 60 60 00 00 ............. 1/g 2/g 3/g 4/g

try each segment (a-h)
W 15 00 80 00 00 00 00 00............. none
W 15 00 40 40 40 40 00 00............. none
W 15 00 00 40 40 40 00 00 ............. none
W 15 00 20 20 20 20 20 00 ............. none
W 15 00 10 10 10 10 00 00 ............. none
W 15 00 08 08 08 08 00 00 ............. none
W 15 00 FF 08 08 08 00 00 ............. 1/bcdefg
W 15 00 04 04 04 04 00 00 ............. none
W 15 00 02 02 02 02 00 00 ............. none
W 15 00 01 01 01 01 00 00 ............. none

Now data to try and draw digits.......(1,2,3,8)
W 15 00 60 DA F2 FE 00 00 ............. 1/g 2/eh 3/fgh 4/cdefgh

Are there any other specifics you need me to try?
Guido Körber
Site Admin
Posts: 2856
Joined: Tue Nov 25, 2003 10:25 pm
Location: Germany/Berlin
Contact:

Post by Guido Körber »

Try what wayoda did suggest: Shifting the bits manually into the matrix. That way you will have a static driving situation where you can check what ends up in the shift registers.
Jon
Posts: 42
Joined: Thu Jul 06, 2006 12:43 pm
Location: downUNDER

Post by Jon »

I can understand the logic to the code, but dont understand a few things.

Is write() an api call?
How does my code know to send that data to the warrior. I must have to initialise it first.

Sorry about this, but I feel I'm starting to get in over my head!
wayoda
Posts: 362
Joined: Fri Dec 19, 2003 12:00 pm
Location: Wuppertal/Germany

Post by wayoda »


Is write() an api call?
How does my code know to send that data to the warrior. I must have to initialise it first.
The explanation was maybe a little broad, sorry. I also made the mistake assuming you were using an IOWarrior24.

What I meant by write() was writing data to the IO-Pins of the device, like when you want to switch a simple Led on and off.

You do not enable the Led-Matrix mode for this

So write stands for ( in "C" don't know anything about VB)

Code: Select all

char buffer[5];

buffer[0]=0x00; //the report-id for writing to IO-Pins
buffer[1]=0x00;  //this is the data for port0, we are not interested in this
buffer[2]=0x0?; //we only need the 4 lower bits on this port 
buffer[3]=0x00;  //this is the data for port2, we are not interested in this
buffer[5]=0x00;  //this is the data for port3, we are not interested in this

// the values we need in buffer[2] are:
//0x08 = when this bit is High we have a 1 in the serial data
//0x04 = when this bit moves from Low to High the chips will read the data that is currently at the Serial-In connector into the register.
//0x02 = when this bit moves from Low to High the chips will move the data in the serial register into their output register
//0x01 = when this bit goes to low the serial data will appear at the outputs of the chips.

//now for the serial data we write that is an array of 40 values
//the first 32 values will go into MIC5821 the last 8 values will select the
//row to be switched on in the 74595
int serialdata[40];
//this is for the first 8 values the will go into U6 when written to your board
serialdata[0]=0;
serialdata[1]=0;
serialdata[2]=0;
serialdata[3]=0;
serialdata[4]=0;
serialdata[5]=0;
serialdata[5]=0;
serialdata[7]=1;   //this should enable the segment connected to pin 16 on the mic5821

//now you do the same for the other 3 MIC5821
//serialdata[8]=0;
//...
//..
//serialdata[31]=1;

//now we have to enable the rows in the 74595
//for a start we enable every row int the matrix i.e. we switch on all the transistors
//on the MIC5821 only 1 output is enabled, so on each display only a single segment should light up.
serialdata[32]=1;
serialdata[33]=1;
serialdata[34]=1;
serialdata[35]=1;
serialdata[36]=1;
serialdata[37]=1;
serialdata[38]=1;
serialdata[39]=1;

//now we initialize the whole thing by setting the strobe-signal to low; clock to low ; output-enable to high
buffer[2]=0x01;

IowKitWrite(handle,0,buffer,5);
//now the loop to shift out all the data into your board
for(int i=0;i<40;i++) {
  //set the databit in the buffer using the bitwise logical operators
  if(serialdata[i]==1) {
    //We want to write a HIGH data so we set bit 4 in the buffer
    buffer[2] = buffer[2] | 0x08;
  }
  else {
    //We want to write a low data so we set bit 4 in the buffer to 0
    buffer[2] = buffer[2] & 0xF7;
  }
  //now switch Pin 1.3 according to the data just set
  IowKitWrite(handle,0,buffer,5);
  
  //and now switch on Pin 1.2 your board will recognize this as a Clock signal
  // and read the data at Pin 1.3 into its register
  buffer[2] = buffer[2] | 0x04;
  IowKitWrite(handle,0,buffer,5);

  //now rest the clock bit for the next loop
   buffer[2] = buffer[2] & 0xFB;
  IowKitWrite(handle,0,buffer,5);
}

//at this point all 40 data bits should be written to the board
//now set the strobe signal so the chips read the serial data into their output registers
buffer[2]=0x03;
IowKitWrite(handle,0,buffer,5);

// last thing to do is to enable the outputs
buffer[2]=0x00;
IowKitWrite(handle,0,buffer,5);

That should be it.

There were some errors in the pseudo-code form my other posting concerning the bitwise operations.

Gotten any clearer ?

Eberhard
Jon
Posts: 42
Joined: Thu Jul 06, 2006 12:43 pm
Location: downUNDER

Post by Jon »

Yeap, I can understand that now :D You have explained that very well.

I will try it later this evening.
Post Reply