this is no possible. Writing in the trace file occurs only when a message is read. Since PCAN-Basic doesn't read messages actively, but only when you call the function CAN_Read, or CAN_ReadFD (according to your configuration), you cannot adjust a time for flushing data. The only thing you could is to read slower, but I think this could be more a backdraw than a progress.
then you just need to call CAN_Read less frequently. Each call to the CAN_Read function will return just one message, so you can use a timer, set its interval to the frequency you want to read and call the CAN_Read function each time the time elapses. But keep in mind that doing so could lead to queue overruns errors, if the queue gets full because it is being read to slow. Note that the reception queue can contain up to 32767, and there is no parameter in PCAN-Basic to ask the current message count of it. You may want to set a filter, if you are expecting just a set of IDs.
Just to read a message "later" doesn't mean that they will change their timestamps. You need to understand more how CAN works.
If you just want to take a "snapshot" of the data at certain point and to have this in a trace file, then you will need to do more steps. Note that a trace file is actually thought to get "all" data you are transmitting. I see folowing ways to go:
- As I said before, setting of some filters to just get interesting messages for you. In this way, not all data received but the data important for you is placed in the trace file.
- You could start and stop tracing each time you need to get data. The problem here is that you will have several trace files (one for every trace trigger you do).
- You can use the parameter PCAN_RECEIVE_STATUS (see PCAN-Parameter_Documentation.pdf). Configuring this to off tells the API to discard messages coming from the device. Configuring this to on again, restores the reception of messages. You could use a timer to enable this each X amount of time, wait the time you want to trace messages, and disabling it again.