|
|
View previous topic :: View next topic |
Author |
Message |
ccs_sch
Joined: 17 Oct 2003 Posts: 1
|
How can connect more than 10 74595 |
Posted: Fri Oct 17, 2003 2:56 pm |
|
|
I try to connect 10 (74595)
How can I send data to it.
I mean how can I on or off any LED connected to 74595
I connect 74595 as follows,
All Pin - 11 Connected together & With B1
All Pin - 12 Connected Together & with B0
All Pin - 8 Connected together with GND
All Pin - 16 & Pin - 10 Connected together with VCC
Pin - 9 of First IC connected to Pin - 14 of Next IC, & so on.
Pin - 14 of first IC connected to B2
I use PIC16F628 for this project.
My question is that, How can I on the 25th LED, etc.
what modification done in 74595.C dirver file
could anyone sned a sample code? |
|
|
Roger Courtney
Joined: 15 Oct 2003 Posts: 3 Location: Cleveland, Ohio
|
Re: How can connect more than 10 74595 |
Posted: Fri Oct 17, 2003 5:05 pm |
|
|
ccs_sch wrote: | I try to connect 10 (74595)
How can I send data to it.
I mean how can I on or off any LED connected to 74595
I connect 74595 as follows,
All Pin - 11 Connected together & With B1
All Pin - 12 Connected Together & with B0
All Pin - 8 Connected together with GND
All Pin - 16 & Pin - 10 Connected together with VCC
Pin - 9 of First IC connected to Pin - 14 of Next IC, & so on.
Pin - 14 of first IC connected to B2
I use PIC16F628 for this project.
My question is that, How can I on the 25th LED, etc.
what modification done in 74595.C dirver file
could anyone sned a sample code? |
Place data on B2.
cycle B1 to clock data into shift registers.
repeat until all data has shifted through (10x8=80 bits)
cycle b0 to clock data from shift register to output latches.
You will need to connect an output to pin 13, and hold it low to place the output latches onto the output. This can be tied to gnd if you want them on at all times.
You will need to refer to the data sheet for '595 to determine how long you need to hold each signal in each state when loading data and clocking. _________________ rnc |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Fri Oct 17, 2003 6:31 pm |
|
|
Here is some code I once used to test driving an 7-segment
LCD with five 74HC595 chips. I used a 16F628 for that project.
This is just a piece of the code. It's not the whole program.
Hopefully it will work in your application.
I've modified the pin numbers below, to match your
description. You should check it and verify it.
Code: | #define SDATA_PIN PIN_B2 // SER (pin 14 of first 74HC595)
#define SCLK_PIN PIN_B1 // SRCLK (pin 11 of all 74HC595)
#define RCLK_PIN PIN_B0 // RCLK (pin 12 of all 74HC595)
char data[5];
//================================
void main()
{
// Initialize the 74HC595 control pins.
output_low(SDATA_PIN);
output_low(SCLK_PIN);
output_low(RCLK_PIN);
// Send out 5 bytes of data to the chain of five
// 74HC595 chips.
send_byte(data[4]);
send_byte(data[3]);
send_byte(data[2]);
send_byte(data[1]);
send_byte(data[0]);
// After shifting out the data to the 74HC595 chips,
// issue a clock pulse to load it into the output registers
// inside those chips.
load_reg();
while(1);
}
//================================
// This function loads the output registers
// of all the 74HC595 chips.
void load_reg(void)
{
output_high(RCLK_PIN); // Make a positive clock pulse
output_low(RCLK_PIN);
}
//-------------------------------------
// This function sends one byte to the chain of
// 74HC595 shift registers.
void send_byte(char data)
{
char i;
for(i = 0; i < 8; i++) // Send 8 bits
{
if(data & 0x80)
{
output_high(SDATA_PIN);
}
else
{
output_low(SDATA_PIN);
}
output_high(SCLK_PIN); // Make a positive clock pulse
output_low(SCLK_PIN);
data <<= 1; // Get next bit into MSB position
}
} |
|
|
|
kamyip
Joined: 14 Oct 2003 Posts: 10
|
|
Posted: Fri Oct 17, 2003 11:05 pm |
|
|
If your are using 74595 to display Leds and lots of them, than I suggest you looks into using SAA1064 i2c chip. One SAA1064 allows you to control 16 leds and if you use two of them in matrix, you would be able to control 256 leds! All this just by using 2 pin ie SDA and SCL. |
|
|
elphi
Joined: 17 Apr 2007 Posts: 20 Location: tijuana,bajacalifornia,mexico
|
|
Posted: Mon Jun 08, 2009 1:00 am |
|
|
Hi PCM Programmer, I have used this code to handle 10 seven segments displays, and I make a entire system and it work ok, so I am making a second system, this time it has only 8 displays, but it is working with a very unusual bug, if I send 10 diferent values (e.g 12345678), but when I sent 8 values of the same value (e.g. 11111111), the display show a lot of garbage, do you have any idea of why I have this bug in my system.
I have modificated the code you have built to display 7 segments values, ad I make a source file to be called for the main file each time it has to display new values, the source file is shown below:
Code: |
void send_byte(int num)
{
int data;
char i;
switch(num){
case 0:data=63;break;
case 1:data=6;break;
case 2:data=91;break;
case 3:data=79;break;
case 4:data=102;break;
case 5:data=109;break;
case 6:data=125;break;
case 7:data=7;break;
case 8:data=127;break;
case 9:data=103;break;
case '0':data=63;break;
case '1':data=6;break;
case '2':data=91;break;
case '3':data=79;break;
case '4':data=102;break;
case '5':data=109;break;
case '6':data=125;break;
case '7':data=7;break;
case '8':data=127;break;
case '9':data=103;break;
default: data=0;
}
for(i = 0; i < 8; i++) // Send 8 bits
{
if(data & 0x80)
{
output_high(SDATA_PIN);
}
else
{
output_low(SDATA_PIN);
}
output_high(SCLK_PIN); // Make a positive clock pulse
output_low(SCLK_PIN);
data <<= 1; // Get next bit into MSB position
}
}
void load_reg(void)
{
output_high(RCLK_PIN); // Make a positive clock pulse
output_low(RCLK_PIN);
}
void init595()
{
output_low(SDATA_PIN);
output_low(SCLK_PIN);
output_low(RCLK_PIN);
}
|
and this a piece of the main code, the part of the code that calls the 749595:
Code: |
void todsp()
{
init595();
for(i=0;i<=7;i++)
{
if(num[i]==32)num[i]=15;//this code is to convert “spaces” in blank displays
}
numd[7]=num[0];
numd[6]=num[1]+10;
numd[5]=num[2];
numd[4]=num[3];
numd[3]=num[4];
numd[2]=num[5]+10;
numd[1]=num[6];
numd[0]=num[7];
for(i=0;i<=7;i++)
{
send_byte(15);//before sent the desires values I send 8 blanks to clear the displays
}
load_reg();
for(i=0;i<=7;i++)
{
send_byte(numd[i]);//now I send each digit.
}
load_reg();
for(i=0;i<=7;i++)
{
if(num[i]==15)num[i]=32;
}
}
|
I hope you can help me because I don understand why this bug is only in this system and not in my first system, the only difference between the first and the second system is that the first one has 10 digits and the second one has only 8. _________________ Every little thing gonna be alright |
|
|
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Mon Jun 08, 2009 11:51 am |
|
|
Disconnect the last two 74595 chips on your new board, and connect it
to be the same as your previous board. Also use the software for your
previous board. Then see if it works. |
|
|
elphi
Joined: 17 Apr 2007 Posts: 20 Location: tijuana,bajacalifornia,mexico
|
|
Posted: Tue Jun 09, 2009 8:13 pm |
|
|
Thanks PCM Programmer, I found the solution, it was the wire, I have 16 PCB, with 7 segments x 12 LED's each segment, so I wasn’t working in a PCB, they were wired one by one with wire, so I was using an inappropriate wire, so if some one needs to do some similar, be advise, you better use UTP cable or some similar one, you can't imagine how much is the difference if you don’t use the appropriate wire. _________________ Every little thing gonna be alright |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|