How do timetags work?

Our cards have a 45-bit time tag counter and a 45-bit Time Tag Counter Load Register. The Time Tag Counter Register has the current time tag value. The Time Tag Counter Load Register contains a 45-bit time value that the board uses to update the Time under certain events. Several BusTools/1553-API routines control these counter registers. These BusTools_TimeTagXXX functions are described in the BusTools/1553-API User's Manual. Please review these functions to see all the options available.

BusTools_TimeTagMode defines the time-tag format in messages the Bus Monitor records and the Remote Terminals send. The "Reset Timetag on Sync" option also controls the timetag. Enabling this option (BusTools_SetOptions) sets the hardware timetag counter to the value of the Time Tag Counter Load Register when the board receives a Synchronize Mode Code. BusTools_TimeTagWrite writes a 45-bit time value to the Time Tag Counter Load Register. You might also want to look at BusTools_TimeTagInit. The API calls this function when the Bus Monitor starts (e.g., by a call to BusTools_BM_StartStop() to initialize the Timetag Counter.) A user program can also call this function at any time to initialize the Timetag Counter.

If you want to reset (clear) the time tag on each sync mode code, you would write a 0 out to the Time Tag Counter Load Register during initialization and set the "Reset Timetag on Sync" option. This automatically resets the Time Tag without further software intervention. However, if you want to update the tag time, you need to pre-program the Time Tag Counter Load Register with the time value for the next sync mode code. When the sync mode code occurs, the Board loads this value into the Time Tag Counter. You can also set up an interrupt with the BusTools_RegisterFunction routine to loads the next value into the Time Tag Counter Load Register when the sync mode code occurs. For Example if you get the sync mode code every second you would pre-load the Time Tag Counter Load register with 1000000. Then when the first sync mode code occurs, the time Tag Counter gets set to 1000000. You would use the interrupt on the mode code to then load the Time Tag Counter Load Register with the next value, 2000000.