How do I read the system clock using a C-MEX S-Function on the target PC using xPC Target?

2 views (last 30 days)
I would like to be able to read the system clock using a Level-2 C-MEX S-Function on the target PC using xPC Target.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
The xPC Target documentation does not describe how to read the system clock in a C-MEX S-Function on the target PC. The attached model has an S-function that illustrates how to do this.
1. Download the attached files "xpcosctimeofday.mdl" and "xpctimeofday2.c" and place them in your MATLAB working directory.
2. MEX the C-file using the following command
mex xpctimeofday2.c
3. Build and download the model to the target PC. Execute the model on the target PC.
The scope of type target should display the system time on the target PC monitor.
4. Examine the "xpctimeofday2.c" file for details on how the system time was obtained in the S-function.
  1 Comment
Sriram Narayanan
Sriram Narayanan on 26 Feb 2015
Hi Gianpiero,
If you right-click on these attachments and click on "Save Link as", this should bring up the browser to save them to a particular locations.
Thanks,
~Sriram

Sign in to comment.

More Answers (0)

Categories

Find more on Introduction to Installation and Licensing in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!