Read Init timestamp from PEAK-USB

This forum covers third party software that is for example developed with our APIs
Post Reply
mallendemarcos
Posts: 4
Joined: Tue 8. Dec 2020, 10:41

Read Init timestamp from PEAK-USB

Post by mallendemarcos » Tue 8. Dec 2020, 10:49

Hello.
I need to know the exact initialization timestamp value for a PEAK-USB. I know that this time is related with windows start time, but I'm wondering if I can read this value from PEAK. It is very usefull because I can create an absolut zero when messages are comming to synchronize with other HW.
I don't want to wait till first CAN message has arrived to read this value.
Thanks in advanced.
Miguel.

M.Heidemann
Sales & Support
Sales & Support
Posts: 1083
Joined: Fri 20. Sep 2019, 13:31

Re: Read Init timestamp from PEAK-USB

Post by M.Heidemann » Tue 8. Dec 2020, 11:11

Hello,

Could you clarify to which PCAN-API you are refering to specifically?

Also i assume you are using a windows platform, can you confirm?

Best Regards

Marvin
---
Marvin Heidemann
PEAK-Support Team

mallendemarcos
Posts: 4
Joined: Tue 8. Dec 2020, 10:41

Re: Read Init timestamp from PEAK-USB

Post by mallendemarcos » Thu 10. Dec 2020, 00:40

Hello.
I have PCAN_basic API for Labview. I have also purchased PCANDeveloper (Labview), but I'm not using it for this application.
Miguel.

M.Heidemann
Sales & Support
Sales & Support
Posts: 1083
Joined: Fri 20. Sep 2019, 13:31

Re: Read Init timestamp from PEAK-USB

Post by M.Heidemann » Thu 10. Dec 2020, 08:57

Hello Miguel,

The driver calculates the reception based on "QueryPerformanceCounter" of the WIN-32 API with
the information given by the hardware. You could use the "QueryPerfomanceCounter" to set a reference point.

PCANBasic itself does not have a function to returning this value without having messages involved,
and the above solution is not representative of the actual time the driver initializes the device but
rather when the driver will return to PCANBasic, that it has initialized the device. There'll be deviations
depending on your System (As Windows is no Real-time system) on how close to actual device initialization
this reference point will be.

If this is a valid appraoch for you is dependent on the level of accuracy needed.

THE PCAN-Developer API however has a function returning the current system time retrieved from the driver, look
for:

"CAN_GetSystemTime"

in your PCAN-Developer 4 documentation.

This might be more appropiate for your intended use.

For further questions feel free to contact me again.

Best Regards

Marvin
---
Marvin Heidemann
PEAK-Support Team

Post Reply