DS1337 - 12h to 24h mode


Results 1 to 31 of 31

Threaded View

  1. #5
    Join Date
    May 2013
    Location
    australia
    Posts
    2,722


    Did you find this post helpful? Yes | No

    Default Re: DS1337 - 12h to 24h mode

    this may be better


    Code:
    If(PortC.5 = 1) & (PortC.6 = 1) then Pause 1500
      If (PortC.5 = 1) & (PortC.6 = 1) then
       'IF hourly mode = AM
       I2CRead SDApin,SCLpin,$D0,$02,[RTCHour] 
       temp1 = ((RTCHour>> 4) * 10) + (RTCHour& $0f)    , to binary
    
       if RTCHour.6=1  then   ' 12h mode 
            if RTCHour.5=1then  temp1=temp1+12  ' pm
       
       else  
             if temp1 > 12 then
             temp1=temp1-12
       endif
    
      rtcHOUR = ((temp1 / 10) << 4) + (tEmp1 // 10)  ' to bcd
      
    
     RTCHour.6 = ! RTCHour.6  '  set/reset   24h mode
    
       I2cwrite SDApin,SCLpin,$D0,$02,[RTCHour]     
      endif
     endif
    Last edited by richard; - 13th January 2015 at 22:48. Reason: add som comments

Similar Threads

  1. 12H format setting for DS1307
    By larzazral in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 23rd February 2010, 07:34
  2. example code for DS1337
    By TONIGALEA in forum mel PIC BASIC Pro
    Replies: 25
    Last Post: - 8th December 2009, 21:16
  3. Code for DS1337
    By Fernanda in forum Off Topic
    Replies: 2
    Last Post: - 21st July 2008, 20:18
  4. PBPro for 16-bit PICs (24F/24H/DSPICs)?
    By Sergeant in forum mel PIC BASIC Pro
    Replies: 14
    Last Post: - 20th April 2007, 20:18
  5. DS1337 Problem
    By snow in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 9th January 2005, 12:17

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