I have a problem passing an AI value from a Fieldpoint module to print out to a log file. However I'm able to pass other values from a second panel on the UIR.
Is there something I'm missing or should I take a different approach when dealing with FPAdviseCallback function?
void CVICALLBACK FPAdviseCallBack(void* buffer)
{
IAByte* Databuffer;
FP_CallbackParamType g_param;
float* value;
int i,j;
/* See the Function Panel FP_Advise item "Callback Function" for more information
on this callback and it's data types*/
g_param = *((FP_CallbackParamType*) buffer);
Databuffer = g_param.buffer;
value = (float*)(Databuffer);
SetCtrlVal (panelHandle, PANEL_AI0, *value);
value = (fl
oat*)(Databuffer+4);
SetCtrlVal (panelHandle, PANEL_AI1, *value);
}
int CVICALLBACK configureUSER(int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
switch (event)
{
case EVENT_COMMIT:
SetCtrlVal (panelHandle, CONFIGURE_USER, User);
GetCtrlVal (panelHandle, PANEL_USER, User);
}
int CVICALLBACK logFilebutton(int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
switch (event)
{
case EVENT_COMMIT:
FILE * logFileptr;
/* Write to file */
logFileptr = fopen ("c:\\logfile.txt", "a");
fprintf (logFileptr, "\t%.2e", User);
fprintf (logFileptr, "\t%.2e", PANEL_AI0);
fprintf (logFileptr, "\t%.2e", PANEL_AI1);
fclose(bakeoutLogFilePtr);
}
The FpAdviseCallBack and configureUSER functions works fine in displaying the values in the panel. When I exectute the logFilebutton function it is able to write to the file but the "PANEL_AI0 and PANEL_AI1" send
values from their #define values. The "User" string in the log files works fine.