Re: Detecting whether ATN is asserted or un-asserted

John <[email protected]> Tue, 7 Apr 2026 17:18:44 +0100
Newsgroups gmane.linux.hardware.gpib.general
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--===============8295059750916851737==
Content-Type: multipart/alternative;
 boundary="------------axF9UgXRrmy5rYUmlveSd06w"
Content-Language: en-US

This is a multi-part message in MIME format.
--------------axF9UgXRrmy5rYUmlveSd06w
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit

Dave,

Thank you and sorry - I missed your inline program and was trying to 
roll my own.

Having gone back through the messages I found it and tried it. It 
initially failed on this line:

gpib.eot(0, eot)  # assert eoi on last byte written

$ ./low_test.py
Traceback (most recent call last):
   File "/home/johnc/Test/linux-gpib/./low_test.py", line 29, in <module>
     gpib.eot(0, eot)  # assert eoi on last byte written
     ^^^^^^^^
AttributeError: module 'gpib' has no attribute 'eot'

So I commented that line out. I am not sure what it is supposed to be?

It then failed on:

gpib_command(board,unl_unt)  # send unlisten untalk

$ ./low_test.py
FIND file ....
Traceback (most recent call last):
   File "/home/johnc/Test/linux-gpib/./low_test.py", line 39, in <module>
     gpib_command(board,unl_unt)  # send unlisten untalk
     ^^^^^^^^^^^^
NameError: name 'gpib_command' is not defined

I noticed you had used 'gpib.command' and 'gpib_command' alternately so 
I changed all occurrences of gpib_command with gpib.command. It then ran 
without language syntax errors but failed alternately between:

$ ./low_test.py
FIND file ....
Traceback (most recent call last):
   File "/home/johnc/Test/linux-gpib/./low_test.py", line 34, in <module>
     gpib.command(board,add_find) # do addressing
     ~~~~~~~~~~~~^^^^^^^^^^^^^^^^
gpib.GpibError: cmd() failed: You have attempted to write data or 
command bytes, but there are no listeners currently addressed.

and;

$ ./low_test.py
FIND file ....
Traceback (most recent call last):
   File "/home/johnc/Test/linux-gpib/./low_test.py", line 39, in <module>
     gpib.command(board,unl_unt)  # send unlisten untalk
     ~~~~~~~~~~~~^^^^^^^^^^^^^^^
gpib.GpibError: cmd() failed: You have attempted to write data or 
command bytes, but there are no listeners currently addressed.

Noted that ibcmd automatically asserts  ATN and that it remains asserted 
at the end.

Also noted that ibwrt and ibrd automatically de-assert ATN.

With regards to iblines, I was passing the wrong device variable to the 
sub-routine, but anyway, for now I am focused on your Python low level 
program. I will do an LA trace.

Regards.



On 07/04/2026 13:53, dave penkler wrote:
> Hi,
> ibcmd will automatically assert ATN. ATN remains asserted at the end. 
> When you do an ibrd or ibwrt on the board ATN will automatically be 
> de-asserted. You might try the low-level programme I sent in-line 
> earlier. iblines is the best way to establish the state of the lines. 
> It must be issued against a board descriptor. Note that 
> iblines(&line_status) returns the mask for the valid lines in the 
> lower byte and the actual line state in the upper byte. Same for 
> python print (hex(int(gpib.lines(0)/256)))
> See iblines 
> <https://linux-gpib.sourceforge.io/doc_html/reference-function-iblines.html>
> cheers,
> -Dave
>
> On Mon, 6 Apr 2026 at 10:10, John <[email protected]> wrote:
>
>     I have been working on a low level approach to driving a GPIB
>     device and
>     found the ibcac() and ibgts() functions, however, I cannot find a
>     way to
>     test whether the signal is asserted or un-asserted. For example,
>     there
>     is ibsta, but this is a on-shot value returned when calling a
>     function
>     but doesn't then tell me what has happened to the state of ATN after
>     calling the function. For example, after un-asserting ATN, I need to
>     make sure that the signal is high before sending data.
>
>     I also discovered iblines(), but this returns a constant value of
>     32768.
>
>     There is also ibcmd() which writes "command bytes", but I am unsure
>     whether this actually asserts ATN or not while doing so or whether
>     asserting ATN has to be done separately? How does this differ to
>     ibwrt()?
>
>     My interface is a National Instruments PCI card dated 1997 and marked
>     PCI-GPIB+. It uses the tnt4882 driver. I am working on Linux,
>
>     I would appreciate a little guidance on how to manage ATN manually.
>
>     Thank you.
>
>
>
>
>     _______________________________________________
>     Linux-gpib-general mailing list
>     [email protected]
>     https://lists.sourceforge.net/lists/listinfo/linux-gpib-general
>
--------------axF9UgXRrmy5rYUmlveSd06w
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit

<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Dave,</p>
    <p>Thank you and sorry - I missed your inline program and was trying
      to roll my own.</p>
    <p>Having gone back through the messages I found it and tried it. It
      initially failed on this line:</p>
    <p>gpib.eot(0, eot)  # assert eoi on last byte written</p>
    <p>$ ./low_test.py<br>
      Traceback (most recent call last):<br>
        File "/home/johnc/Test/linux-gpib/./low_test.py", line 29, in
      &lt;module&gt;<br>
          gpib.eot(0, eot)  # assert eoi on last byte written<br>
          ^^^^^^^^<br>
      AttributeError: module 'gpib' has no attribute 'eot'<br>
    </p>
    <p>So I commented that line out. I am not sure what it is supposed
      to be?</p>
    <p>It then failed on:</p>
    <p>gpib_command(board,unl_unt)  # send unlisten untalk</p>
    <p>$ ./low_test.py<br>
      FIND file ....<br>
      Traceback (most recent call last):<br>
        File "/home/johnc/Test/linux-gpib/./low_test.py", line 39, in
      &lt;module&gt;<br>
          gpib_command(board,unl_unt)  # send unlisten untalk<br>
          ^^^^^^^^^^^^<br>
      NameError: name 'gpib_command' is not defined<br>
    </p>
    <p>I noticed you had used 'gpib.command' and 'gpib_command'
      alternately so I changed all occurrences of gpib_command with
      gpib.command. It then ran without language syntax errors but
      failed alternately between:</p>
    <p>$ ./low_test.py<br>
      FIND file ....<br>
      Traceback (most recent call last):<br>
        File "/home/johnc/Test/linux-gpib/./low_test.py", line 34, in
      &lt;module&gt;<br>
          gpib.command(board,add_find) # do addressing<br>
          ~~~~~~~~~~~~^^^^^^^^^^^^^^^^<br>
      gpib.GpibError: cmd() failed: You have attempted to write data or
      command bytes, but there are no listeners currently addressed.<br>
    </p>
    <p>and;</p>
    <p>$ ./low_test.py<br>
      FIND file ....<br>
      Traceback (most recent call last):<br>
        File "/home/johnc/Test/linux-gpib/./low_test.py", line 39, in
      &lt;module&gt;<br>
          gpib.command(board,unl_unt)  # send unlisten untalk<br>
          ~~~~~~~~~~~~^^^^^^^^^^^^^^^<br>
      gpib.GpibError: cmd() failed: You have attempted to write data or
      command bytes, but there are no listeners currently addressed.<br>
    </p>
    <p>Noted that ibcmd automatically asserts  ATN and that it remains
      asserted at the end.</p>
    <p>Also noted that ibwrt and ibrd automatically de-assert ATN.</p>
    <p>With regards to iblines, I was passing the wrong device variable
      to the sub-routine, but anyway, for now I am focused on your
      Python low level program. I will do an LA trace.</p>
    <p>Regards. </p>
    <p><br>
    </p>
    <p><br>
    </p>
    <div class="moz-cite-prefix">On 07/04/2026 13:53, dave penkler
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAL=kjP2gbi4DLE6=RQwmVSmXX+4ZDABaJP0xG+XfVA_X+2eJhQ@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">Hi,
        <div>ibcmd will automatically assert ATN. ATN remains asserted
          at the end. When you do an ibrd or ibwrt on the board ATN will
          automatically be de-asserted. You might try the low-level
          programme I sent in-line earlier. iblines is the best way to
          establish the state of the lines. It must be issued against a
          board descriptor. Note that iblines(&amp;line_status) returns
          the mask for the valid lines in the lower byte and the actual
          line state in the upper byte. Same for python print
          (hex(int(gpib.lines(0)/256)))</div>
        <div>See <a
href="https://linux-gpib.sourceforge.io/doc_html/reference-function-iblines.html"
            moz-do-not-send="true">iblines</a></div>
        <div>cheers,</div>
        <div>-Dave</div>
      </div>
      <br>
      <div class="gmail_quote gmail_quote_container">
        <div dir="ltr" class="gmail_attr">On Mon, 6 Apr 2026 at 10:10,
          John &lt;<a href="mailto:[email protected]"
            moz-do-not-send="true" class="moz-txt-link-freetext">[email protected]</a>&gt;
          wrote:<br>
        </div>
        <blockquote class="gmail_quote"
style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I
          have been working on a low level approach to driving a GPIB
          device and <br>
          found the ibcac() and ibgts() functions, however, I cannot
          find a way to <br>
          test whether the signal is asserted or un-asserted. For
          example, there <br>
          is ibsta, but this is a on-shot value returned when calling a
          function <br>
          but doesn't then tell me what has happened to the state of ATN
          after <br>
          calling the function. For example, after un-asserting ATN, I
          need to <br>
          make sure that the signal is high before sending data.<br>
          <br>
          I also discovered iblines(), but this returns a constant value
          of 32768.<br>
          <br>
          There is also ibcmd() which writes "command bytes", but I am
          unsure <br>
          whether this actually asserts ATN or not while doing so or
          whether <br>
          asserting ATN has to be done separately? How does this differ
          to ibwrt()?<br>
          <br>
          My interface is a National Instruments PCI card dated 1997 and
          marked <br>
          PCI-GPIB+. It uses the tnt4882 driver. I am working on Linux,<br>
          <br>
          I would appreciate a little guidance on how to manage ATN
          manually.<br>
          <br>
          Thank you.<br>
          <br>
          <br>
          <br>
          <br>
          _______________________________________________<br>
          Linux-gpib-general mailing list<br>
          <a href="mailto:[email protected]"
            target="_blank" moz-do-not-send="true"
            class="moz-txt-link-freetext">[email protected]</a><br>
          <a
href="https://lists.sourceforge.net/lists/listinfo/linux-gpib-general"
            rel="noreferrer" target="_blank" moz-do-not-send="true"
            class="moz-txt-link-freetext">https://lists.sourceforge.net/lists/listinfo/linux-gpib-general</a><br>
        </blockquote>
      </div>
    </blockquote>
  </body>
</html>

--------------axF9UgXRrmy5rYUmlveSd06w--


--===============8295059750916851737==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline


--===============8295059750916851737==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Linux-gpib-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-gpib-general

--===============8295059750916851737==--