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] 74HC595 operation problem

Status
Not open for further replies.

Arrowspace

Banned
Joined
Jan 23, 2015
Messages
186
Helped
3
Reputation
6
Reaction score
3
Trophy points
18
Activity points
0
Can anyone verify my circuit. It's not working

4933125400_1441119751.jpg
 

Your circuit is wrong. Why you opened a new thread for the same issue you earlier had ? You can't tie SH_CP and ST_CP together. How much time your relay takes to turn ON when there is a 1 at the base of the transistor driving it ? See if you can add a electrolytic capacitor from base to GND for each transistor driving the relays and then quickly send the HC595 data by your method of clocking SH_CP and ST_CP together.
 

Please be more specific and specify - what exactly doesn't work?
And what were your debugging efforts so far?

Did you inspect the soldering?
Did you try changing the component?
Do you see a clock signal?
Is the VCC correct and stable?
Did you verify data is coming in the DS pin?
 

Please see datasheet

1st page
 

You can't tie SH_CP and ST_CP together.

From the datasheet:
Data is shifted on the positive-going transitions of the shift register clock input (SHCP).
The data in each register is transferred to the storage register on a positive-going
transition of the storage register clock input (STCP). If both clocks are connected together,
the shift register will always be one clock pulse ahead of the storage register.
 

From the datasheet:


That what confusing me too much, I not getting is my circuit is wrong or my code.

- - - Updated - - -

Please be more specific and specify - what exactly doesn't work?
And what were your debugging efforts so far?

Did you inspect the soldering?
Did you try changing the component?
Do you see a clock signal?
Is the VCC correct and stable?
Did you verify data is coming in the DS pin?


Actually I am trying to operate relay using 74HC595 , but after transmitting data from controller, I am not getting any change at output of 74HC595.

Data and clock coming correctly, clock speed 1msec , if my circuit is ok , then I am missing something in code .
 

Do you have an Oscilloscope??
 

Hi,

show a scope picture or a draft of your digital signals. With description, voltages and timing informations.

And an actual schematic.


Klaus
 

Code:
int i=0;

unsigned int buf = 0b01010101;

void main()
{

direction();


while(1)
{   

for(i=0;i<=9;i++)
{
   if ( (buf & 0x01) == 0)    //check bit 0
{
LATBbits.LATB0 = 0;
buf>=1;
}

else
{
LATBbits.LATB0 = 1;
buf>=1;
}
LATAbits.LATA4  = 1;        //  clock
   delay_ms(10);
LATAbits.LATA4  = 0;        //  clock
 delay_ms(10);

}
 delay_ms(250);
}
}
 

You are not reloading the buf variable after the first loop.
Moreover, what exactly do you expect with this buf>=1 command ?
 

Hi

I don't know which Compiler you are using and which PIC you are using. I have written a code for you using mikroC PRO PIC Compiler just to show that it works. If you mention which compiler, PIC and what frequency crystal you are using then I will try to make a project for you using that compiler.

In the attached file there are two Proteus simulation files. One using LED and another using Relays. Test both with the same .hex file. I have used PIC16F877A with 4 MHz crystal.

I don't see any data chattering when SH_CP and ST_CP of 74HC595 is tied together. The LEDs and Relays turn on without any problem.

After you mention your compiler, PIC and crystal freq, I will make a project for you so that you can quickly test it in hardware using relays.

In the Relay based simulation file the capacitors at the base of the transistors are important. It gives delayed turn ON for relays. I think a 100 ms to 200 ms delay is enough and it will make Relays operate normally when data is shifted to 74HC595.

Anyway, quickly test my simulations and reply.

broken link removed
 

Attachments

  • 74HC595 Based Relay Control.rar
    57.6 KB · Views: 77
  • Relay Control.png
    Relay Control.png
    8.2 KB · Views: 149
Last edited by a moderator:

Hi

I don't know which Compiler you are using and which PIC you are using. I have written a code for you using mikroC PRO PIC Compiler just to show that it works. If you mention which compiler, PIC and what frequency crystal you are using then I will try to make a project for you using that compiler.

In the attached file there are two Proteus simulation files. One using LED and another using Relays. Test both with the same .hex file. I have used PIC16F877A with 4 MHz crystal.

I don't see any data chattering when SH_CP and ST_CP of 74HC595 is tied together. The LEDs and Relays turn on without any problem.

After you mention your compiler, PIC and crystal freq, I will make a project for you so that you can quickly test it in hardware using relays.

In the Relay based simulation file the capacitors at the base of the transistors are important. It gives delayed turn ON for relays. I think a 100 ms to 200 ms delay is enough and it will make Relays operate normally when data is shifted to 74HC595.

Anyway, quickly test my simulations and reply.

120846d1441132921-relay-control.png

yours proteus circuit is not clear
 

Here is the Schematic in PDF format. If you are going to draw my circuit in old version of Proteus then just draw one complete relay circuit and then copy paste them to make 8. Then set the names for input part like RLY1, RLY2, etc... To draw it take a A1 or A2 sheet. The value of resistor used for LEDs in relays circuits should be 1k but to see the LEDs glowing (all 8 LEDs of relays) when schematic looks small I have used 300E resistors, so that the LEDs look bright. I am assigning two different values to 74HC595 with a 5 sec delay.
 

Attachments

  • 74HC595 Based Relay Control.PDF
    118.8 KB · Views: 77
Last edited:

We both have used same circuit , then why my circuit is not working.

Are you testing in Proteus or hardware ? If Proteus, then I think you have made your own Proteus model for 74HC595 which is only a schematic model and not a simulation model. Use the 74HC595 simulation model and Animated Relay model to make the simulation file. Which version of Proteus are you using ? I don't have 7.x version of Proteus and hence I cannot make you a old format circuit.

Here is the LED version of the circuit.
 

Attachments

  • Relay Control LED version.png
    Relay Control LED version.png
    35.7 KB · Views: 189
Last edited:

Just as a note on the transistor saturation, the Ib=10% of Ic to work reliably If the relay coil is say 150 Ohms then Load with 300R on LED is ~100R or 12V/100= 120mA so drive must be 12mA which from 5V is (edit) (5-0.7)V/12mA<= 360 Ohm. I would choose 330. if Rcoil is 150 and less according to Rcoil. ( as low as 50 Ohms for Rbase. ) or choose logic level FET.

With 1k less current to the coil from Vce rise means it will chatter more and hence I see you have 100uF to attempt reduce that and reduce overall di/dt.
 
@SunnySkyGuy

I have not calculated the value of base resistor and capacitor at base of transistor. I have left that work to the OP. I have used capacitors to get delayed turn ON of relay. Capacitor has to take say 100 ms to 200 ms to charge to 0.6V needed to forward bias the transistor. During this 100 ms or so the 8 bits of relay control data can be shifted to 74HC595 with SH_CP and ST_CP tied. I have not tested this setup in hardware. I again leave this to OP.


Here is the MPLAB C18 project. Also includes Proteus file. As you had mentioned that you are using C18 Compiler and PIC18F4550 in your other thread, I have made a project for your PIC. I have only tested it in Proteus and it works fine. Test it in hardware and reply.

Edit

See the attached simulation video.

- - - Updated - - -

Here is a RC Time constant calculator. it can be used to calculate the delay.

http://www.referencedesigner.com/rfcal/cal_05.php

If 1k resistor and 1000 uF Capacitor is used it takes 1 sec to charge to 63.21% of 5V (input). You have to calculate how much time it takes to charge to 0.6V needed to forward bias the transistor.



Here is a better one to calculate.

http://ladyada.net/library/rccalc.html

With 5V from MCU pin and 10k and 200uF it will take approx 281 ms to charge to 0.6V. Your code should send 8 bits data to 74HC595 within this time.


Edit:

As mentioned by SunnySkyGuy Collector currents depends on base current. So, first required base current and base resistor values have to be calculated and then capacitor value have to be choosen such that it should give a delay of 200 ms to charge to 0.6 or 0.7V.
 

Attachments

  • MPLAB 8.rar
    57.6 KB · Views: 63
  • sim video.rar
    118.4 KB · Views: 64
  • tau.png
    tau.png
    22.7 KB · Views: 107
Last edited:

Instead of SH_CP and ST_CP tied, why not use independent ST_CP ?

Also only 7 ports are needed so it could be done in SH_CP 7 Clk pulses and use only Q0~Q6 and not use Q7.

Then the output ports are synchronously switched every byte instead of shifted every bit, unless that was the desired feature?
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top