Matching time conditions


Closed Thread
Results 1 to 40 of 49

Hybrid View

  1. #1
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    LOL -

    Dave, whist I can display the DEC value using and LCD using that code, I still can't apply it to a variable that can be worked with,

    any ideas... I simply want something like alarmhour= DEC(HEXRTCHour). It seems that whilst you can use DEC to convert and display a value or send a value via coms, you can't directly apply it.

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    I was thinking not to worry about comparing to a DEC. Convert the BCD and compare to the conversion.

    If you can not get a solution I will work something up when I get back to the shop tonight.
    Dave
    Always wear safety glasses while programming.

  3. #3
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Dave, something like

    Code:
    HEXRTCHour = RTCHour & $70
    if alarm & $70 = HEXRTCHour then
         alarmled=1
        endif
    If so then how do I set the value for the variable alarm ?

    Thanks for the offer of some assistance. If you prefer to drop me a pm with e-mail addy, it might save space on the forum server ? - there is also no rush...

  4. #4
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Here's an idea from a previous thread ...

    Calculating Time for clock's preset
    http://www.picbasic.co.uk/forum/show...8913#post58913
    <br>
    DT

  5. #5
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default

    How about something like this?
    Code:
    alarm = %1001  ' The ninth hour...
    RTCHour_BIN = ((RTCHour >> 4) * 10) + (RTCHour & $0f) ' Converts BCD to Binary
    Dave
    Always wear safety glasses while programming.

  6. #6
    Join Date
    Sep 2004
    Location
    Mentor, Ohio
    Posts
    352


    Did you find this post helpful? Yes | No

    Smile

    Hi Malc-c,

    I think I have a grip on what you want to do.

    Have you given any thought to using a DS1337 RTC? It has 2 alarms. You can set the alarm times any time you need to change the times. I use it for a clock project and work the entire program including sending time/date information out to a serial display all in HEX. I operate the clock in the 24 hour mode. I even have a test routine that changes the alarm times from the programmed alarm times to 1 minute + current time and put that time in the alarm A register and 2 minutes + current time in the alarm B register then lets me test the actual operation of my project in just a few minutes then restores the normal alarm times. I have had 75 of these clocks out in the field since April of 2007.

    Let me know if this is of any interest to you.

    BobK

  7. #7
    malc-c's Avatar
    malc-c Guest


    Did you find this post helpful? Yes | No

    Default

    Hi Bob,

    The reason I'm using the 1307 is that it's fitted to the module used with the EasyPIC 5 board, however I could always breadboard a 1337, so your offer of assistance would be very welcome.

    I'll drop you a pm as from what you are saying, the two alarms are ideal for my project

    Thanks

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