Synchronization with PC
Posted: Thu Nov 01, 2012 4:29 pm
Dear Cohen,
I recently had to synchronize the biosemi with a PC with no specific event or stimuli presented on the PC. For this purpose I made a short program that sends every second a trigger on the parrallel port connected to the Biosemi USB box. Using the following formula I can then compute the PC time at which the trigger was sent:
approaxPCTimeTrigger = (timeBeforeTrigger + timeAfterTrigger) / 2
Since the trigger is also present in the BDF file I can associate any PC times to a BDF sample and vice versa. Since the PC and Biosemi clock are different I was expecting to observe a drift from the beginning of the experiment to the end (for instance the PC could count the time more slowly than the Biosemi). This is indeed what I observed: the number of seconds elapsed from the beginning of the experiment to the end differed by 0 to 20 milliseconds in one direction or another (approax 45 minutes of experiment). I checked and the drift is linear. As I said I find a linear drift completly normal. What I do not understand is why it differs from a recording to another: sometimes nearly 0 drift and sometime a difference of 20 milliseconds in the end. All the recordings were done on the same PC but on different days and thus different boots.
My questions:
- do you know if the clock of a PC behaves differently from a boot to another ?
- if I want to asign a time to the signals should I better trust the Biosemi (counted as number_of_samples / sampling_frequency) or the PC time ?
As always a great thanks for your help,
Guillaume
I recently had to synchronize the biosemi with a PC with no specific event or stimuli presented on the PC. For this purpose I made a short program that sends every second a trigger on the parrallel port connected to the Biosemi USB box. Using the following formula I can then compute the PC time at which the trigger was sent:
approaxPCTimeTrigger = (timeBeforeTrigger + timeAfterTrigger) / 2
Since the trigger is also present in the BDF file I can associate any PC times to a BDF sample and vice versa. Since the PC and Biosemi clock are different I was expecting to observe a drift from the beginning of the experiment to the end (for instance the PC could count the time more slowly than the Biosemi). This is indeed what I observed: the number of seconds elapsed from the beginning of the experiment to the end differed by 0 to 20 milliseconds in one direction or another (approax 45 minutes of experiment). I checked and the drift is linear. As I said I find a linear drift completly normal. What I do not understand is why it differs from a recording to another: sometimes nearly 0 drift and sometime a difference of 20 milliseconds in the end. All the recordings were done on the same PC but on different days and thus different boots.
My questions:
- do you know if the clock of a PC behaves differently from a boot to another ?
- if I want to asign a time to the signals should I better trust the Biosemi (counted as number_of_samples / sampling_frequency) or the PC time ?
As always a great thanks for your help,
Guillaume