Shop OBEX P1 Docs P2 Docs Learn Events
SX Clock/alarm clock — Parallax Forums

SX Clock/alarm clock

ACE227ACE227 Posts: 15
edited 2009-10-08 19:35 in General Discussion
I have started to work on·my clock·and hit a problem. I want to blank the first digit when the digit is not in use.
I have included my code with the post as well.

Thank you
ACE227


Post Edited (ACE227) : 10/9/2009 2:07:36 AM GMT

Comments

  • T&E EngineerT&E Engineer Posts: 1,396
    edited 2009-09-16 17:24
    Try adding what is in bold to your subroutines below:
    ' Display timer in MM.SS (00.00 .. 59.59) format with solid DP
    SUB CLOCK_MMSS      ' display mins & secs
      tmpB1 = mins / 10     ' get 10's digit
      tmpB2 = __REMAINDER     ' save 1's digit
      READ SegMap + tmpB1, display(3)
      READ SegMap + tmpB2, display(2)
      display(2) = display(2) | DecPnt   ' add DP to hr01 digit
      tmpB1 = secs / 10
      tmpB2 = __REMAINDER
      READ SegMap + tmpB1, display(1)
      READ SegMap + tmpB2, display(0)
      [b]IF display(0) = %00111111 THEN  ' if 1st digit is a 0 then blank
         display(0) = %00000000[b]  ENDIF[/b][/b]  
      HIGH LED
      PAUSE 500
      LOW LED
      PAUSE 500
      IF TmrEnable = TmrRun THEN
        GOTO Main
      ELSE
        ChangeSec
      ENDIF
    ENDSUB
    
    ' -------------------------------------------------------------------------
    ' Display timer in HH.MM (00.00 .. 23.59) format with blinking DP
    CLOCK_HHMM:      ' display hours & mins
      tmpB1 = hrs / 10
      tmpB2 = __REMAINDER
      READ SegMap + tmpB1, display(3)
      READ SegMap + tmpB2, display(2)
      IF blink = Yes THEN
        display(2) = display(2) | DecPnt   ' blink DP on hr01 digit
      ENDIF
      tmpB1 = mins / 10
      tmpB2 = __REMAINDER
      READ SegMap + tmpB1, display(1)
      READ SegMap + tmpB2, display(0)
    [b]  IF display(0) = %00111111 THEN  ' if 1st digit is a 0 then blank
         display(0) = %00000000[/b]
    [b]  ENDIF[/b]
      HIGH LED
      PAUSE 500
      LOW LED
      PAUSE 500
      IF TmrEnable = TmrRun THEN
        GOTO Main
      ELSE
        ChangeMin
      ENDIF
    ENDSUB
    
    
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2009-09-18 04:01
    You should use the pencil icon to the top right of your message to add a descriptive subject to your post as well. Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage

    Parallax Engineering
    50 72 6F 6A 65 63 74 20 53 69 74 65
    ·
  • ACE227ACE227 Posts: 15
    edited 2009-09-18 16:08
    Thank you Tim. That helped me out a lot.
  • ACE227ACE227 Posts: 15
    edited 2009-10-08 16:44
    I have another question with my clock.
    I got it to work on my circut board and I put in two leds. I want to blink one led once every second and the other led to blink once every ten seconds. Now I had the led for ever second to blink but the code would wait until it read through the code before continuing to the next step. I would like to know how to put in that bit of code and always run but not interupt the other coding.
    Thanks for all the help.
    ACE227
  • Mike GreenMike Green Posts: 23,101
    edited 2009-10-08 16:59
    Please add a descriptive subject to your message as Chris requested.
  • ACE227ACE227 Posts: 15
    edited 2009-10-08 17:33
    What are you looking for Mike?
  • Shawn LoweShawn Lowe Posts: 635
    edited 2009-10-08 19:35
    Ace-
    If you add a subject to your message, you'll be helping people who have your exact problem. Your solution can help them, but not if they can't find the posting.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Shawn Lowe


    When all else fails.....procrastinate!
Sign In or Register to comment.