コード例 #1
0
/**
* 
* @brief Perform a test using the scanner card of the Instek in 
*        the 8261
*/
void Instek8261Serial::ScanTest(void) {
    UtilTimer cmdTimer;
    UtilTimer scanTimer;
    int length;
    int numBytesRx;

    for (int j = 0; j < 1; j++) {

        cmdTimer.ResetStartTimestamp();

        for (int i = 0; i < 4; i++) {

            scanTimer.ResetStartTimestamp();
            uint64_t elapsedScanTime = 0;
            sprintf(m_buffer, "rout:func scan\n");
            printf("%ld ms, Sending cmd: %s", cmdTimer.GetElapsedMillisec(), m_buffer);
            length = strlen(m_buffer);
            SendCmd(m_buffer, length);

            numBytesRx = GetResponse(m_buffer, SERIAL_BUF_LENGTH, 10000);
            m_buffer[numBytesRx] = 0;
            printf("%ld ms, %s", cmdTimer.GetElapsedMillisec(), m_buffer);
            elapsedScanTime = scanTimer.GetElapsedMillisec();
            printf(">>>> SCAN DURATION: %ld ms <<<<\n", elapsedScanTime);

            sprintf(m_buffer, "*trg\n");
            printf("%ld ms, Sending cmd: %s", cmdTimer.GetElapsedMillisec(), m_buffer);
            length = strlen(m_buffer);
            SendCmd(m_buffer, length);

            sprintf(m_buffer, "fetc?\n");
            printf("%ld ms, Sending cmd: %s", cmdTimer.GetElapsedMillisec(), m_buffer);
            length = strlen(m_buffer);
            SendCmd(m_buffer, length);

            numBytesRx = GetMultiResponse(m_buffer, SERIAL_BUF_LENGTH, 10000, 3);
            m_buffer[numBytesRx] = 0;
            printf("%ld ms, response:\n%s", cmdTimer.GetElapsedMillisec(), m_buffer);

            sprintf(m_buffer, "ROUT:FUNC OFF\n");
            printf("%ld ms, Sending cmd: %s", cmdTimer.GetElapsedMillisec(), m_buffer);
            length = strlen(m_buffer);
            SendCmd(m_buffer, length);

            // float tempF;
            // In8261ReadTemp(tempF);
            // printf("Temp: %f\n", tempF);

            // float voltF;
            // In8261ReadDCVolt(voltF);
            // printf("Volt: %f\n", tempF);

        }

        sprintf(m_buffer, "ROUT:FUNC OFF\n");
        printf("%ld ms, Sending cmd: %s", cmdTimer.GetElapsedMillisec(), m_buffer);
        length = strlen(m_buffer);
        SendCmd(m_buffer, length);

        sprintf(m_buffer, "*trg\n");
        printf("%ld ms, Sending cmd: %s", cmdTimer.GetElapsedMillisec(), m_buffer);
        length = strlen(m_buffer);
        SendCmd(m_buffer, length);

    }
}
コード例 #2
0
/**
* 
* @brief Perform Instek Configuration 
*/
void Instek8261Serial::ScanInit(void) {
    // bool status = false;
    UtilTimer cmdTimer;
    int length;
    // int numBytesRx;

    for (auto& x: m_CmdInitStrings) {
        char *cmdP = (char *)x.data();
        printf("Sending cmd: %s", cmdP);
        length = strlen(cmdP);
        SendCmd(cmdP, length);
        QThread::sleep(500);
    }

    sprintf(m_buffer, "rout:adv on\n");
    printf("Sending cmd: %s", m_buffer);
    length = strlen(m_buffer);
    SendCmd(m_buffer, length);

#if 0
    sprintf(m_buffer, "AVER:COUN?\n");
    printf("Sending cmd: %s", m_buffer);
    length = strlen(m_buffer);
    numBytesRx = SendCmdAndGetResponse(m_buffer, length, m_buffer, SERIAL_BUF_LENGTH, MILLISEC_1000);
    printf("response: %s", m_buffer);

    sprintf(m_buffer, "AVER:STAT?\n");
    printf("Sending cmd: %s", m_buffer);
    length = strlen(m_buffer);
    numBytesRx = SendCmdAndGetResponse(m_buffer, length, m_buffer, SERIAL_BUF_LENGTH, MILLISEC_1000);
    printf("response: %s", m_buffer);

    sprintf(m_buffer, "rout:mult:stat?\n");
    printf("Sending cmd: %s", m_buffer);
    length = strlen(m_buffer);
    SendCmd(m_buffer, length);
    numBytesRx = GetMultiResponse(m_buffer, SERIAL_BUF_LENGTH, 10000, 18);
    m_buffer[numBytesRx] = 0;
    printf("%response:\n%s", m_buffer);
    Sleep(1000);

    sprintf(m_buffer, "rout:chan? 101\n");
    printf("Sending cmd: %s", m_buffer);
    length = strlen(m_buffer);
    numBytesRx = SendCmdAndGetResponse(m_buffer, length, m_buffer, SERIAL_BUF_LENGTH, MILLISEC_1000);
    printf("response: %s", m_buffer);
    // Sleep(1000);

    sprintf(m_buffer, "rout:chan? 102\n");
    printf("Sending cmd: %s", m_buffer);
    length = strlen(m_buffer);
    numBytesRx = SendCmdAndGetResponse(m_buffer, length, m_buffer, SERIAL_BUF_LENGTH, MILLISEC_1000);
    printf("response: %s", m_buffer);
    // Sleep(1000);

    sprintf(m_buffer, "rout:chan? 103\n");
    printf("Sending cmd: %s", m_buffer);
    length = strlen(m_buffer);
    numBytesRx = SendCmdAndGetResponse(m_buffer, length, m_buffer, SERIAL_BUF_LENGTH, MILLISEC_1000);
    printf("response: %s", m_buffer);
    // Sleep(1000);

    sprintf(m_buffer, "temp:tco:type?\n");
    printf("Sending cmd: %s", m_buffer);
    length = strlen(m_buffer);
    numBytesRx = SendCmdAndGetResponse(m_buffer, length, m_buffer, SERIAL_BUF_LENGTH, MILLISEC_1000);
    printf("response: %s", m_buffer);
    Sleep(1000);

    sprintf(m_buffer, "temp:tco:res?\n");
    printf("Sending cmd: %s", m_buffer);
    length = strlen(m_buffer);
    numBytesRx = SendCmdAndGetResponse(m_buffer, length, m_buffer, SERIAL_BUF_LENGTH, MILLISEC_1000);
    printf("response: %s", m_buffer);
    Sleep(1000);

    sprintf(m_buffer, "sens:det:rate M\n");
    printf("Sending cmd: %s", m_buffer);
    length = strlen(m_buffer);
    SendCmd(m_buffer, length);
    Sleep(2000);

    sprintf(m_buffer, "det:rate?\n");
    printf("Sending cmd: %s", m_buffer);
    length = strlen(m_buffer);
    numBytesRx = SendCmdAndGetResponse(m_buffer, length, m_buffer, SERIAL_BUF_LENGTH, MILLISEC_1000);
    printf("response: %s", m_buffer);
    Sleep(500);

    sprintf(m_buffer, "rout:adv on\n");
    printf("%ld ms, Sending cmd: %s", cmdTimer.GetElapsedMillisec(), m_buffer);
    length = strlen(m_buffer);
    SendCmd(m_buffer, length);

    sprintf(m_buffer, "ROUT:FUNC OFF\n");
    printf("%ld ms, Sending cmd: %s", cmdTimer.GetElapsedMillisec(), m_buffer);
    length = strlen(m_buffer);
    SendCmd(m_buffer, length);

    sprintf(m_buffer, "*trg\n");
    printf("%ld ms, Sending cmd: %s", cmdTimer.GetElapsedMillisec(), m_buffer);
    length = strlen(m_buffer);
    SendCmd(m_buffer, length);
#endif

}