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: 87
it supports ALL the pic18F devices, even the new ones.
Thanks for all the effort to keep Swordfish current. It's a shame that Swordfish initially got off to a rough start – it deserves far more attention than it gets!
 
Offered without comment in the futile hope that MrDEB will make a little effort to understand how to use the '595, because he ain't got a clue now.



Imagine the twinkling that could occur if you rapidly shifted out bytes of random numbers?


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)

//remove {curly brackets} around each section to test

{//ORIGINAL CODE – What happens here?
    If (Leds = 0) Then
        Leds = 1
    EndIf
    Shift.Out(MSB_FIRST, Leds, 8)
    LATCH = 1
    LATCH = 0
    DelayMS(250)
    Leds = Leds << 1
// END OF ORIGINAL CODE
}

{//WHAT HAPPENS IF YOU TRY THIS?
Leds = %11111111
Shift.Out(MSB_FIRST, Leds, 8)
LATCH = 1
LATCH = 0
Delayms(500)
Leds = %10101010
Shift.Out(MSB_FIRST, Leds, 8)
LATCH = 1
LATCH = 0
Delayms(500)
//END OF EXAMPLE 1
}

{//WHAT HAPPENS IF YOU TRY THIS?
Leds = %10101010
Shift.Out(MSB_FIRST, Leds, 8)
LATCH = 1
LATCH = 0
Delayms(500)
Leds = %01010101
Shift.Out(MSB_FIRST, Leds, 8)
LATCH = 1
LATCH = 0
Delayms(500)
//END OF EXAMPLE 2
}

End While
 
Last edited:
pOST#43 DOES NOTHING. I would like to be able to use the 8 bits that Jon posted ($11111111)
Going to look at it better as well as the SPI mssp that Tumbleweed suggested.
 
pOST#43 DOES NOTHING.
Geez oh grief. Did you even LOOK at the code? The code was written so you could try three different options so you make get a clue, but it would take some effort.... perhaps 30 seconds total. If you had even looked at it you would have noticed:

Screenshot_20250604_111810_Edge.jpg


Screenshot_20250604_112004_Edge.jpg


Did you even look at the code? Did you not notice that virtually all of it was light blue like a comment.

Remove the curly brackets { } around one section. Try it out. Put them back and repeat for the next section. Try it out. Engage brain. LOOK AT CODE AND TRY TO UNDERSTAND THE DIFFERENCE.

I saw how lost you are with this and that you don't understand that you can control each and every LED individually by changing its associated bit and shifting the ENTIRE SERIES OF BYTES OUT, so reluctantly I made an absolutely worthless attempt to help you once more. F**k me. I am so stupid for trying.

You'll say "I didn't understand the curly brackets." Bull excrement. You've been butchering Swordfish Basic for a dozen years or more. Not my fault if you don't understand the simplest features.
 
For those playing along at home, here is the code shown in the Swordfish editor.

For those with normal visual acuity and several interconnected brain cells, you can see:

> Code is black, non-italic font

> Comments are light blue, italic font

In the attached PDF, you'll see MrDEB is right - between the WHILE and WEND of the main program loop, there are only comments, with the instructions to test each section by removing the curly brackets. This would be OBVIOUS to anybody attempting to understand the code.

sf 1.jpg


sf 2.jpg
 

Attachments

  • SWORDFISH EDITOR.pdf
    36.8 KB · Views: 4
Even St. Jude would give up.

Saint Jude, also known as Saint Jude Thaddeus, is widely recognized as the Patron Saint of Hopeless Causes and Patron Saint of Lost Causes. He is also known as the Patron Saint of the Impossible.

sf 3.jpg
 
Back
Top