Time conversion
Archiver
Posts: 46,084
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]
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
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/
>
>
>
>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