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.
 
Sorry it was supposed to be CHECK
I rechecked the boards layout and it looks right. Could be the Mosfets are labeled wrong from Tayda?
Going to order some new ones
 

Attachments

  • Screenshot (62).jpg
    Screenshot (62).jpg
    76.4 KB · Views: 54
You're going to order new what? If they're labelled wrong won't the "new" ones be the same?

Maybe, if it "looks right" then maybe it's not.

Mike.
 
1. That you got defective parts from Tayda is the least likely possibly.

2. Your board layout gives me a headache and makes me want to cry.

3. It appears that pin 3 (source) is floating in space. IF you used a ground plane on the bottom layer:
> It would have been nice to show it.*
> It appears unlikely that it could connect to every mosfet source pin.

*EasyEDA can export clear concise board images, which I have attempted to explain a dozen times.

OMG – WHEN WILL I EVER LEARN? I MUST BE INSANE TO CONTINUE TRYING TO HELP YOU.

Screenshot_20241009_042526_Edge.jpg
 
Attempting to find the correct file.
It has a ground plane on both the top and bottom layer, but will verify with DMM
Will check the MOSFETs using the DIODE function.
source to drain = diode working
drain to source = no reading
Am attempting to get the right pdf but?
 
If you use good software (which EasyEDA is) then you simply rely on their service. No need to check anything. IF you use the right parts then they will deliver the right boards. It's really not that difficult.

Mike
 
I was going to have JLPCB assemble the boards, but they did not have enough of the MOSFETs so I ordered from TAYDA.
I will measure each MOSFET later after LOML gets up.
 
I got to ask what is OTRPGTRB and LOYL
I measured several of the mosfets
.584 ohms from drain to source.
used the populated board as well as one of the unpopulated boards
 
On a design note ... one should NEVER rely on fill to make the connection. Why? Fill can produce inadequate widths when connecting components. You should always make sure all signals including power and ground are routed, and then as a very last step (if required) apply your fill.
 
"Well after attempting to get a board working I discover I missed 2 resistors so need to redesign the board and going with smd LEDs" - For another design note, prove out your schematic and make sure you translated it correctly buy rebuilding part or all of the circuit on a solderless bread board from the schematic
 
On a design note ... one should NEVER rely on fill to make the connection.

That was a lesson I learn long ago, on the first TAP-28 board I designed long ago. The ground plane on one end of the board wasn't connected to the ground plane on the other end of the board. Oops.

Looking at a board view of the ground plane is essential to ensure there are no floating islands of ground plane. The DNC will reveal any floating islands.... but not points connected only by a sliver of ground plane fill.
 
For anybody remembering way back to in the beginning of this thread, I mentioned my A Clock For Geeks article. While searching for something else, I came across most of the source files. The original A Clock For Geeks article has been restored and posted on Jon's Imaginarium for anyone interested. This is simple stealth clock driven by a hobby servo.

Screenshot_20241110_071940_Edge.jpg
 
I am still working on this project.
I WAS using Easyeda software but having too many issues with placing traces so I redid the schematic in Diptrace (got upgraded for free to 500 connections)
I've been reviewing the PC board for mistakes, etc., and I've been thinking about including a battery backup circuit. Maybe not include one??
 
Well, I finally got back to this project and ran into code or mosfet issues.
using this schematic and this code I get more than one LED on. Only one is supposed to be on. Curious, do mosfets tend to bleed when off? ONLY row_1 colum_1 should be on but several other LEDs are on some are dim.
Code:
{
*****************************************************************************
*  Name    : UNTITLED.BAS                                                   *
*  Author  : [select VIEW...EDITOR OPTIONS]                                 *
*  Notice  : Copyright (c) 2024 [select VIEW...EDITOR OPTIONS]              *
*          : All Rights Reserved                                            *
*  Date    : 11/19/2024                                                     *
*  Version : 1.0                                                            *
*  Notes   :                                                                *
*          :                                                                *
*****************************************************************************
}
Device = 18F43k22 ' Tell the compiler what chip we are using
Clock = 8 ' Tell the compiler what we will be setting the clock to (Mhz)
//CONFIG MCLRE = OFF
'Config fOSC = INTIO67 ' Internal oscillator, IO on pins 6 and 7
#OPTION DIGITALLIO_INIT=TRUE
Include "SetDigitalIO.bas"       // Include this file when we compile so that we can use keywords like 'setalldigital'
Include "utils.bas"
Include "convert.bas"
Include "intosc.bas"

 Dim Row_1 As PORTA.0  //rows are the minute led anodes  BLUE 3mm LEDS
 Dim Row_2 As PORTA.1  //rows are the minute led anodes
 Dim COLUM_1 As PORTB.2    //LEDS 60, 59. 7, 6, 5, 4, 3, 2, 1, 58
 Dim COLUM_2 As PORTB.3  //DS 8, 9, 10, 11, 12, 13, 14, 15, 16, 17
 Dim COLUM_3 As PORTB.4    //LEDS 38, 39, 40, 41, 42, 43, 44, 45, 46, 47
 Dim COLUM_4 As PORTB.5    //LEDS 27, 26, 25, 24, 23, 22, 21, 20, 19, 18
 Dim COLUM_5 As PORTB.6    //LEDS 48, 49, 50, 51, 52, 53, 54, 55, 56, 57
 Dim COLUM_6 As PORTB.7    //LEDS 28, 29, 30, 31, 32, 33, 34, 35, 36, 37
 Dim LEFT_EYE As PORTC.5     // TO BLINK EVERY SECOND
 Dim RIGHT_EYE As PORTC.6
  //set all ports as outputs
 TRISA = 0
 TRISB = 0
 TRISC = 0
 TRISD = 0
 TRISE = 0
 PORTA = %00000000
 PORTB = %00000000
 PORTC = %00000000
 PORTD = %00000000
 PORTE = %000
 Output(COLUM_1)
 Output(COLUM_2)
 Output(COLUM_3)
 Output(COLUM_4)
 Output(COLUM_5)
 Output(COLUM_6)
 COLUM_1 = 0
 COLUM_2 = 0
 COLUM_3 = 0
 COLUM_4 = 0
 COLUM_5 = 0
 COLUM_6 = 0
   While 1=1
  
  
     //TURN ON ALL THE BLUE ANODE ROWS FOR TESTING
    // colum_1 = 1          //mosfet
   Toggle (LEFT_EYE)     //portc.5
    Toggle (RIGHT_EYE)    //portc.6
    DelayMS(500)
    Toggle (LEFT_EYE)
    Toggle (RIGHT_EYE)
    DelayMS(1000)
      Row_1 = 1
      COLUM_1 = 1      //turn on mosfet
     // DelayMS(1000)
     COLUM_2 = 0      //turn on mosfet
     colum_3 = 0
     COLUM_4 = 0      //turn on mosfet
     colum_5 = 0
     COLUM_6 = 0      //turn on mosfet
    
      Row_1 = 0
        COLUM_1 = 1      //turn on mosfet
     // DelayMS(1000)
     COLUM_2 = 0      //turn on mosfet
     colum_3 = 0
     COLUM_4 = 0      //turn on mosfet
     colum_5 = 0
     COLUM_6 = 0      //turn on mosfet
      DelayMS(1000)
      wend
 

Attachments

  • Schematic_smd-clock_2024-11-19.pdf
    248.7 KB · Views: 24
Well, I finally got back to this project and ran into code or mosfet issues.
using this schematic and this code I get more than one LED on. Only one is supposed to be on. Curious, do mosfets tend to bleed when off? ONLY row_1 colum_1 should be on but several other LEDs are on some are dim.
Code:
{
*****************************************************************************
*  Name    : UNTITLED.BAS                                                   *
*  Author  : [select VIEW...EDITOR OPTIONS]                                 *
*  Notice  : Copyright (c) 2024 [select VIEW...EDITOR OPTIONS]              *
*          : All Rights Reserved                                            *
*  Date    : 11/19/2024                                                     *
*  Version : 1.0                                                            *
*  Notes   :                                                                *
*          :                                                                *
*****************************************************************************
}
Device = 18F43k22 ' Tell the compiler what chip we are using
Clock = 8 ' Tell the compiler what we will be setting the clock to (Mhz)
//CONFIG MCLRE = OFF
'Config fOSC = INTIO67 ' Internal oscillator, IO on pins 6 and 7
#OPTION DIGITALLIO_INIT=TRUE
Include "SetDigitalIO.bas"       // Include this file when we compile so that we can use keywords like 'setalldigital'
Include "utils.bas"
Include "convert.bas"
Include "intosc.bas"

 Dim Row_1 As PORTA.0  //rows are the minute led anodes  BLUE 3mm LEDS
 Dim Row_2 As PORTA.1  //rows are the minute led anodes
 Dim COLUM_1 As PORTB.2    //LEDS 60, 59. 7, 6, 5, 4, 3, 2, 1, 58
 Dim COLUM_2 As PORTB.3  //DS 8, 9, 10, 11, 12, 13, 14, 15, 16, 17
 Dim COLUM_3 As PORTB.4    //LEDS 38, 39, 40, 41, 42, 43, 44, 45, 46, 47
 Dim COLUM_4 As PORTB.5    //LEDS 27, 26, 25, 24, 23, 22, 21, 20, 19, 18
 Dim COLUM_5 As PORTB.6    //LEDS 48, 49, 50, 51, 52, 53, 54, 55, 56, 57
 Dim COLUM_6 As PORTB.7    //LEDS 28, 29, 30, 31, 32, 33, 34, 35, 36, 37
 Dim LEFT_EYE As PORTC.5     // TO BLINK EVERY SECOND
 Dim RIGHT_EYE As PORTC.6
  //set all ports as outputs
 TRISA = 0
 TRISB = 0
 TRISC = 0
 TRISD = 0
 TRISE = 0
 PORTA = %00000000
 PORTB = %00000000
 PORTC = %00000000
 PORTD = %00000000
 PORTE = %000
 Output(COLUM_1)
 Output(COLUM_2)
 Output(COLUM_3)
 Output(COLUM_4)
 Output(COLUM_5)
 Output(COLUM_6)
 COLUM_1 = 0
 COLUM_2 = 0
 COLUM_3 = 0
 COLUM_4 = 0
 COLUM_5 = 0
 COLUM_6 = 0
   While 1=1
 
 
     //TURN ON ALL THE BLUE ANODE ROWS FOR TESTING
    // colum_1 = 1          //mosfet
   Toggle (LEFT_EYE)     //portc.5
    Toggle (RIGHT_EYE)    //portc.6
    DelayMS(500)
    Toggle (LEFT_EYE)
    Toggle (RIGHT_EYE)
    DelayMS(1000)
      Row_1 = 1
      COLUM_1 = 1      //turn on mosfet
     // DelayMS(1000)
     COLUM_2 = 0      //turn on mosfet
     colum_3 = 0
     COLUM_4 = 0      //turn on mosfet
     colum_5 = 0
     COLUM_6 = 0      //turn on mosfet
  
      Row_1 = 0
        COLUM_1 = 1      //turn on mosfet
     // DelayMS(1000)
     COLUM_2 = 0      //turn on mosfet
     colum_3 = 0
     COLUM_4 = 0      //turn on mosfet
     colum_5 = 0
     COLUM_6 = 0      //turn on mosfet
      DelayMS(1000)
      wend
All of your mosfets are wired wrong. The body diode is always conducting even when the gate is low.
1732084681548.png
 
Curious, do mosfets tend to bleed when off?

No. Your problem was noticed and explained before.

I don’t know exactly what part you're using, but it looks like you have the fet connected wrong... the body diode is always going to conduct. Check the source and drain connections.

Same problem now.

All of your mosfets are wired wrong. The body diode is always conducting even when the gate is low.
View attachment 147788
 

Latest threads

New Articles From Microcontroller Tips

Back
Top