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.

using a RTC in SF basic

MrDEB

Well-Known Member
I have a DS-1302 RTC module but how to use it?
I recall Jon Chandler made a vu meter clock but what he used for timing?
Am planning on a clock that has no hands, just LEDs but precision would be nice.
 
I need to recheck but the post in 315 is same but without the pushbuttons
 
So, looking at post 315, do you have any connection to hc595 pin 10 RST?

List how the "microcontroller_input" connector pins 1-5 are connected.
What is the schematic for the pcb with the k22 on it?

I don't trust much of anything you've posted after 300+posts on this
 
if your connections are anything like they were a few posts ago, try this:

Code:
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

It corrects a few issues with the code I posted previously
 
Here is the schematic of my testing board. The LED on portA.1 blinks as it should and the LED om portA.4 stays on. but no leds on QA - Q-H?
 

Attachments

  • 74HC595 TEST CIRCUIT.pdf
    86 KB · Views: 6
I asked about pin 10 a number of pages ago. You could connect it as your schematic shows, or tie it high.

SDO isn't used in the code... it's just there since you showed it connected at one time.
 
I don't have a scope but following the code in post#345, it has SDO connected to portA.4
Trying to troubleshoot a clocked logic circuit is like running the Boston marathon in snowshoes.

U2 Pin is an output and does not ned to be connected to anything unless you're using the signal that will be there. It's OK to connect it to your uC, but that pin must be set as an input so it doesn't fight the U2 pin 9 state.
 
Today I am rechecking ALL my connections and tying the RST pin 10 to HIGH.
Hopefully get this project back on track.
Using the schematic in post#346. but connecting pin 10 of the 74hc595 to Vcc
 

Latest threads

Back
Top