RTC

Started by November 12, 2001
Has the BX-24 a real RTC?

I have tried to program using PutTime() and PutDate() but every time
I re-run, it forgets the stored data.

How is Done?
Please help.



Resetting the BX will reinitialize the RTC.

You must incorporate a method to refresh the RTC using an external clock
device or by sending a Time/Date stamp down the serial line, reading it, and
set the RTC from that.

The latter is what I currently use. My PC network synchronizes itself to
the world Atomic Clocks using the Tardis freeware program. I then use
custom written timekeeping modules in both vbCode and bxCode that read the
network server clock, format the results and send it to the BX. The BX in
turn, extracts the Time/Date stamp from the serial data and updates the RTC
anytime the RTC is found to be out of sync with the world clocks.

This method only works if the BX is in communication with a PC or network.
Others use an external device. Depends on your need.

.db.

-----Original Message-----
From: [mailto:]
Sent: Sunday, November 11, 2001 9:10 PM
To:
Subject: [BasicX] RTC Has the BX-24 a real RTC?

I have tried to program using PutTime() and PutDate() but every time
I re-run, it forgets the stored data.

How is Done?
Please help.


The RTC registers do not survive a reset. Since there is no battery
backup, they do not survive a power cycle.

On 12 Nov 2001, at 4:10, wrote:

> Has the BX-24 a real RTC?
>
> I have tried to program using PutTime() and PutDate() but every time I
> re-run, it forgets the stored data.
>
> How is Done?
> Please help. > ------------------------ Yahoo! Groups Sponsor
> ---------------------~--> Universal Inkjet Refill Kit $29.95 Refill
> any ink cartridge for less! Includes black and color ink.
> http://us.click.yahoo.com/r9F0cB/MkNDAA/ySSFAA/CFFolB/TM
> ---------------------------------~
> - >
> ">http://docs.yahoo.com/info/terms/


---
http://www.laser.com/dhouston/


I thought I remembered seeing a post from waaaay back that said something
to the effect that if you don't need seconds resolution with the RTC, you
could somehow pad it and save tieing up 32 bytes for the seconds ( a
single, right?). Something along the lines of..

Call GetTime(hours, minutes, 0.0)

Was I hallucinating about this or can it be done if one just needs to
resolve minutes in a timer?

Ken
------ http://www.ah6le.net
The new RC-110 Repeater Controller is now shipping. For details see:
http://www.ah6le.net/arcom/rc110.html
AH6LE/R - IRLP Node 3000
http://www.irlp.net




> ... Call GetTime(hours, minutes, 0.0)

I recall a discussion that explained why using the same variable to discard
a portion of the time, e.g. Call GetTime(bDummy,bDummy,sSeconds), can
produce an unexpected result, but substituting a constant for a varname in
GetTime won't work [in PutTime, constants are permitted, e.g. Call PutTime
(0,0,0.0)]. In any event, the seconds var is 4 bytes, not 32. Tom Becker
--... ...--
www.RighTime.com
The RighTime Clock Company, Inc., Cape Coral, Florida USA


At 02:34 PM 1/27/2003 -0500, you wrote:
In any event, the seconds var is 4 bytes, not 32.

<-Thanks Tom. And yea.. brainfart here - a single uses 32 BITS (4 bytes)..
I knew that! :-)

In any case, I'm really pushing the limits of the '24's RAM in my app and
even a 4 byte saving would be nice.....Thanks for the info...

Ken
------ http://www.ah6le.net
The new RC-110 Repeater Controller is now shipping. For details see:
http://www.ah6le.net/arcom/rc110.html
AH6LE/R - IRLP Node 3000
http://www.irlp.net




If you want to conserve ram, consider using Timer instead of the real
time clock. Timer is a single returning the time in seconds since
midnight.

Andy --- In , Ken Arck <ph@a...> wrote:
> At 02:34 PM 1/27/2003 -0500, you wrote:
> In any event, the seconds var is 4 bytes, not 32.
>
> <-Thanks Tom. And yea.. brainfart here - a single uses 32 BITS (4
bytes)..
> I knew that! :-)
>
> In any case, I'm really pushing the limits of the '24's RAM in my
app and
> even a 4 byte saving would be nice.....Thanks for the info...
>
> Ken
>
--------------
----------------------------
> President and CTO - Arcom Communications
> http://www.ah6le.net
> The new RC-110 Repeater Controller is now shipping. For details see:
> http://www.ah6le.net/arcom/rc110.html
> AH6LE/R - IRLP Node 3000
> http://www.irlp.net




From: <>

> If you want to conserve ram, consider using Timer
> instead of the real time clock. Timer is a single
> returning the time in seconds since midnight.

Yes, good suggestion. You could also use Register.RTCTick, which
keeps track of the number of clock ticks since midnight, and uses
even less overhead, although unit conversion is less convenient.

-- Frank Manning
-- NetMedia, Inc.


From: "Tom Becker" <>

>> ... Call GetTime(hours, minutes, 0.0)
>
> I recall a discussion that explained why using the same
> variable to discard a portion of the time, e.g.
> Call GetTime(bDummy,bDummy,sSeconds), can produce an
> unexpected result, [...]

Yes, as I recall this was because of aliasing. In that version of
GetTime, the hour value was being calculated as a function of the
minute value, which meant the two variables needed to be different
variables.

If they happened to be the same variable, then the math didn't
work out right. Here's a simple example:

'--------
Sub Main()

Dim A As Byte, B As Byte, C As Byte

Call GetC(A, B, C)
Debug.Print "C = "; CStr(C) ' C = 9

Call GetC(A, A, C)
Debug.Print "C = "; CStr(C) ' C = 12

End Sub
'--------
Sub GetC( _
ByRef X As Byte, _
ByRef Y As Byte, _
ByRef Z As Byte)

X = 3

Y = 2 * X

Z = X + Y

End Sub
'--------

When you call GetC, the value of C is always supposed to be 9, but
in the second call to GetC, the value of 12 is returned, which is
wrong. This is because parameters X and Y are assumed to be
different variables, but they're not.

You get the same results by running the program in VB6,
incidentally.

-- Frank Manning
-- NetMedia, Inc.


Hy. My question today is the following. Why if I use the instruccion
PutTimestamp with my basicx-24 and program date and time , later if I
run the instruccion GetTimestamp after power off and on I don't have
the programed value. Do I need a battery backup or why I have to do
for maintene the value all the time without re pogram the RTC. Thanks in advance
Edgardo
Omtis CEO