This is just info to help someone else searching for how to calculate time slip from a DL1 MK3 or newer serial data stream.
The time slip equation given in the Knowledge Base is not correct. After some playing with it comparing with the values shown in my Dash3 I've finally gotten it figured out.
Knowledge Base says:
Time slip = Data8 (resolution of 0.1s, maximum value of +/-12seconds)
Now this works for positive numbers, but doesn't account for negative numbers. Essentially the MSB is a flag for a negative number, so 10001000 is negative because it starts with a 1. It is also the lowest value, -12.0 seconds. -0.1 seconds is 11111111, then it flips to 00000000 and starts counting up again. Here is what I came up with:
Time slip = ( Data8 AND 0x7F ) * 0.1
If (Data8 AND 0x80) != 0 Then Time slip = Time slip - 12.8
So the first part ignores the first bit, and multiplies to get seconds. The second part looks at the first bit only, and determines whether it should be negative.
Another way of writing this could be:
If Data8 > 120 Then Time slip = (Data8 - 256)*0.1
Else Time slip = Data8*0.1
However I did some testing on an Arduino, and this simpler looking method actually takes ~60% longer to calculate.
Hopefully this helps someone, this took me quite a bit of head scratching today to get it figured out.
1 post • Page 1 of 1
Who is online
Users browsing this forum: No registered users and 2 guests