Skip to content

Commit ccf7bf1

Browse files
Extended ibwait() for zero wait mask usage.
1 parent 86faa8c commit ccf7bf1

File tree

3 files changed

+25
-19
lines changed

3 files changed

+25
-19
lines changed

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,6 @@ data = nil
227227
handle = <STATUS_TABLE> -- see description for ibclr()
228228
errmsg = "Error code and detailed description"
229229

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

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

310+
`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.
311+
312312
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.
313313

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

322+
-- Example 3: Returns immediately with the updated IBSTA status table.
323+
local stat, errmsg = gpib.ibwait(devHandle,0)
324+
322325
-- On success:
323326
stat = <STATUS_TABLE> -- see description for ibclr()
324327
errmsg = nil -- no error message

0 commit comments

Comments
 (0)