Syncs and stores the computer time reference in the USB Timing Box. This command should be executed upon connecting, if the computer time reference is not set yet.
Call
EPOCHREFSET;<epoch:8>\n
Reply
EPOCHREFSET;00\n [ComputerTime:8];[TimeStamp:8]\n \n
Reply after 2s DTR timeout
EPOCHREFSET;10\n \n
Response
|
[ComputerTime] |
new computer reference time stored in the USB Timing Box. |
|
[TimeStamp] |
Internal time base time stamp captured and stored in the USB Timing Box at DTR-Line trigger. |
Example
← EPOCHREFSET;4a3caa45\n // June 20 2009 11:22:14 UTC+2 == 0x4a3caa45
⇅ toggle DTR line // Time set on rising edge of DTR
→ EPOCHREFSET;00\n
→ 4a3caa45;0151bcf5\n // ref_computer_time;ref_time_stamp
→ \n
0x4a3caa45 is the current number of computer time seconds since 1. Jan 1970. The time is set when the DTR line is toggled. The response returns the computer time and the corresponding internal time stamp at that moment.
Within 2s of your EPOCHREFSET call you need to briefly set the DTR-Line to HIGH to trigger the actual time synchronization. Best practice is to call EPOCHREFSET with the next full seconds EPOCH and then poll your computer system time in a loop until the full second time is reached to then "trigger" the sync by setting the DTR-Line HIGH for 200ms.
This pseudocode describes the needed operation on your computer:
cmdString = "EPOCHREFSET;" + toHex(epoch_Time_Now() + 1) + "\n" // cmdString == 'EPOCHREFSET;4a3caa46\n' write_Serial ( cmdString ) wait_until_next_second() set_Serial_DTR ( HIGH ) // Time set on rising edge of DTR sleep_200ms () set_Serial_DTR ( LOW ) sleep_200ms () rcv = read_next_line_Serial() // rcv == 'EPOCHREFSET;00\n' rcv = read_next_line_Serial() // rcv == '4a3caa46;0151bcf5\n' ref_computer_time = split_into_array( rcv, ";")[0] // ref_computer_time == 0x4a3caa46 ref_time_stamp = split_into_array( rcv, ";")[1] // ref_time_stamp == 0x0151bcf5
You should store ref_computer_time and ref_time_stamp in your application for processing passings.
This DTR-Line procedure is needed to ensure the best possible accuracy in the presence of operating system data buffering on the SERIAL port. In case your serial implementation has no control over the DTR line, you can disable the DTR line of the USB Timing Box calling
CONFSET;0b;00\n