Gammatech Posted November 15, 2010 Share Posted November 15, 2010 I know that DaqFactory only reads the Windows clock at first run and then uses its own precision timer thereafter. Is it possible to read the Windows clock and get this into a variable? My system displays the current time read from an external device connected via the serial port. I have a button for the user to update the remote device with time derived from DaqFactory but I would like to be able to update from the current windows time as an alternative. Thanks, Martin Link to comment Share on other sites More sharing options...
AzeoTech Posted November 15, 2010 Share Posted November 15, 2010 You can load usertime.dll which is located on this forum somewhere. You'll need to rename it so DAQFactory doesn't use it for its primary time, then load it using extern(). The prototype to get the time is simply: double GetTime(void) Link to comment Share on other sites More sharing options...
Gammatech Posted November 16, 2010 Author Share Posted November 16, 2010 I unzipped the UserTime.Zip and renamed the .dll file as "GetWinTime.dll" and placed this in my DaqFactory directory. In my initialization routines I put: Extern("C:\DaqFactory\GetWinTime.dll","double GetWinTime(void)","GetWinTime","stdcall","Gets the windows clock") Then in the first line of the action for the button that was to get the windows time I put: TempVM1Time = GetWinTime() When the button is pressed the alert: C1000 Channel or function not found: Line 1 - Unable to perform quick sequence action is displayed. So what is wrong with my Extern() declaration. Martin Link to comment Share on other sites More sharing options...
AzeoTech Posted November 16, 2010 Share Posted November 16, 2010 Nothing really. You don't need the "void". Did you get an error when you ran the extern()? Link to comment Share on other sites More sharing options...
Gammatech Posted November 16, 2010 Author Share Posted November 16, 2010 No. I have just tried it in the command window with the void removed so there are just empty bracckets and I also took out the optional tip. Under these conditions it generates C1000. Watching GetWinTime() gives C1000. Link to comment Share on other sites More sharing options...
Gammatech Posted November 16, 2010 Author Share Posted November 16, 2010 Found It! The Extern call should be: Extern("C:\DaqFactory\GetWinTime.dll","double GetTime()","GetWinTime","stdcall") whereas I had "double GetWinTime()" as the second parameter Seems to work now, at least in the watch window. Martin Link to comment Share on other sites More sharing options...
AzeoTech Posted November 17, 2010 Share Posted November 17, 2010 Its amazing how sometimes one (or in this case, two of us) can miss something so simple! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.