I'll gave you the answer here. It's about RTCC from PIC18F44J11

procedure display_treatment_time (byte in line, byte in pos) is

RTCCFG_RTCPTR1 = 0
RTCCFG_RTCPTR0 = 0
 if RTCCFG_RTCSYNC == 0 then
    second = RTCVALL   ; read second, bcd packed St1St2
 end if
   St2 = (second & 0b0000_1111)
   St1 = ((second >> 4) & 0b0000_1111)*10  ; convert to hexa
   second = St1 + St2
   second_trt = 59 - second  ; decrement treatment time

   if second == 59 then          ; here is the trick I've asked about, can
you do it better?
      old_second = second
   end if

   if (second == 0) & (old_second == 59) then
      old_second = 0
      minute_trt = minute_trt - 1
   end if

   if minute_trt == 0 then ; stop treatment
      minute_trt = 29
   end if
  lcd_cursor_position (line,pos)
  print_decimal_2 (lcd, minute_trt, "0")
  lcd = ":"
  print_decimal_2 (lcd, second_trt, "0")
end procedure

On Tue, Jun 29, 2010 at 9:50 AM, Sunish Issac <[email protected]> wrote:

> working on ds1302 ? First it was bcd, I did some coding recently, but needs
> some cleanup.
> BTW I did not understand your question clearly.
>
> Sunish
>
> On Tue, Jun 29, 2010 at 12:02 PM, vasile surducan <[email protected]>wrote:
>
>> Hi all,
>>
>> I have the following problem: one second register of an RTCC is
>> incremented from 0 to 59. Every new value of the register remains unchanged
>> exactly one second (including 0 and 59). I need to sense every rollover of
>> that register from 59 to 0 to increment a minute register. The second
>> register can't be modified because it keeps the real time. How that can be
>> done ? (there is no other flag available)
>>
>> thx,
>> Vasile
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "jallib" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected]<jallib%[email protected]>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/jallib?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "jallib" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<jallib%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/jallib?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jallib?hl=en.

Reply via email to