View previous topic :: View next topic |
Author |
Message |
kikoou
Joined: 25 Oct 2011 Posts: 10
|
|
Posted: Mon Feb 13, 2012 10:55 pm |
|
|
I'm sorry because I didn't mention that I'm using 20 matrix 8x8 to create my project. Thats why I need to use 74HC595 and thats why I need to use 3 pins from port C and 8 pins from B - no more. |
|
|
Lemosek
Joined: 15 Oct 2011 Posts: 36
|
|
Posted: Tue Feb 14, 2012 3:41 am |
|
|
Hello,
At may last post I suggest to see EX_EXPIO.c file.
You mast connect :
hc595 PIC
14 pin B2
11 pin B1
12 pin B0
Then if You include #include <74595.c>
You have nice function:
write_expanded_outputs (&data);
Variable data is 8 bit output state of 595.
Next You mast implement shift register to drive one column like 10000000 01000000 00100000 ...
So if you drive first column you must set 595 output (8 bit row) for this column.
This is simple
Best regards sorry for my English
R.L. |
|
|
Mike Walne
Joined: 19 Feb 2004 Posts: 1785 Location: Boston Spa UK
|
More than one matrix |
Posted: Tue Feb 14, 2012 5:16 am |
|
|
OK. You've moved the goal posts for us, but it does not change what I and others have said before. You still have to learn how to code in C.
I'm assuming your schematic for one matrix has become:-
Code: |
-----------------
RD7 -------WWW---------| o o o o o o o o |
RD6 -------WWW---------| o o o o o o o o |
RD5 -------WWW---------| o o o o o o o o |
RD4 -------WWW---------| o o o o o o o o |
RD3 -------WWW---------| o o o o o o o o |
RD2 -------WWW---------| o o o o o o o o |
RD1 -------WWW---------| o o o o o o o o |
RD0 -------WWW---------| o o o o o o o o |
-----------------
| | | | | | | |
RC7 --------------------- | | | | | | |
RC6 ----------------------- | | | | | |
RC5 ------------------------- | | | | |
RC4 --------------------------- | | | |
RC3 ----------------------------- | | |
RC2 ------------------------------- | |
RC1 --------------------------------- |
RC0 -----------------------------------
|
And for two:-
Code: |
From '595(0) row7 ------WWW------------------------------------
From '595(0) row6 ------WWW----------------------------------- |
From '595(0) row5 ------WWW---------------------------------- ||
From '595(0) row4 ------WWW--------------------------------- |||
From '595(0) row3 ------WWW-------------------------------- ||||
From '595(0) row2 ------WWW------------------------------- |||||
From '595(0) row1 ------WWW------------------------------ ||||||
From '595(0) row0 ------WWW----------------------------- |||||||
||||||||
----------------- |||||||| -----------------
From '595(1) row7 ------WWW------| o o o o o o o o | ||||||| ---| o o o o o o o o |
From '595(1) row6 ------WWW------| o o o o o o o o | |||||| ----| o o o o o o o o |
From '595(1) row5 ------WWW------| o o o o o o o o | ||||| -----| o o o o o o o o |
From '595(1) row4 ------WWW------| o o o o o o o o | |||| ------| o o o o o o o o |
From '595(1) row3 ------WWW------| o o o o o o o o | ||| -------| o o o o o o o o |
From '595(1) row2 ------WWW------| o o o o o o o o | || --------| o o o o o o o o |
From '595(1) row1 ------WWW------| o o o o o o o o | | ---------| o o o o o o o o |
From '595(1) row0 ------WWW------| o o o o o o o o | ----------| o o o o o o o o |
----------------- -----------------
| | | | | | | | | | | | | | | |
From '2803 column 7 ------------------------------------------------- | | | | | | |
| | | | | | | | | | | | | |
From '2803 column 6 --------------------------------------------------- | | | | | |
| | | | | | | | | | | |
From '2803 column 5 ----------------------------------------------------- | | | | |
| | | | | | | | | |
From '2803 column 4 ------------------------------------------------------- | | | |
| | | | | | | |
From '2803 column 3 --------------------------------------------------------- | | |
| | | | | |
From '2803 column 2 ----------------------------------------------------------- | |
| | | |
From '2803 column 1 ------------------------------------------------------------- |
| |
From '2803 column 0 ---------------------------------------------------------------
|
If you set things up for 20 lots of 8*8's and it sticks you'll be passing 160 times normal current through the LEDs which are lit. The one snippet of code you've shown is nowhere near able to drive just the one 8*8 matrix.
You have two choices for how you arrange your multiplexing. One puts most stress on the ULN2803 and 74HC595D the other. The ULN2803 is rated @ 500mA, the 74HC595D @ +/-35mA.
Where you put the resistors dictates which way round you do the multiplexing. You can save on resistor numbers by putting them in the cathode leads, but I'll let you ponder that one.
For the single matrix, directly connected to the PIC with anode resistors, as shown above, what you do is:-
(1) Make all the RCx pins high.
(2) Select which of RDx's are needed as high and low for column 0 (i.e. the one connected to RC0).
(3) Make RC0 low for a fixed time.
(4) Make all the RCx pins high.
(5) Select which of RDx's are needed as high and low for column 1 (i.e. the one connected to RC1).
(6) Make RC1 low for same fixed time as (3).
(7) Make all the RCx pins high.
.............. repeat until you've done column 7 then start again at (1)
If you can't do this on your own you'll struggle to drive 20 off 595's etc. Each of your 20 '595s has to do what I've outlined above for the row driver, but only one at a time and in turn.
I hope this is some help.
Mike
PS. As it stands you're in danger of running out of processor time to update your display at 100Hz. If you can spare the pins you could drive the 595 data input pins from individual PIC pins. That way you could speed up processing your 595s by a factor of at least 8.
Also I've assumed you propose using 20 off 595's? Suppose you wire your LEDs as a 5 by 4 matrix of 8*8 LEDs. That way you use 5 off 595's to drive the anodes and 4off 595's plus 4 off 2803's to drive the cathodes. This way uses fewer components, eases the current demand on your drivers and significantly reduces the multiplexing task.
Last edited by Mike Walne on Tue Feb 14, 2012 11:17 am; edited 1 time in total |
|
|
John P
Joined: 17 Sep 2003 Posts: 331
|
|
Posted: Tue Feb 14, 2012 8:47 am |
|
|
Depending on the size of the digits and how brightly you want them to be lit, you might need to add a source driver equivalent to the 2803, so both the anodes and the cathodes would have power drivers.
If each digit is an 8x8 matrix and there are 20 digits, overall that's 1280 LEDs to drive, and as Mike Walne said, most economically you'd probably want to wire it as 32x40, but then you'd get a 1/32 duty cycle, and that isn't much. If that won't work, you'd have to think of alternative ways to wire it.
But with the 595's connected to the processor's SPI port, I don't think there's much danger of running out of time. |
|
|
Mike Walne
Joined: 19 Feb 2004 Posts: 1785 Location: Boston Spa UK
|
Power and time issues |
Posted: Tue Feb 14, 2012 11:28 am |
|
|
Like John P hints there is a danger of you not having enough power, and like I said there is also a risk of you running out of processor time.
I don't want to waste time addressing irrelevant issues. Before I eleborate please answer the following questions:-
How many pins have you got available for your display?
Are you proposing using a string of 20 off 595's to drive your anodes?
What do you want your average lit LED current to be?
Mike |
|
|
asmboy
Joined: 20 Nov 2007 Posts: 2128 Location: albany ny
|
|
Posted: Tue Feb 14, 2012 1:58 pm |
|
|
Let me add that the code you submitted does NOT look like it owes its ANY of its provenance to the CCS framework l - rather - it looks like a lifted/translated MIKRO/HITEC/etc compiler source - barely adapted to follow a CCS header. |
|
|
kikoou
Joined: 25 Oct 2011 Posts: 10
|
|
Posted: Thu Feb 23, 2012 2:42 pm |
|
|
thx everybody because you inspired me to do a little program to light the letter P. But my problem now is to send my data on 595 data pins and how can I use correctly the 595. My program is:
Code: |
#include <16F877.H>
#use delay (clock=40000000)
main()
{
set_tris_b(0x00);
set_tris_d(0x00);
while (1)
{
//1
// Output_B (0X80);
//Output_d (0XFF);
// delay_us(100);
//2 //
// Output_B (0X40);
// Output_d (0X00);
//delay_us(100);
//3
//Output_B (0X20);
//Output_d (0X00);
// delay_us(100);
//4
///Output_B (0X10);
// Output_d (0XEE);
// delay_us(100);
//5
// Output_B (0X08);
// Output_d (0XEE);
//delay_us(100);
//6
//Output_B (0X04);
//Output_d (0XE0);
//delay_us(100);
//7
//Output_B (0X02);
//Output_d (0XF1);
// delay_us(100);
//8
//Output_B (0X01);
//Output_d (0XFF);
// delay_us(100);
}
} |
|
|
|
Mike Walne
Joined: 19 Feb 2004 Posts: 1785 Location: Boston Spa UK
|
Goal posts |
Posted: Thu Feb 23, 2012 3:42 pm |
|
|
You've moved the goal posts yet again. You started out by asking about coding for one digit. We answered your questions, so you then moved to 20 digits. Several of us have responded so you've returned to one digit. You are getting very infuriating.
The code you've posted does nothing, virtually all lines are commented out!!!!!!
I really was trying to help you. You posed a problem, I considered it and required answers to further questions. You've totally ignored me. I will do the same to you until I get a response. If you do not answer the questions in my previous post I will treat you with the same contempt that you are treating me.
Mike |
|
|
temtronic
Joined: 01 Jul 2010 Posts: 9221 Location: Greensville,Ontario
|
|
Posted: Thu Feb 23, 2012 5:53 pm |
|
|
Yup, amazing how the 'project' grows in leaps and bounds...
The simple,easy,FAST solution is to use 'distributed processing',21 PICs..1 master 20 slaves. Each 'slave' controls one 8by8 LED 'unit'.
Circuit Cellar Ink did a PIC article on them a decade(+-) ago. Heck probably by a PIC for not more than a 595 these days.
Simple to cut code for,easy to hookup,expandable to any reasonable number of 'units'.Makes power supply considerations a joke(use a PC supply).Someone out 'there' , probably makes/sells such units,but really the code is simply 20 copies and one controller.Figure a weekend for the clones and couple of days for the master....2-3 days to debug, heck whole thing 'up and running' in less than 2 weeks. |
|
|
asmboy
Joined: 20 Nov 2007 Posts: 2128 Location: albany ny
|
|
Posted: Thu Feb 23, 2012 6:05 pm |
|
|
a most interesting thread .
I suspect that any one of the five professionals who have weighed in on this could do a fine job of designing the support hardware and code to do this
task. And that in the process at least 2 and probably 3 workable approaches would be evident. But as this gives every indication of being a school learning project , the level of starting knowledge seems too low - and the goal too broad and fluid - for anybody to take seriously.
perhaps the poster hopes to one day make his or her living doing electronic engineering of this sort - and i sincerely wish the best of luck in that-
but i believe that everybody who has answered so far - would be embarrassed to have shown so little effort while asking so much
of others. Especially if this is schoolwork.
just my 2 cents |
|
|
Mike Walne
Joined: 19 Feb 2004 Posts: 1785 Location: Boston Spa UK
|
Please answer my questions |
Posted: Fri Feb 24, 2012 3:05 am |
|
|
Kikoou
You were TOLD on the SAME day as your first post that the CCS example shows you, with a fully coded example, exactly HOW to drive a '595 for this project.
I will elaborate AFTER you show me the courtesy of answering these two questions.
(1) Are you proposing using a string of 20 off 595's or arranging the 8 * 8 LEDs in a 4 * 5 array?
(2) What is your proposed average lit LED current?
Arranging 20 off 595's in serial string is the simplistic method, a 4 * 5 array requires a little more thought.
I am assuming that you do have actual hardware in front of you, and that this is not just some simulation exercise. You can get a feel for the current using one of your 8 * 8 matricees, a 5V power supply and a handful of resistors. Connect any cathode to the supply negative, and any anode to the supply positive via a 3k3 resistor. Look at the lit LED and decide if its too dim, OK or too bright. Adjust the resistor value until OK, then deduce / measure the current.
I may even explain how the '595 driver works but you MUST do your bit FIRST. You're insisting on the '595. You may have to consider temtronic's suggestion after I've outlined some of the hurdles that litter the path to your target.
For a newbie you are in grave danger of alienating all the guys on the forum who are in a position to help you.
I, for one, am rapidly running out of patience.
Mike |
|
|
|