UberNewbie can't set his clock...


Closed Thread
Results 1 to 20 of 20

Hybrid View

  1. #1
    Join Date
    Jan 2009
    Location
    California, USA
    Posts
    323


    Did you find this post helpful? Yes | No

    Default Sure would like to turn the trickle charger on...

    Sigh, well I seem to have a new problem. Although I'm obviously able to read/write to the DS1302 in "burst" mode, I seem to be having a problem addressing individual registers.

    For instance, I need to turn the trickle charger on...
    I *thought* it was as simple this:
    Code:
            rst = 1
    
            'Set Battery charger on and set to "1 diode, 2Kohm"
            Shiftout IO, SCLK, LSBFIRST, [$90, $A5]  ' Set charger   [$90, $A5] 
     
            RST = 0
    But that doesn't seem to do it for me.

    Anyone got the patience to help me along a little further....

    p-p-p-please?

    Thanks!

    Steve

  2. #2
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default

    Hi Steve, check uot pages5/ 6 of this data sheet, it says: DS 1302 powers up with trickle charger disabled and only a pattern of 1010 will enable charger. http://forums.parallax.com/forums/attach.aspx?a=26594 HTH
    If you do not believe in MAGIC, Consider how currency has value simply by printing it, and is then traded for real assets.
    .
    Gold is the money of kings, silver is the money of gentlemen, barter is the money of peasants - but debt is the money of slaves
    .
    There simply is no "Happy Spam" If you do it you will disappear from this forum.

  3. #3
    Join Date
    Jan 2009
    Location
    California, USA
    Posts
    323


    Did you find this post helpful? Yes | No

    Default

    Thanks Joe,
    You can't imagine how many times I've read the data sheet.... (it's been open on my desktop for days now)
    I'm clearly not quite understanding yet.

    Yes, a pattern of 1010 turns on the charger, and the other 4 bits of the byte set the charge rate.

    So what ( I think) I want to send is 10100101 which should tun on the charger and set it to "1 diode, 2Kohm" operation. In HEX, that's $A5, right?

    So I've sent $90, which should be the register address for the charger, and $A5, which should be the code to turn it on and set it to my chosen charge mode. I even tried sending the data in binary, like so:
    Code:
            rst = 1
    
            'Set Battery charger on and set to "1 diode, 2Kohm"
            Shiftout IO, SCLK, LSBFIRST, [$90, %10100101]  ' Set charger   [$90, $A5] 
     
            RST = 0
    but with the same (no) result.

    What am I doing wrong? (please!)

    Thanks,
    Steve

  4. #4
    Join Date
    Jan 2009
    Location
    California, USA
    Posts
    323


    Did you find this post helpful? Yes | No

    Default

    Ahh, never mind, I figured it out...

    Setting up the trickle charger is the first task task I ask of the DS1302, and I just needed to pull the reset line LOW first, before I yank it high and move the data.
    All I was missing was "rst = 0" up front:

    Code:
     
           rst = 0
           rst = 1
    
            'Set Battery charger on and set to "1 diode, 2Kohm"
            Shiftout IO, SCLK, LSBFIRST, [$90, %10100101]  ' Set charger   [$90, $A5] 
     
            RST = 0
    Thanks again to everyone!

    Steve

Similar Threads

  1. Interruptus Frustratus
    By Byte_Butcher in forum General
    Replies: 16
    Last Post: - 17th April 2009, 20:36
  2. 16F628A - Stops if release power switch.
    By dene12 in forum General
    Replies: 16
    Last Post: - 14th February 2009, 07:57
  3. Help with sound command in 2 programs
    By hyperboarder in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 5th July 2007, 20:36
  4. error on compiling
    By parker in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 16th June 2005, 14:31
  5. How to set external clock source in PBP
    By TurboLS in forum mel PIC BASIC Pro
    Replies: 28
    Last Post: - 19th February 2005, 15:56

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts