Skip to content

Commit

Permalink
Extended ibwait() for zero wait mask usage.
Browse files Browse the repository at this point in the history
  • Loading branch information
KritzelKratzel committed Oct 13, 2024
1 parent 86faa8c commit ccf7bf1
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 19 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,6 @@ data = nil
handle = <STATUS_TABLE> -- see description for ibclr()
errmsg = "Error code and detailed description"


-- Example 2: read 12 bytes from device devHandle as table of ASCII-characters
-- devData = "ABc" : data[1]="A" data[2]="B" data[3]="c"
local data, stat, errmsg = gpib.ibrd(devHandle,12,"charTable")
Expand All @@ -240,7 +239,6 @@ data = nil
handle = <STATUS_TABLE> -- see description for ibclr()
errmsg = "Error code and detailed description"


-- Example 3: read 8 bytes from device devHandle as table of numbers (raw data)
-- devData = "ABc" : data[1]=0x41 data[2]=0x42 data[3]=0x63
local data, stat, errmsg = gpib.ibrd(devHandle,8,"binTable")
Expand Down Expand Up @@ -309,6 +307,8 @@ Purpose: Wait for GPIB events on board-level or device-level. Valid wait mask id
"SRQI", "END", "TIMO"
```

`ibwait()` accepts wait mask identifiers given as a single string value, as a table of string values, or as an integer value. The latter is useful for providing no wait mask at all by specifying `0` as argument. In this case `ibwait()` returns immediately with the updated `IBSTA` status info.

For GPIB devices the only valid wait masks are `TIMO`, `END`, `RQS`, and `CMPL`. GPIB controllers accept all wait masks except for `RQS`. Detailed wait mask information is available at https://documentation.help/NI-488.2/func3kfo.html.

```lua
Expand All @@ -319,6 +319,9 @@ local stat, errmsg = gpib.ibwait(devHandle,"RQS")
-- Notice that more than one wait mask may be handed over when put into a Lua table.
local stat, errmsg = gpib.ibwait(devHandle,{"RQS","TIMO"})

-- Example 3: Returns immediately with the updated IBSTA status table.
local stat, errmsg = gpib.ibwait(devHandle,0)

-- On success:
stat = <STATUS_TABLE> -- see description for ibclr()
errmsg = nil -- no error message
Expand Down
Loading

0 comments on commit ccf7bf1

Please sign in to comment.