The usb connection problem and the ps5000aOpenUnit were unsu

Post your C and C++ discussions here
Post Reply
xiaohao
Newbie
Posts: 0
Joined: Thu Jun 15, 2017 9:48 am

The usb connection problem and the ps5000aOpenUnit were unsu

Post by xiaohao »

Hello, dear friend
The usb connection problem and the ps5000aOpenUnit were unsuccessful
I use Qt5.3 and use of c + + programming language, new to this product belongs to the novice, met with some problems, the hope can give to solve some guidance to the usb device connection is successful, I know is that under the project file to add in QT
Win32: LIBS + = -l $$PWD / -lps5000a,
Call # include "picostate.h"
# include "ps5000aApi. H"
These two files are added to my editor's file to call the function, not knowing whether or not there is a bug.
Now, let me just say, this is what happens to me,
I was using a 5242 b,
And the calling is # include "5000aApi. H" and
# include "PicoStatus. H"
But had a few problems with usb connection time, always does not display and usb connection, I gave an if statement if the status = PICO_OK, then in the status bar displays connected devices, if not, then the status bar shows no connection,
Unable to find the open cell, only one progress bar is full, and debug shows "WaitForMultipleObjects Complete."
The following is a program that doesn't understand why the connection is unsuccessful

Code: Select all

void PicoLogger::on_Connect_clicked()
{
    UNIT unit;
     int8_t serial;
    PICO_STATUS status;

    QMainWindow::statusBar()->showMessage("寻找设备……");
    QString statusChar = QString::number (status);

    if (serial == NULL)
    {
        status=ps5000aOpenUnit(&(unit.handle),NULL,PS5000A_DR_8BIT);
    }
    else
    {
        status=ps5000aOpenUnit(&(unit.handle),unit.serial,PS5000A_DR_8BIT);    
    }

    unit.openStatus = (int16_t) status;
    unit.complete = 1;
   //  return status;

if( status=PICO_OK){

        QMainWindow::statusBar()->showMessage("示波器连接设备: " + statusChar);
        ui->Connect->setEnabled(false);
        ui->Disconnect->setEnabled(true);
        ui->Start->setEnabled(false);
        ui->Stop->setEnabled(false);
        ui->SetChannels->setEnabled(true);

        ui->ChannelA->setEnabled(true);
        ui->ChannelB->setEnabled(true);
        ui->ChannelC->setEnabled(true);
        ui->ChannelD->setEnabled(true);

        ui->BufferSize->setEnabled(true);
        ui->SampleInterval->setEnabled(true);
        ui->TimeUnits->setEnabled(true);

        ui->SetChannels->setEnabled(true);

        ui->Start->setEnabled(false);
        ui->Stop->setEnabled(false);


    }else{
        QMainWindow::statusBar()->showMessage("无法连接到示波器设备: " + statusChar);
        ui->Connect->setEnabled(true);
        ui->Disconnect->setEnabled(false);
}
}
I look forward to hearing from you
Bob

Martyn
Site Admin
Site Admin
Posts: 4491
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: The usb connection problem and the ps5000aOpenUnit were

Post by Martyn »

Code: Select all

if( status=PICO_OK){
should be

Code: Select all

if( status == PICO_OK){
Martyn
Technical Support Manager

xiaohao
Newbie
Posts: 0
Joined: Thu Jun 15, 2017 9:48 am

Re: The usb connection problem and the ps5000aOpenUnit were

Post by xiaohao »

Hi Martyn,
I am very glad to receive your help, but I found after according to the change or connection, start connection of C + + code is good, I want to get some examples, the official C file I consulted, or implement, hope you can give some examples of the ps5000aopenunit C + +.

Is the equipment search progress bar running, or is it not?
Unable to connect to device state2686328.
Regards,

Martyn
Site Admin
Site Admin
Posts: 4491
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: The usb connection problem and the ps5000aOpenUnit were

Post by Martyn »

It may be better if you email in your questions to support@picotech.com using your native language, as I feel we may lose some context with transalation.
Martyn
Technical Support Manager

xiaohao
Newbie
Posts: 0
Joined: Thu Jun 15, 2017 9:48 am

Re: The usb connection problem and the ps5000aOpenUnit were

Post by xiaohao »

Sorry for this silly question (in very poor english).

Thank you very much!

Post Reply