Shop OBEX P1 Docs P2 Docs Learn Events
Time conversion — Parallax Forums

Time conversion

ArchiverArchiver Posts: 46,084
edited 2003-09-20 20:42 in General Discussion
Dear colleagues,


I would like to measure the speed of a conveyor.
I have a contact which give me a top once per rotation.

I have a RTC connected to my BS2 giving me the real time but in HEX format.
How can I calculate the difference in time between two top in order to know the
speed of my conveyor.


Any help would be appreciated,


Charles


[noparse][[/noparse]Non-text portions of this message have been removed]

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2003-09-20 17:33
    I would look into using the Count command and all you timing is included in
    the command

    Larry Gaminde



    Original Message
    From: "Charles Weiskopf" <cw002@d...>
    To: <basicstamps@yahoogroups.com>
    Sent: September 20, 2003 9:28 AM
    Subject: [noparse][[/noparse]basicstamps] Time conversion


    > Dear colleagues,
    >
    >
    > I would like to measure the speed of a conveyor.
    > I have a contact which give me a top once per rotation.
    >
    > I have a RTC connected to my BS2 giving me the real time but in HEX
    format.
    > How can I calculate the difference in time between two top in order to
    know the speed of my conveyor.
    >
    >
    > Any help would be appreciated,
    >
    >
    > Charles
    >
    >
    > [noparse][[/noparse]Non-text portions of this message have been removed]
    >
    >
    > To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    > from the same email address that you subscribed. Text in the Subject and
    Body of the message will be ignored.
    >
    >
    > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
    >
    >
  • ArchiverArchiver Posts: 46,084
    edited 2003-09-20 20:42
    >Dear colleagues,
    >I would like to measure the speed of a conveyor.
    >I have a contact which give me a top once per rotation.
    >I have a RTC connected to my BS2 giving me the real time but in HEX format.
    >How can I calculate the difference in time between two top in order
    >to know the speed of my conveyor.
    >Any help would be appreciated,
    >Charles

    Hi Charles,
    Convert time to elapsed seconds:
    ' hours, minutes,seconds are hex, convert to seconds
    ' RT, from 0 to 3600

    RT = (minutes.nib1*10+minutes.nib0)*60+(seconds.nib1*10+seconds.nib0)

    Do that at each tap, then when the next tap comes along, find the
    difference between the the old RT and the new RT.
    elapsed = RT - RT0 + 3600 // 3600 ' modular math to make it work
    when it crosses the hour.
    RT0 = RT ' new value now becomes old


    Assume taps are less than 1 hour apart. There will be error if the
    taps are only a few seconds apart.

    -- Tracy
Sign In or Register to comment.