C Program Examples - 7
/* Configure resistance limit for output probe test. */ cfSetOutputProbeTest(hServer, 0.1f);
/* Mark outputs 65 - 256 as unused by this fixture. */ cfSetOutputConfig(hServer, 1, 14, CF_SET_ACTIVE); cfSetOutputConfig(hServer, 15, 256, CF_SET_INACTIVE);
/*
*Turn on the fixture ready light to tell the operator that the
*system is ready for a new tray of cells.
*/
cfGetDigitalPort(hServer, &nDigitalPort); nDigitalPort = DIG_READY_LIGHT; cfSetDigitalPort(hServer, nDigitalPort);
/*
*Poll serial port A for data from the bar code reader.
*/
while (1)
{
cfReadSerial(hServer, CF_PORTA, MAX_BARCODE, szBarCodeMsg, &nBarCodeCount);
/* Check the data for a token that indicates end of data.
*When token is found, break out of loop. (not shown)
*/
break;
/* Sleep for 1 second to suspend this process, but allow
*other processes to continue to run.
*/
Sleep(1000);
}
/*
*Process the barcode message to determine what forming sequence
*should be downloaded to the fixture. (not shown in this example)
*/
/* Download the forming sequence. */
cfSetSeqStep(hServer, 1, CF_CHARGE, 4.0f, 1.0f, 300.0f, 0.0f); cfSetSeqStep(hServer, 2, CF_REST, 0.0f, 0.0f, 60.0f, 0.0f); cfSetSeqStep(hServer, 3, CF_DISCHARGE, 0.5f, 2.0f, 120.0f, 0.0f); cfSetSeqTest(hServer, 1, CF_VOLT_LE, 0.5f, CF_TEST_AFTER, 120.0f,
CF_FAIL);
cfSetSeqTest(hServer, 1, CF_VOLT_GE, 4.0f, CF_TEST_AFTER, 0.0f, CF_NEXT); cfSetSeqTest(hServer, 3, CF_VOLT_LE, 1.0f, CF_TEST_AFTER, 0.0f, CF_NEXT);
/* Poll the fixture; wait until it is closed. */ while (1)
{
cfGetDigitalPort(hServer, &nDigitalPort); if (nDigitalPort & DIG_FIXTURE_READY)
break;
/* Sleep for 1 second. */ Sleep(1000);
}
/*
*Poll digital port for START button pressed.
*Since lines are not latched, must press button > 1 second.
*/
while (1)