05-25-2007 11:53 AM
05-27-2007 06:36 AM
Hello Khan,
where do you experience the timeout? When writing or when reading from RS232?
I cannot see what your function "SendCommand" is doing. How does this function know what to do? Especially it does not have a parameter "ComPort" although your problem description says, that you can test multiple UUTs at a time.
Maybe you'd like to provide more source code details?
Another chance might be to have a look at the RS232 sample projects that come with CVI. Modify e.g. the "serial.prj" and check, if you can reproduce the timeout behaviour.
Hope this helps, Guenter
05-30-2007 11:59 AM
First thing I do is to configure the RS232 from the drop down menu in the program. It works fine, since i don't see an error then a window pops up which is the "Start-Up Tests", here are the instructions from the procedure to follow.
5.4 Start-up tests
1. Select “Yes” on startup tests window (Figure 4).
2. Enable present system boards then click “Start” to run the tests (Figure 5).
3. All buttons should be “GREEN” (Figure 6). Record the Start-up tests status for
Tables 1-3 in Appendix A. Then click “Close” to exit the Start-up test window.
4. If a button is “RED” (see Figure 7 for
Receiver board problem example), stopthe test. Start board troubleshooting until the problem is solved. Repeat the
Start-up tests steps 1-3.
After basically box turns green the pop-up window has a close button, that closes the window. Now we are back to main program screen. we choose what board to communicate with, we select the AA (Acc. & Aux board) this a chooseable or scroll menu and then on the side we have click the RB box and PS box whcih turns it to OFF and leave AA box to ON and and DHRF (this the control board that is communicating with our UUT boards) to ON and from the drop down menu choose Common Tool -> Execute Selftest, then it suppose give us the results on a seperate window called "Selftests Results". When I choose the Execute Selftest , this is were I get the timout error and it says to increse the timeout however incresing the timeout from the RS232 configuration window does not solve the issue. I will appreciate if some one point me to where the problem may be. Thanks
int CVICALLBACK OnStartUpTesting (int panel, int control, int event,
void *callbackData, int eventData1, int eventData2)
{
char word[10], tempstr[10000];
int status;
switch (event)
{
case EVENT_COMMIT:
SetCtrlAttribute (StartUpTestsPanelH, StartUpTST_COMMANDBUTTON, ATTR_DIMMED, 1);
GetCtrlVal (StartUpTestsPanelH, StartUpTST_RB_Test, &status);
if (status)
{
/****Receiver section**********/
SetComTime_Vali (comport, 15.0); /*restore original timeout*/
Delay(0.05);
FlushInQ_Vali(comport);
strcpy (tempstr, "03cc");
SendCommand(tempstr, 1, 1, 0, 0);
tempstr[0] = '\0';
ComRd_Vali (comport, tempstr, 259);
tempstr[259] = '\0';
RS232Error = ReturnRS232Err_Vali ();
if(RS232Error)
SetCtrlAttribute (StartUpTestsPanelH, StartUpTST_RB_Test, ATTR_ON_COLOR, VAL_RED);
else
{
FlushInQ_Vali(comport);
CopyString (word, 0, tempstr, 12, 4);
if ( CompareStrings (word, 0, "0000", 0, 1) != 0)
SetCtrlAttribute (StartUpTestsPanelH, StartUpTST_RB_Test, ATTR_ON_COLOR, VAL_RED);
else
{
CopyString (word, 0, tempstr, 136, 4);
if ( CompareStrings (word, 0, "0000", 0, 1) != 0)
SetCtrlAttribute (StartUpTestsPanelH, StartUpTST_RB_Test, ATTR_ON_COLOR, VAL_RED);
else
{
CopyString (word, 0, tempstr, 141, 4);
if ( CompareStrings (word, 0, "0000", 0, 1) != 0)
SetCtrlAttribute (StartUpTestsPanelH, StartUpTST_RB_Test, ATTR_ON_COLOR, VAL_RED);
else
{
/***add here the RB data demodulation test***********/
SetCtrlAttribute (StartUpTestsPanelH, StartUpTST_RB_Test, ATTR_ON_COLOR, VAL_GREEN);
}
}
}
}
}
SetComTime_Vali (comport, timeout); /*restore original timeout*/
Delay(0.05);
FlushInQ_Vali(comport);
ProcessDrawEvents(); ProcessSystemEvents();
GetCtrlVal (StartUpTestsPanelH, StartUpTST_PS_Test, &status);
if (status)
{
/*****Sequencer section*********/
SetComTime_Vali (comport, 15.0); /*restore original timeout*/
FlushInQ_Vali(comport);
strcpy (tempstr, "02cc");
SendCommand(tempstr, 1, 1, 0, 0);
tempstr[0] = '\0';
ComRd_Vali (comport, tempstr, 292);
tempstr[292] = '\0';
RS232Error = ReturnRS232Err_Vali ();
if(RS232Error)
SetCtrlAttribute (StartUpTestsPanelH, StartUpTST_PS_Test, ATTR_ON_COLOR, VAL_RED);
else
{
FlushInQ_Vali(comport);
CopyString (word, 0, tempstr, 12, 4);
if ( CompareStrings (word, 0, "0000", 0, 1) != 0)
SetCtrlAttribute (StartUpTestsPanelH, StartUpTST_PS_Test, ATTR_ON_COLOR, VAL_RED);
else
{
CopyString (word, 0, tempstr, 136, 4);
if ( CompareStrings (word, 0, "0000", 0, 1) != 0)
SetCtrlAttribute (StartUpTestsPanelH, StartUpTST_PS_Test, ATTR_ON_COLOR, VAL_RED);
else
{
CopyString (word, 0, tempstr, 168, 4);
if ( CompareStrings (word, 0, "0000", 0, 1) != 0)
SetCtrlAttribute (StartUpTestsPanelH, StartUpTST_PS_Test, ATTR_ON_COLOR, VAL_RED);
else
{
CopyString (word, 0, tempstr, 173, 4);
if ( CompareStrings (word, 0, "0000", 0, 1) != 0)
SetCtrlAttribute (StartUpTestsPanelH, StartUpTST_PS_Test, ATTR_ON_COLOR, VAL_RED);
else
SetCtrlAttribute (StartUpTestsPanelH, StartUpTST_PS_Test, ATTR_ON_COLOR, VAL_GREEN);
}
}
}
}
}
SetComTime_Vali (comport, timeout); /*restore original timeout*/
ProcessDrawEvents(); ProcessSystemEvents();
/****AA section*********/
GetCtrlVal (StartUpTestsPanelH, StartUpTST_AA_Test, &status);
if (status)
{
SetComTime_Vali (comport, 0); /* we have to increase the timeout; the selftest can take 10-20 sec.*/
Delay(0.05);
FlushInQ_Vali(comport);
strcpy(tempstr, "04b4");
SendCommand(tempstr, 1, 0, 0, 0);
selfteststr[0] = '\0';
ComRd_Vali (comport, selfteststr, 131);
selfteststr[131] = '\0';
RS232Error = ReturnRS232Err_Vali ();
if (RS232Error)
SetCtrlAttribute (StartUpTestsPanelH, StartUpTST_AA_Test, ATTR_ON_COLOR, VAL_RED);
else
{
Delay(0.5); FlushInQ_Vali(comport);
CopyString (word, 0, selfteststr, 7, 4);
if ( CompareStrings (word, 0, "0000", 0, 1) == 0)
SetCtrlAttribute (StartUpTestsPanelH, StartUpTST_AA_Test, ATTR_ON_COLOR, VAL_GREEN);
else
SetCtrlAttribute (StartUpTestsPanelH, StartUpTST_AA_Test, ATTR_ON_COLOR, VAL_RED);
}
}
SetComTime_Vali (comport, timeout); /*restore original timeout*/
ProcessDrawEvents(); ProcessSystemEvents();
SetCtrlAttribute (StartUpTestsPanelH, StartUpTST_COMMANDBUTTON_2, ATTR_VISIBLE, 1);
SetCtrlAttribute (StartUpTestsPanelH, StartUpTST_COMMANDBUTTON, ATTR_VISIBLE, 0);
SetActiveCtrl (StartUpTestsPanelH, StartUpTST_COMMANDBUTTON_2);
break;
}
return 0;
}
05-30-2007 02:32 PM
here is more code, thanks
This is actually for execute self test:
/************************************************************************************************************/
/*******************************Performs the selftest for th MRX boards**************************************/
/************************************************************************************************************/
void CVICALLBACK ExecSelftest (int menuBar, int menuItem, void *callbackData, int panel)
{
if (CheckMaxisActiveActionStatus(0) == 1)
return;
TurnChksONandDesactivateSend(0);
strcpy(tempstr, "\nExecuting Selftest for the selected Board. Please wait 15-20 sec...\n");
SetCtrlVal (panel_handle, SERIAL_TBOX_READ, tempstr);
SetComTime_Vali (comport, 30); /* we have to increase the timeout; the selftest can take 10-20 sec.*/
status = InstallComCallback_Vali (comport, 0, 0, 13, 0, NULL); IsCommDisabled = 1; SetCtrlVal(panel_handle, SERIAL_TOGGLEBUTTON, 0); IsCommDisabled = 1;
FlushInQ_Vali(comport);
sprintf( tempstr, "%sb4", BoardId);
SendCommand(tempstr, 1, 0, 0, 0);
selfteststr[0] = '\0';
ComRd_Vali (comport, selfteststr, 131);
selfteststr[131] = '\0';
RS232Error = ReturnRS232Err_Vali ();
if (RS232Error)
{
DisplayRS232Error ();
strcpy(tempstr, "An error was encountered. Seftest aborted.\n");
SetCtrlVal (panel_handle, SERIAL_TBOX_READ, tempstr);
Delay(0.5); FlushInQ_Vali(comport);
COMCallbackCntr = 0; IsCommDisabled = 0; FlushInQ_Vali(comport); status = InstallComCallback_Vali (comport, LWRS_RXFLAG, 0, 13, COMCALLBACKFUNCTION_ID, NULL);
SetCtrlVal(panel_handle, SERIAL_TOGGLEBUTTON, 1);
SetComTime_Vali (comport, timeout); /*restore original timeout*/
ExitMaxisActionActiveState ();
return;
}
Delay(0.5); FlushInQ_Vali(comport);
SetCtrlVal (SelftestPanelH, SELFTEST_TEXTMSG_8, "Testing...");
SetCtrlAttribute (SelftestPanelH, SELFTEST_TEXTMSG_8, ATTR_TEXT_COLOR, VAL_BLACK);
SetCtrlAttribute (SelftestPanelH, SELFTEST_TEXTMSG_8,ATTR_TEXT_STRIKEOUT, 0);
InstallPopup (SelftestPanelH);
ClearSelftestPanel(); UpdateSelftestPanel();
strcpy(tempstr, "Selftest finished\n");
SetCtrlVal (panel_handle, SERIAL_TBOX_READ, tempstr);
COMCallbackCntr = 0; IsCommDisabled = 0; FlushInQ_Vali(comport); status = InstallComCallback_Vali (comport, LWRS_RXFLAG, 0, 13, COMCALLBACKFUNCTION_ID, NULL);
SetCtrlVal(panel_handle, SERIAL_TOGGLEBUTTON, 1);
SetComTime_Vali (comport, timeout); /*restore original timeout*/
ExitMaxisActionActiveState ();
}