Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

going out on a limb and praying the schematic is correct

MrDEB

Well-Known Member
my Christmas 2025 project I had to redo (see posthttps://www.electro-tech-online.com/threads/using-a-rtc-in-sf-basic.166376/post-1460947
and have yet to get a 74hc595 to work properly but it should work as per schematic.
Am aware this is asking for more problems but hopefully not.
 

Attachments

  • Schematic_SNOW-COPY2-1_2025-05-23.pdf
    269.7 KB · Views: 68
I had to do something vaguely similar to animate the lights on an old signalling panel for the local train museum - used a slightly different approach re pins 10 and 13 (MR & OE).

Perhaps temporarily try the different connection set up and pump some data through them to see if anything happens.

HC595.png
 
Where to start...

First off, you should have a 0.1uF bypass cap on the 5V-GND pins of each IC.

There is no connection from the uC to the 595 LATCH (more on this in a minute).

For some reason you have attempted to split the serial shift register chain into three segments
(DATA-1, DATA-2, and DATA-3) but you have a common CLK and LATCH for all the 595's

That means that when you send data to one of the three chains you're going to change all 595's data.
If you want the chains to be independent they should have their own CLK and LATCH, otherwise chain them all together.
There are pluses and minuses to each configuration... you should think of what those are.

You have three "Twinkle-x" signals which connect to the OE of the 595 chains which do let you PWM the outputs, but since they control multiple 595's a lot of the leds will flash together.
You have a lot of unused uC pins... you might consider using them.
 
Will look at all the suggestion, thanks
on the plus side I finally got around to getting a shift register working BUT it only displays the first 4 bits? need to research the code again.
will add two additional clock inputs and latch inputs.
 
For some reason you have attempted to split the serial shift register chain into three segments
(DATA-1, DATA-2, and DATA-3) but you have a common CLK and LATCH for all the 595's
The only way this works is that if you also address ALL 3 Data lines BEFORE you initiate a CLK and LATCH. The software driver for this also needs to complement that type of configuration. This method is a way to send parallel serial data to separate '595 IC blocks' which seems counter intuitive and there might be a slight speed advantage, but not worth it in many cases.

Another scenario would be physical proximity ... if the '595 IC blocks' are far enough away that you cannot daisy chain the output of one stage to the input of another, then you might want to separate the DATA lines. Doing so however also might require you to separate the CLK and LATCH lines as well.

Based on MrDEB's track record with this project alone, I would not recommend separating the DATA lines.
 
I tend to agree with not separating the data lines.
Hopefully I can discover WHY the test board is only displaying the first 4 bits? thinking the SHIFT.BAS might be the issue?
 
This is crazy you have 3 595 you load 24 bits latch that and each bit thats high light up

Just like post #2 done deal there nothing to change the wiring would be right
Only problem next would be code But thats dead simple load 24 bits latch that.

You send out 8 bits those bits then move to the next chip when you send in new bits to the first chip
So you load all 3 so only the leds you want will light. then latch
 
SHIFT.BAS might be the issue? Why would it be it works for everyone else . We have lots of problems at
work the train runs fine then it runs out of fuel instead of filling the tank they aways think the engine is broken
Point is most always it the operator with a big head thinking he's smarter then the engine maker and over looks his own mistakes.
 
Got to contemplating the suggestion about separating the 74hc595s inputs so why not just have 10 separate 74hc595's
This will then have most of the pic's pins connected. Just program a good appearing twinkle in each on.
As for the test code I only get the first 4 bits. Working on this today
Code:
{
*****************************************************************************
*  Name    : UNTITLED.BAS                                                   *
*  Author  : [select VIEW...EDITOR OPTIONS]                                 *
*  Notice  : Copyright (c) 2025 [select VIEW...EDITOR OPTIONS]              *
*          : All Rights Reserved                                            *
*  Date    : 5/15/2025                                                      *
*  Version : 1.0                                                            *
*  Notes   :                                                                *
*          :                                                                *
*****************************************************************************
}
Device = 18F43K22
Clock = 8

// int osc and IO pin libraries
Include "intosc.bas"
#option DIGITALIO_INIT = true       // automatically call setalldigital
Include "setdigitalio.bas"
Include "SHIFT.BAS"

Dim LATCH As PORTB.4        // hc595 pin 12 LCHCLK
Dim DATA As PORTA.1         // hc595 pin 14 SDI
Dim CLK As PORTB.3          // hc595 pin 11 SFTCLK
Dim RST As PORTB.1          // hc595 pin 10 RSTn (no connection to pcb)
Dim SDO As PORTA.4          // hc595 pin 9 SDO QH' shift out

Dim Leds As Byte

// set pin modes
Shift.SetClock(CLK)
Shift.SetOutput(DATA)
Shift.SetInput(SDO)
High(RST)
Low(LATCH)
 

 // if there was a connection...
//Low(RST)
//DelayUS(100)
//High(RST)


// cycle leds
Leds = 0
While (true)
    If (Leds = 0) Then
        Leds = 1
    EndIf
    Shift.Out(MSB_FIRST, Leds, 8)
    LATCH = 1
    LATCH = 0
    DelayMS(250)
    Leds = Leds << 1
End While
 
Please encapsulate and zip your entire project ... we have no idea what "SHIFT.bas", "setdigitalio.bas", and "intosc.bas" are doing because they are included in your main program but not attached to what you are posting in the forum.
 
I absolutely refuse to become involved in another MrDEB fiasco, so this will be my only comment here. The first, last and only.

If MrDEB had a scintilla of understanding this project or a fly-speck of troubleshooting ability, the natural first steps are to shift values that would illuminate every LED, no LEDs and alternating LEDs. The first step after seeing that only half the LEDs lighting up.

My best guess is either half the LEDs are backards or miswired.

Adios
 
They are supposed to be some of the standard libraries included with Swordfish BASIC.

Just FYI, I compiled the above program for an 18F26K22 (instead of a 43K22), monitored the outputs of the CLK, DATA, and LATCH pins and they are as expected. The only difference when compiled for the 43 is the setup of PORTD and PORTE, so no meaningful difference.

Here's LA shots of the first (LSB) bit and the last (MSB) bits. All eight bits worked as expected.
Clipboard_01.jpg
Clipboard_08.jpg
 
Well after searching for a replacement 16 pin dip for testing and locating several I knew I had but where?
Located then replaced on my breadboard and all 8 of the LEDs light up. Finally!
Now back to my project, contemplating separate LATCH and DATA connections, then have a common CLOCK connection for all of the ten 74hc595's.
I think if I had the registers cycle down from each register I would get a curtain effect (led's from first output to the # 80 output.)
I am after a TWINKLE EFFECT using all 80 LEDs.
 
Why do you think you're going to be better off by separating the signals? What does that do for you other than make it very difficult to use any existing modules like SHIFT.BAS?

Describe what a "TWINKLE EFFECT" looks like. Does the brightness vary? Does it flash on and off? What would you have to do in code to make it "twinkle"?
 
If I use the overflow om pin 9 then the LEDs will light up from the first 74hc595 and continue on until it reaches the #80 led. All in sequence, like follow the leader starting with led#1 and continuing to #80
I want to have the LEDs twinkle. Maybe just a simple om/off sequence (toggle led1, 1 - 100 for next loop then toggle led1
If I put a delayms then that slows everything down I think?
No the brightness doesn't change but it would be nice?
I was contemplating this last night and thinking of counting the clock pulses and make each shift register randomly toggle leds. Each shift register controls its own 8 LEDs.
Just thinking out loud.
Taking advice from posts 5 & 7
here is basically what I am contemplating. Schematic is not done but attempting to have ports close to their respective LEDs when I hopefully get to a PCB
Basically make it appear ALL the LEDs are on all the time.
 

Attachments

  • Schematic_SNOW-COPY2-1_2025-05-29.pdf
    290.3 KB · Views: 14

Latest threads

Back
Top