Forum Index
HomeZBasic Home   Forum RulesForum Rules   Forum FAQForum FAQ   MemberlistMemberlist   UsergroupsUsergroups   RSS FeedRSS Feed
Site SearchSite Search   LinksLinks   DownloadDownload   Digests and SubscriptionsDigests and Subscriptions
ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in   RegisterRegister
Nomination for new function: Auto-set date/time

 
Post new topic   Reply to topic    Forum Index -> ZBasic IDE
Author Message
stevech



Joined: 23 Feb 2006
Posts: 657

Posted: 07 January 2007, 21:29 PM    Post subject: Nomination for new function: Auto-set date/time Reply with quote

When the IDE downloads new code to the ZX, it would be nice if it by default sends the date/time (from the PC's clock) to initialize the VM's date/time keeping. I suppose there could be a user-option to disable this.
Back to top
mikep



Joined: 24 Sep 2005
Posts: 765
Location: Austin, TX

Posted: 07 January 2007, 21:44 PM    Post subject: Re: Nomination for new function: Auto-set date/time Reply with quote

stevech wrote:
When the IDE downloads new code to the ZX, it would be nice if it by default sends the date/time (from the PC's clock) to initialize the VM's date/time keeping. I suppose there could be a user-option to disable this.
This is a good idea but has some limitations.

The problem is that unless some specific action is taken that downloaded time lasts exactly until the next power on.

So if the user has a RTC circuit with battery backup, this downloaded time could be transferred to the RTC. The time would have to be downloaded last. Even so the time would be not quite correct.
Back to top
stevech



Joined: 23 Feb 2006
Posts: 657

Posted: 07 January 2007, 22:00 PM    Post subject: Reply with quote

Currently, I have code that saves the date/time to RAM that survives a VM-restart. Once a second it saves this to the RAM area. And restores this to the VM clock upon a reset.

I use this instead of a clock chip. It loses a couple of seconds when there's a reset due to DTR toggling (grrrr) when a serial port terminal launches. But it's good enough. The hiding place I use in RAM is a hack for sure. My application, of course, accepts date/time setting via a serial port command.

I uploaded to this forum the code to hide date/time in RAM during a reset.
Back to top
dlh



Joined: 15 Dec 2006
Posts: 266
Location: ~Cincinnati

Posted: 07 January 2007, 23:12 PM    Post subject: Re: Nomination for new function: Auto-set date/time Reply with quote

stevech wrote:
When the IDE downloads new code to the ZX, it would be nice if it by default sends the date/time (from the PC's clock) to initialize the VM's date/time keeping. I suppose there could be a user-option to disable this.

I don't use the IDE but always download from within my Windows application and am currently revising it to do everything using native VB code rather than the ZBasic DLL. As soon as it is debugged I'll send Don a small VB app that demonstrates downloading software and updating the VM using all native VB code.

Whenever it resets, my ZBasic code sends a request to the PC to update the timestamp. For standalone operation I'm adding an optional battery-backed RTC using the ST M41T81. The app will auto-detect the M41T81 and use it when available. The M41T81 has calibration registers to allow fine tuning its accuracy and also can track how long power was off - it updates the time in the background but doesn't update the output registers. When power is restored you can first get the time it was lost and then update the output registers and get the current time.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Forum Index -> ZBasic IDE Time synchro. with the server - Timezone/DST with your computer
Page 1 of 1

 


All content Copyright © 2005-2012 Elba Corp. All Rights Reserved.
Opinions expressed in posts are those of the author and not necessarily those of Elba Corp.
Powered by phpBB © 2001, 2005 phpBB Group