krjdev Publish time 2020-5-13 11:11:21

DSO4254C standard SCPI commands with usbtmc (Linux)

Edited by krjdev at 2020-5-13 11:22

Hello,

I'm trying to control the DSO with a Linux PC using the builtin usbtmc driver.

Is there a list of the standard IEEE488 commands which the DSO supports?
Tried the *IDN? command first, but currently only get 2 bytes from the DSO.
But could be an issue in my current code.


Can somebody post a full example output of the IDN command please? Well it should look like?





krjdev Publish time 2020-5-14 01:31:53

Edited by krjdev at 2020-5-14 01:38

Okay the following simple code returns the device id string:

#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>

int main(int argc, char *argv[])
{
    int fd;
    unsigned char buf;
    int ret;
    int flags;
   
    fd = open("/dev/usbtmc0", O_RDWR);
   
    if (fd == -1) {
      printf("Could not open device\n");
      return 1;
    }
   
    flags = fcntl(fd, F_GETFL, 0);
    fcntl(fd, F_SETFL, flags | O_NONBLOCK);
   
    ret = write(fd, "*IDN?\n", strlen("*IDN?\n"));
   
    if (ret == -1) {
      printf("Could not write to device\n");
      close(fd);
      return 1;
    }
   
    sleep(1);
   
    ret = read(fd, buf, 1024);
   
    if (ret == -1) {
      printf("Could not read from device\n");
      close(fd);
      return 1;
    }
   
    buf = '\0';
    printf("%s\n", buf);
    close(fd);
    return 0;
}

The output:

$ ./dso
Hantek, DSO4254C, CN1830002001956, 1.1.2(191026.0)
$



OASJ2YSeeEhBQo1 Publish time 2020-5-15 08:29:15




Have you checked the download files on the product's page? I think you will find what you want there.

http://www.hantek.com/en/ProductDetail_3_12167.html

chhanchal001 Publish time 2024-2-22 18:52:43

chhanchal001 Publish time 2024-2-22 18:53:58

chhanchal001 Publish time 2024-2-22 18:55:12

chhanchal001 Publish time 2024-2-22 18:56:34

chhanchal001 Publish time 2024-2-22 18:57:35

chhanchal001 Publish time 2024-2-22 18:59:20

chhanchal001 Publish time 2024-2-22 19:00:57

Pages: [1] 2
View full version: DSO4254C standard SCPI commands with usbtmc (Linux)