I am using the toggle button (checkbox) to control which analog output valve will be sent to the FP-AO-200. The checkbox is supposed to represent the user�s choice between using
a. manual mode (Here the user inputs a value between 4 and 20mA to send to the FP-AO-200) or
b. automatic mode (Here the input supplied to the FP-AO-200 is gathered from a text file)
When the box is checked the program is suppose to go into automatic mode.
My problem is that I am having trouble with the following:
I am trying to develop a way for the program multiple checkboxes are checked. I have eight channels that need to be checked by the checkbox. Currently the program only reads one checkbox. I have come up with two ways to work the problem. I needed to know if these ideas are right, and some help to implement them. Below I have provided the two ideas I am trying to implement:
The Applications engineer, Mr. Roberto Bozzdo told me to use this. I had some trouble trying to decide to get this command to read to read all eight channels. I wanted to know is it was legal to use a for-loop in the call back function. I thought would cause another problem because the valve of val is continuously changing. Is val representing a true false command to read 1/0?
int CVICallback read (int panel, int control, int event,
void*callbackData, int eventData1, int eventData)
{
int val;
switch (event) {
case EVENT_COMMIT;
GetCtrlVal (panel, control, &val); // Read the control status
if (val) { // Box checked: put your program in automatic mode }
else { // Box uncheked: ask the user the value}
err=FP_Read (FP_handle,IO_handle,value,256,�tamp);
if (err) {
printf (�passed\n�);}
}
return 0;
}
The second way using the GETCtrlVal ( ) with a different for-loop, but I don�t know if I am using the correct callback function. Here I tried to combine the commands for the manual mode with the commands for the automatic mode of the program. Below is a sample of my source code:
int CVICallback read (int panel, int control, int event,
void*callbackData, int eventData1, int eventData)
{
IAStatus status = IA_SUCCESS;
int i; //For-loop counter variable
float temp; //Temorary hold value
int val; //Is this a bool value
switch (event) {
case EVENT_COMMIT;
//Get status of the check boxes
for ( i=0; i
{ GetCtrlVal(panHandle, i+PANEL_CHECKBOX, &val)
if (val)
{ //Go to automatic mode }
else
{ for ( i=0; i {
GetCtrlVal(panelHandle, i+PANEL_NUMERICO, &temp)
Memcpy (value(+_I*4).&temp, 4);
}
status=FP_Write (FP_handle, IO_handle, valve, BUFFER_SIZE);
}
Thank you very much for your help.