Jump to content
OMRON Forums

How to access Sys.Time in the C programs


Sina.Sattari

Recommended Posts

The Sys.Time is accessible through the terminal and script programs, but not through the C programs and neither through the shared memory structure. How can a user get the same response in the C programs? Well you can access the same data by doing the same calculations that the PMAC does when Sys.Time is queried: [code] #include #include #include "../../Include/pp_proj.h" int main(void) { int counter; SHM *pSHM; // defining a pointer to the shared memroy location // using this pointer you can access most of the structures InitLibrary(); // Initializing the Library pSHM = GetSharedMemPtr(); //Initializing the pointer to the shared memory for( counter=0; counter<10; counter++) { // How to get Sys.Time in the C programs // Whenever the Sys.Time is called in the GPASCII, the following calculation is done // fclock() system function will return an unsigned 64 bit integer value representing the time passed since last $$$ or power-up // the ClockSF will convert the output of fclock() to microseconds // the 1e-6 will convert it to seconds printf("%f\n",1e-6*pSHM->ClockSF*u64btod(fclock())); usleep(1000000); } CloseLibrary(); return 0; } [/code]
Link to comment
Share on other sites

  • 5 months later...
  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Guest
This topic is now closed to further replies.

×
×
  • Create New...