Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] please help==>74HC595

Status
Not open for further replies.
when i used the one that u said, it shows on 4 segments 1111,2222,3333,4444. while rc1,rc2,rc3 are OFF

 

Hi,
Change this part to this:
Code:
do{
   for(i=0;i<4;i++){
   PORTC = 0 ;////This is the port which has the common cathodes connected to it via transistor
   PORTb = mask(disp[i]); ///////'This is the data port
   //PORTC.f(i) = 1; ////////////////'RC0 = 1st display, RC3 = 4th display
   PORTC| = (1<<i);//
   delay_ms(10); /////////////'Delay between successive changing. If other stuff are to be done during this time, use timer for delay
   }
}while(1);

Hope this helps.
Tahmid.

---------- Post added at 19:39 ---------- Previous post was at 19:39 ----------

Hi,
Try this:
Code:
unsigned short mask(unsigned short num) {
switch (num) {
case 0 : return 0x3F;
case 1 : return 0x06;
case 2 : return 0x5B;
case 3 : return 0x4F;
case 4 : return 0x66;
case 5 : return 0x6D;
case 6 : return 0x7D;
case 7 : return 0x07;
case 8 : return 0x7F;
case 9 : return 0x6F;
} //case end
}//~




unsigned short temp,disp[]={1,2,3,4},i ;
void main() {
adcon1=7;

//ansel=0;
//anselh=0;
INTCON = 0;
//C1ON_bit = 0; // Disable comparators
//C2ON_bit = 0;
PORTB=0;
TRISB=0;
portc=0;
trisc=0;

disp[0]=1;
disp[1]=2;
disp[2]=3;
disp[3]=4;
do{
   for(i=0;i<4;i++){
   PORTC = 0 ;////This is the port which has the common cathodes connected to it via transistor
   PORTb = mask(disp[i]); ///////'This is the data port
   //PORTC.f(i) = 1; ////////////////'RC0 = 1st display, RC3 = 4th display
   PORTC| = (1<<i);//
   delay_ms(10); /////////////'Delay between successive changing. If other stuff are to be done during this time, use timer for delay
   }
}while(1);
}

Hope this helps.
Tahmid.

---------- Post added at 19:40 ---------- Previous post was at 19:39 ----------

Hi,
Let me know the results and I'll explain the problems.

Tahmid.
 
no wait
i changed the delay_ms(10)to delay_ms(1000)
now rc0 and rc1 and rc2 and rc3 are working sequentially but all segments are working 1111.2222.3333.4444
let me change to single segments.....
 

No, it's fine.
18_1290019550.png


Hope this helps.
Tahmid.

---------- Post added at 19:47 ---------- Previous post was at 19:46 ----------

Copy-paste my code and then do the simulation and let me know. delay_ms(10) is what you need, not delay_ms(1000).

Hope this helps.
Tahmid.
 
you used invertor in your simulation?could you tell me the number of that.

thanks
 

Hi,
Type in inverter. On the left hand category selection, click modeling primitives, choose inverter.
Inverter wouldn't affect it as transistor in your circuit acts in the same way. It will work with transistor.

Hope this helps.
Tahmid.

---------- Post added at 19:54 ---------- Previous post was at 19:52 ----------

O, ok, I see. That's a simulation bug thing. Connect 2k2 resistors from each of pins 1, 2, 3 and 4 to +5v. That should do it.

Hope this helps.
Tahmid.

---------- Post added at 19:56 ---------- Previous post was at 19:54 ----------

Here it is:
6_1290020186.png


Hope this helps.
Tahmid.
 
hey man thanks a lot.i tried with inverter it works (on single seven segment) but it is not stable i try by changing the delay to make it stable.thanks so much.could you tell me why you used inverter?
 

Hi,
I just did to simplify simulation. In real life, the delay_ms() function, the delay should be around 10. In simulation however at 10, it may or may not be stable. In real life, you have to use transistors to carry the current.
It works with transistor as well. See above post.

Hope this helps.
Tahmid.
 

sorry i wasted your time,last question could you explain this: PORTC |= (1<<i);

---------- Post added at 20:06 ---------- Previous post was at 20:05 ----------

i am tring now with transistor...........

---------- Post added at 20:11 ---------- Previous post was at 20:06 ----------

it is funny now i did the simulation without resistors on 1,2,3 and 4.it works::))
 

Hi,

You didn't waste my time, that's why we're here - to help.

PORTC|=(1<<i);
Okay,
<< means bit shift left.
1<<i means shift 1 i no. of bits to the left.
That means, when i is 5, 1 is shifted to bit 5, so that bit 5 = 1.
PORTC = (1<<i); would mean that.
PORTC|=(1<<i); means PORTC = PORTC or (1<<i);
That means had PORTC held some value, it would retain the value for all pins except bit 5 which would be 1.
Here, it's not so important as we clear PORTC at start.
So, here either PORTC = (1<<i); or PORTC|=(1<<i); would work in the same manner.

Hope this helps.
Tahmid.

---------- Post added at 20:12 ---------- Previous post was at 20:11 ----------

If it worked without resistor, good. In real life, you won't need those.
 
Thanks a lot. you saved my life.thanks,thanks,thanks,.....

---------- Post added at 20:16 ---------- Previous post was at 20:15 ----------

BTW Happy EID. may *** shower his uncountable blessings upon u & ur family.
 

Thanks. Eid Mubarak to you as well.

You're welcome. Hope you can now finish your project.

There's another method if you want less pins used. Use a 7447/7448 for driving the 7-segment with 4 pins instead of 7. Using a 74595 would just be stupid as you have 4 displays and in order to use 3 pins, ie, decrease one pin, you don't need to add a shift register.

Hope this helps.
Tahmid.
 

those are latch,am i right?
 

Hi,
7447/7448 are BCD to 7-segment drivers. 74595 is a shift register.

Hope this helps.
Tahmid.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top