Re: computer in listen-only mode?
dave penkler <[email protected]> Thu, 18 Sep 2025 09:44:50 +0200
| Newsgroups | gmane.linux.hardware.gpib.general |
|---|---|
| Message-ID | <CAL=kjP1eTStaugvPC_--ZzZF=0pUOgLNbLwRkA=37-iQDUyyxg@mail.gmail.com> |
Hi Hernán, This little programme works for me. It sets the pad of the controller to 23 and goes into listen mode by sending the command string UNL, UNT, LSN 23 to the controller. tplot2 >file.hpgl cheers, -Dave On Thu, 18 Sept 2025 at 09:12, Hernán Freschi <[email protected]> wrote: > Is it possible to run a device (a ni_pci in particular) in "listen only" > mode? Instead of being a controller, I'd like it to be a listen only > device, so I can emulate a plotter > > My idea is to just grab all of the HPGL commands a device sends and then > convert into PDF. > > This has already been discussed 2 decades ago: > https://sourceforge.net/p/linux-gpib/mailman/linux-gpib-general/thread/446940000.1056300621%40%5B192.168.1.1%5D/#msg2697429 > but the solution is specific to a particular device. > > The NI forums mention: > > #define IbcLON 0x0022 /*Enter listen only mode*/ > > but it doesn't seem like linux-gpib implements this? > > Thanks > _______________________________________________ > Linux-gpib-general mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/linux-gpib-general > _______________________________________________ Linux-gpib-general mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/linux-gpib-general
tplot2.c
(text/x-csrc, 1.3 KB)
/* Programme to receive plot data from an HP54100A/D
Controller in listen only mode, scope in talk only mode.
Plot is initiated from the plot menu of the instrument.
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdint.h>
#include <gpib/gpib_user.h>
#include <gpib/ib.h>
int cb=0; /* minor of controller */
static void myError(char * mess) {
int erc = ThreadIberr();
fprintf(stderr,"error: %s\n", mess);
fprintf(stderr," - %s\n", gpib_error_string(erc));
if (erc == 0) fprintf(stderr," system error: %s\n",strerror(ThreadIbcnt()));
exit(1);
}
char cmdstring[] = {0x3f,0x5f,0x37}; /* UNT UNL LSN23 */
int main(int argc, char* argv[]) {
uint8_t buf[2048];
int end=0;
int res,stat,count;
if (ibeos(cb,0x140a) & ERR) myError("ibeos cb failed");
if (ibpad(cb,23) & ERR) myError("ibpad");
ibask(cb,IbaPAD,&res);
fprintf(stderr,"Assigned pad %d to controller %d\n",res,cb);
if (ibcmd(cb,cmdstring,3) & ERR) myError("ibcmd");
if (ibgts(cb,1) & ERR) myError("ibgts");
if (ibtmo(cb,TNONE) & ERR) myError("ibtmo TNONE");
fprintf(stderr,"Initiate plot on instrument\n");
while (!end) {
if ((stat = ibrd(cb,buf,1024)) & ERR ) myError("ibrd 1024");
count = ibcnt;
fprintf(stderr,"stat 0x%06x got %d bytes\n",stat,count);
printf("%.*s",count,buf);
end = (stat & END);
}
exit(0);
}