DSO4254C standard SCPI commands with usbtmc (Linux)
Edited by krjdev at 2020-5-13 11:22Hello,
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?
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)
$
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
Pages:
[1]
2