Transmitting & Receiving Date/Time

Discussion in 'C-Bus Serial Protocols' started by mark_curd, Jul 15, 2011.

  1. mark_curd

    mark_curd

    Joined:
    Mar 28, 2009
    Messages:
    20
    Likes Received:
    0
    Location:
    Maidstone, UK
    Is there anyway of receiving the current date and time from the network?

    I am just setting up a 3rd party touch panel and have got a settings menu that I'm working on for adjusting the time and date on the cbus network. This is working fine and I can transmit to the network and it will update as it should, but I would like to get feedback to display the current time before change on the touch panel.

    I have read the protocol but can't find anything about receiving back information. Did I miss something?

    Thanks
     
    mark_curd, Jul 15, 2011
    #1
  2. mark_curd

    Newman

    Joined:
    Aug 3, 2004
    Messages:
    2,203
    Likes Received:
    0
    Location:
    Adelaide, South Australia
    The command you are looking for is called "Request Refresh". It pushes a message out into the network asking for the current date and time settings. The unit that is the current time master will respond. If no response is received then there is no device on the network capable of operating as the time master device. It should all be there in the protocol docs for date and time.

    If this is in a 3rd party Touchscreen then you'll need quite a long time-out after sending this message. I can't remember the fine detail but it's in the order of several seconds. This is to enable the correct device to respond.

    If you ever get the idea that you want this touchscreen to send time and date information into the network then I suggest you don't do this unless you have to. There's quite a few different states and conditions to work through. In regular C-Bus-land this ensures that the devices with the most accurate time and date information always bubble to the surface as the devices in charge of regular time and date broadcasts. Participating in this process as a 3rd party can be done but it will take some time to get right and can muck things up if you get it wrong.
     
    Newman, Jul 16, 2011
    #2
  3. mark_curd

    Darren Senior Member

    Joined:
    Jul 29, 2004
    Messages:
    2,361
    Likes Received:
    0
    Location:
    Adelaide, South Australia
    There are different documents for each C-Bus Application. You will need to read the one called "Clock and Timekeeping Application".
     
    Darren, Jul 16, 2011
    #3
  4. mark_curd

    ashleigh Moderator

    Joined:
    Aug 4, 2004
    Messages:
    2,392
    Likes Received:
    24
    Location:
    Adelaide, South Australia
    As Newman points out, if you want to be a time master and transmit information - its complex. IF you go down that path, read that document (Clock and Timekeeping application) at least 10 times before cutting your first line of code. Then allow a month of testing to get it right. Trust me on this :)
     
    ashleigh, Jul 16, 2011
    #4
  5. mark_curd

    mark_curd

    Joined:
    Mar 28, 2009
    Messages:
    20
    Likes Received:
    0
    Location:
    Maidstone, UK
    Thanks for the info.

    I am not wanting the touchpanel to act as the time master in the system. This will be handled via the PAC interface.

    What I am trying to achieve is to extract the date and time from the cbus network and display it on touchpanel.

    I have setup on the panel a manual date and time entry, which I can transmit to the network but this will only be used in the event of either a large power cut where the system date/time is lost or for what ever other reason I want to change the date/time etc. I'm hoping not to have to use it often, but it's there if I need it.

    I have read the protocol for "Clock and Timekeeping Application" and I did try "Request Refresh", however I did not see any message received back from the network. You mention about time-out? can you elaborate a little for me please.

    In the mean time I will re read over the protocol docs again.

    Thanks
     
    mark_curd, Jul 16, 2011
    #5
  6. mark_curd

    ashleigh Moderator

    Joined:
    Aug 4, 2004
    Messages:
    2,392
    Likes Received:
    24
    Location:
    Adelaide, South Australia
    Righto....

    Firstly, you need another device on the C-Bus network which can act as a date and time master. From memory I think a PAC can do this (but I'm not 100% sure).

    The timeout you need to allow after transmitting a Request Refresh should be about 2 to 10 seconds (or less), it's not much. If there is a master device out there it will as a general rule reply within about 1-2 seconds, or maybe even less.

    So if you have no reply, it seems like you have no device that's acting as master.

    If your device is to transmit a date and time, then this will be fine, the master device should accept that and use it to form an update to it's current timebase. The except being that something locked to NTP (ie internet time) will only make an adjustment to its known daylight saving time offset.

    Most master device will have a hold-up period of >6 hours (typically about 12 to 24 hours), so you should see that in the event of a major power failure, the time mastering device don't lose time anyhow.

    Hope this helps.
     
    Last edited by a moderator: Jul 17, 2011
    ashleigh, Jul 16, 2011
    #6
  7. mark_curd

    Darren Senior Member

    Joined:
    Jul 29, 2004
    Messages:
    2,361
    Likes Received:
    0
    Location:
    Adelaide, South Australia
    Do you have a device on the network which supports the time application, like a touch screen, Wiser or PAC?

    You don't have to use the Request Refresh command. If you wait long enough (up to 90 minutes) then you will see the regular date/time message broadcast by the Time Master.

    You just need to allow enough time (a second or two) for the Time Master to reply.
     
    Darren, Jul 17, 2011
    #7
  8. mark_curd

    mark_curd

    Joined:
    Mar 28, 2009
    Messages:
    20
    Likes Received:
    0
    Location:
    Maidstone, UK
    Yes this helps!

    Yes I have a PAC which is the device that is acting as the date and time master.

    At the moment I will need to "Request Refresh" once per minute, until I can implement something within the touch panel to just update every 90min or so.

    I now have this working OK, I reset the PAC unit and get a reply when I "Request Refresh" maybe it didn't set itself to act as the date and time master when it was first installed?

    Thanks for the help
     
    mark_curd, Jul 17, 2011
    #8
  9. mark_curd

    ashleigh Moderator

    Joined:
    Aug 4, 2004
    Messages:
    2,392
    Likes Received:
    24
    Location:
    Adelaide, South Australia
    Nooooooooooooo!!!

    DO NOT do a Request Refesh every minute or 2!!!!!

    This is polling, and in C-Bus POLLING IS EVIL AND YE SHALL BE BANISHED UNTO THE FIRES OF HELL FOR DOING IT.

    Your device should do this once, on start up, and after that pretty much never again.

    Your device should be capable of maintaining its own clock with a reasonable accuracy. "Reasonable" in this context means that it should drift by < 1 second over a period of several weeks. Most things that use crystal oscillators for a real time clock or even a main processor clock are more than capable of this.

    The time master will issue time/date updates periodically - typically the interval ranges between about 30 minutes and 2 hours depending on the quality (stability) of the device that is being the master. More stable devices transmit with smaller intervals to give an automatic arbitration system.

    The time master does this all by itself, you do not need to request a refresh again in order for this to happen.

    So.... once you have acquired the time you should "free run" from then on, the time master will give you a periodic update all by itself.
     
    ashleigh, Jul 17, 2011
    #9
  10. mark_curd

    mark_curd

    Joined:
    Mar 28, 2009
    Messages:
    20
    Likes Received:
    0
    Location:
    Maidstone, UK
    Sorry maybe I should have made it a little more clear, I am NOT intending to poll the network constantly hence the reason I mentioned I will be implementing something in the touch panel to keep track of time and will just keep this updated from the messages being sent out like you say.

    When I refer to "At The Moment" I actually mean just during testing the modual I am writing, even then it won't be every minute just only when required to test.
     
    mark_curd, Jul 17, 2011
    #10
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.