Shop OBEX P1 Docs P2 Docs Learn Events
Six Digits of Doom - Page 2 — Parallax Forums

Six Digits of Doom

24

Comments

  • PJAllenPJAllen Banned Posts: 5,065
    edited 2011-08-20 12:55
    Are you saying that if you program/set-time using DEC2 and then Show Time with DEC2 that it doesn't result decimal (base 10) display?
  • CalMarinerCalMariner Posts: 64
    edited 2011-08-20 18:43
    Correct. I changed every SEROUT reference from HEX2 to DEC2 and it behaved as I said. Maybe there's something in the way that the program writes it to the DS1302. Unfortunately, I am going to be away from my office this weekend, but I will try any suggestions when I get back. I think that I may just isolate the problem code and try to work on it separately. I have so many DO WHILE, LOOP latches in there, it is getting confusing. All to create a smooth UI though...
  • CalMarinerCalMariner Posts: 64
    edited 2011-08-22 15:09
    *UPDATE*

    After leaving the system alone all weekend (to check for drift), I found that the seconds value had lost '3'. Over a 72-hour period, the timekeeping slowed by 3 seconds. This is more than acceptable, given the design specifications of +/- 30 seconds in 24 hours. It is also small enough that environmental factors could easily be the explanation.

    I also was given the idea of implementing my debouncing "latch" in a subroutine, so as to make the code simpler. Credit is given in the code.
  • CalMarinerCalMariner Posts: 64
    edited 2011-08-22 17:14
    Um...now the seconds are stuck at 80. No idea...

    Test sequence runs fine, setting time is ok, but in run mode, it just shows 80 as the seconds, and doesn't tick. It's the damndest thing...
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2011-08-22 17:21
    I think you need to solder the crystal's leads to the IC's pins.

    It's finicky, not really amenable to stray capacitance inherent in breadboards; the leads of the crystal (tuning-fork) are fine and make poor contact in the breadboard.
  • CalMarinerCalMariner Posts: 64
    edited 2011-08-22 17:56
    The only reason that I've yet to solder the leads is that the entire circuit is going to be put on a solder-through board soon. Trust me - it is driving me mad.

    Good news- the clock is ticking again. I just had to set the time. The biggest problem remains the U.I.
  • CalMarinerCalMariner Posts: 64
    edited 2011-08-22 18:01
    Thanks to one of my advisers, I have written a latch subroutine which seems to catch the bounce. My current problem (in the U.I.) is, besides the HEX display issues, I had to apostrophe-out my conditions for resetting minutes over 60, and hours over 12 or 24. I can't help but feel that this is related, because, when incrementing hours in 24-hour mode, it would go to 17, then reset.

    I wish I had a better understanding of HEX vs. DEC.
  • CalMarinerCalMariner Posts: 64
    edited 2011-08-22 18:04
    For those following along at home, I have attached my current firmware.

    VI77-708 Firmware.bs2
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2011-08-22 18:14
    17 is HEX for DEC 23
    (1 x 16) + (7 x 1) = 23

    117 HEX is DEC 279
    (1 x 256) + (1 x 16) + (7 x 1) = 279
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2011-08-22 18:16
    Windows Calculator in Scientific mode allows you to change DEC to HEX and vice versa (binary and octal too.)
  • CalMarinerCalMariner Posts: 64
    edited 2011-08-22 18:19
    BEHOLD the new and improved, not-so-patented, ghetto-fabulous way to keep the crystal in place:

    IMAG0704.jpg


    :) (But, hey - it works)
    1024 x 612 - 60K
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2011-08-22 18:23
    Maybe you could shoehorn the crystal and IC's leads that way?
  • CalMarinerCalMariner Posts: 64
    edited 2011-08-22 18:24
    Well, that explains why it would loop back to zero. I set it to

    IF hrs > 23 THEN
    hrs = 0
    ELSE
    hrs = hrs + 1
    ENDIF

    Maybe I will try to change the HEX to DEC again.
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2011-08-22 18:25
    OK, now I'm getting a headache.
  • CalMarinerCalMariner Posts: 64
    edited 2011-08-22 18:26
    The IC is too tight on the breadboard. With this arrangement, I observed a 0.001% change in accuracy (about 6 minutes each year).
  • CalMarinerCalMariner Posts: 64
    edited 2011-08-22 18:27
    PJ, I really do appreciate your help thus far. Don't worry about it - the clock runs. :)
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2011-08-22 18:35
    What, me worry? :zombie:
  • CalMarinerCalMariner Posts: 64
    edited 2011-08-22 18:35
    You seem to be the only one who cares.
  • CalMarinerCalMariner Posts: 64
    edited 2011-08-22 18:45
    UPDATE Just fixed a funny little glitch where the clock would display only the seconds at [00:00:01]. I found that the display suppresses the leading zeroes. Fixed it with a couple of letter O's when hrs < 1.

    Next...
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2011-08-22 19:20
    You seem to be the only one who cares.
    That's me, "Mr. Caring", "The Good Shepherd" - ask anyone.
  • ercoerco Posts: 20,256
    edited 2011-08-22 20:00
    PJ Allen wrote: »
    That's me, "Mr. Caring", "The Good Shepherd" - ask anyone.

    PJ's DEFINITELY the real deal!
  • CalMarinerCalMariner Posts: 64
    edited 2011-08-24 10:55
    Now that I have to put it inside the display housing, I still need to DEBUG and connect to my PC. Ideally, I would just use a 1/8" TRS plug, but I wonder if this (3) is enough pins for communication with the BS2.
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2011-08-24 11:05
    Does that mean it's all working right then?
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2011-08-24 11:13
    You only "need" to lead out 2,3,4,5 to the Stamp if you jumper 6 and 7 (the loopback check, the IDE figures it's connected when it sees that) on the PC side.

    Attachment not found.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2011-08-24 12:30
    There is a project I posted that uses the DS1302 and normally displays the time on a MAX7219 display driver, but it also shifts the binary data out to shift registers for binary mode. Perhaps there's some code in there that would be helpful to you for handling the DS1302 data. You can find the Binary Digital Clock here. You can also find a Digital Alarm Clock project here. I hope these help.
  • CalMarinerCalMariner Posts: 64
    edited 2011-08-24 15:39
    It is working perfectly, except for the HEX/DEC thing. Oh, and I cooked one of my switches' LEDs. Can't fix that with code.
  • CalMarinerCalMariner Posts: 64
    edited 2011-08-24 15:45
    Okay, panel-mount serial it is. Or maybe USB...
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2011-08-24 18:07
    ...except for the HEX/DEC thing.
    I thought we'd made some progress there.
    DEC 59 is HEX 3b (3 16s and 11 1s).
  • RDL2004RDL2004 Posts: 2,554
    edited 2011-08-25 06:59
    When bread-boarding with those chips, the best way to attach the crystal is to gently bend the chip leads up away from the board and solder the crystal directly to the chip. However, inserting both the chip and the crystal's leads into the same holes works okay. It's a tight fit, but I've done it on a variety of boards, including the Board of Education and the Professional development board.
  • CalMarinerCalMariner Posts: 64
    edited 2011-08-25 17:01
    I understand the difference now, but I'm still working on how to modify the program. For now, I am focusing on installing the hardware inside my display. It really comes down to either buying a Parallax board, or building one of my own.
Sign In or Register to comment.