Probably the simplest way to do this involves the use of timers. Do you need to record the value at EXACTLY 7:00:00 a.m. and p.m.?
I would create a timer on your uir and set the interval between 1 and 30 seconds, depending on how close to 7:00:00 you want it. I would choose the 30 seconds to reduce the burden on your system. Make sure it is Enabled. I assume you do not have any loops that your app would be stuck in for more than 30 seconds. Then in your timer callback, if you want to use TimeStr() you can compare the result to 7:00.
Perhaps something like this:
int CVICALLBACK MyTimerCB (int panel, int control, int event, void *callbackData, int eventData1, int eventData2)
{
char szTime[9];
static int nPMSearch = TRUE; // Keep track if betw
een 7am and 7 pm
static int nAMSearch = TRUE; // Keep track if before 7am
int nResult = 0;
szTime = TimeStr() // Get the time
if (nAMSearch == TRUE)
{
// We must be before 7:00 am
nResult = FindPattern (szTime, 0, -1, "7:00:", 0, 0);
if (nResult >=0)
{
// Must have found 7:00 am
nAMSearch = FALSE;
nPMmSearch = TRUE;
// Read the pH Here
// Write the pH to a file here
}
}
if (nPMSearch == TRUE)
{
nResult = FindPattern (szTime, 0, -1, "19:00:", 0, 0);
if (nResult >=0)
{
// Must have found 7:00 pm
nAMSearch = TRUE;
nPMSearch = FALSE;
// Read the pH Here
// Write the pH to a file here
}
return 0;
}
There are several ways to do this, but this is probably one of the simplest using the TimeStr() function. Hope this helps.