I have a project that uses 10x 74HC595 shift registers to control a series of electromagnets (80x magnets in total), switched with transistors. My current situation is that when I pull the reset-pin of the '595 LOW and HIGH again, and thereafter clock the latch-pin, the outputs of all the '595s change to LOW, as expected. However, as soon as I start clocking bits in, one of the '595’s output pins is also miraculously HIGH, whereafter it also shifts a HIGH bit as it would normally. The only difference is, it should be shifting only zeroes until the HIGH bit reaches that shift register and gets shifted through that particular IC. For some reason and by some means, that particular '595 gets a HIGH bit in its register and shifts that out. I have checked the serial input pin just before shifting, and there is certainly no HIGH bit being shifted in from the previous '595. So I have no idea where that particular HIGH bit is coming from.
Attached is a snipped from the schematic of how the '595 is connected. The outputs are connected to NMOS transistor gates for controlling the electromagnets. Below is a snippet from the code that controls the '595s:
void main(void)
{
int i;
/* Reset the shift register contents and latch new contents */
shiftReg_reset = LOW;
delayus(1);
shiftReg_reset = HIGH; //LOW-to-HIGH transition
delayus(1);
shiftReg_latch = HIGH; //Move new outputs (all zeroes) to latches
delayus(1);
shiftReg_latch = LOW; //HIGH-to-LOW transition
delayus(1);
shiftReg_out_en = LOW; /* Output enables '595s (active-LOW) */
shiftReg_reset = HIGH; /* Pull reset pins HIGH (active-LOW) */
for (i = 0; i < 80; i++)
{
/* Set data pin */
shiftReg_data = HIGH;
delayus(1);
/* shift bit */
shiftReg_clock = HIGH;
delayus(1);
shiftReg_clock = LOW;
/* load '595 contents to output latches */
delayus(1);
shiftReg_latch = HIGH;
delayus(1);
shiftReg_latch = LOW;
delayms(250);
} /* for */
} /* main() */
I have no idea what is causing this behavior. As you can see from the code, the shift registers’ outputs are all zeroes initially, but once the second bit is shifted, it seems like the same bit gets shifted from another '595 in the sequence, giving the idea that there are two sets of shift registers being interfaced to which output the same data, instead of doing it in a cascaded manner.
Your help in this regard will be greatly appreciated! Thanks!
Do you have these in sockets, or hardwired to the board? If you have used sockets I would switch that chip out and see if you have a defective part. Defects can and do make it to the end user. Just a thought.
These ICs are soldered to a PCB (they are in the TSSOP package), but I can replace them. I have also thought that it might be a defective part, but I had the same problem with some earlier ICs that were also replaced. I fear that somehow, these are getting damaged on the PCB during testing. I doubt that I can have so many defective parts in the same batch.
How about soldering time and heat? I have put a muffin fan on the component side of a board while soldering the bottom and that seems to work fairly well. Is your power supply giving you ripple free DC? Just throwing out the common reasons for parts to go wanky.
Soldering time/heat might be an aspect at play here. I have my soldering iron at 450 degrees C and drag-soldered the IC onto the PCB. I have also used a hot air tool to remove some of the ICs that seemed to be faulty (like this one), which is set at 300 degrees C. When removing the IC with the hot air, I basically heat the leads as uniform as possible, while lightly pulling up the IC with a pair of tweezers. As soon as the leads come loose, the IC lifts up and I immediately remove the heat.
Regarding power supply - I am using a LDO adjustable voltage regulator (LM1085) connected to a DC power supply of 15 V, and the output voltage of the regulator is set at 4.8 V. From measurements with my multimeter, the output voltage seems stable. Other shift registers on the PCB (74HC164 & 74HC166 among others) are totally happy.
Despite the above-mentioned factors, the thing that bothers me is, this IC worked all fine a few days ago when I function tested the system, but now all of a sudden it starts doing this. There are no solder bridges, wrong connections that I could find.
The only last thing that comes to mind is the transistors. Every output of the shift registers is connected to an NMOS transistor’s gate terminal. The transistor switch configuration was supposed to be a high-side switch, but soon after I assembled the PCB and tested it, I realized that I should’ve used an NMOS together with a PMOS transistor for high-side switching (I did not know this beforehand, being used to only low-side switch configurations). I have attached a snippet of the schematic of how each transistor is connected. Due to the current transistor configuration, the output of each shift register doesn’t nearly fully turn the NMOS transistor on, but it turns it on just enough that the LED can be lit (the LED is only there to indicate the state of the shift register output). The LED is connected to a large resistor-value for current limiting, it is just not shown in the snippet that I’ve attached.The electromagnet and suppression diode (D1) are not yet connected, so there is no heavy/inductive load currently on the circuit. I know this circuit will thus not work for the electromagnet switching, but I can still use it to test my embedded code’s logic - I will make another PCB with the correct NMOS-PMOS configuration for high-side switching of the electromagnet. From my understanding, the gate of the current NMOS transistor shouldn’t have any effect on the shift register. But could I be missing something here?