Instrument control package: Difference between revisions

Jump to navigation Jump to search
m
→‎Windows (cygwin): Avoid deprecated "source" tags.
m (→‎Windows (cygwin): Avoid deprecated "source" tags.)
(7 intermediate revisions by 3 users not shown)
Line 17: Line 17:
! i2c
! i2c
| bgcolor="green" | v0.1.0 || -                        || -                        || bgcolor="skyblue" | stalled || -  
| bgcolor="green" | v0.1.0 || -                        || -                        || bgcolor="skyblue" | stalled || -  
|-
! spi
| bgcolor="green" | v0.6.0 || -                        || -                        || -                          || -
|-
|-
! TCP
! TCP
Line 40: Line 43:
{{Code|Check for interface support|<syntaxhighlight lang="octave" style="font-size:13px">
{{Code|Check for interface support|<syntaxhighlight lang="octave" style="font-size:13px">
pkg load instrument-control
pkg load instrument-control
supportedinterfaces = instrhwinfo().SupportedInterfaces


if (exist("serial") == 3)
if ! isempty(strfind (supportedinterfaces , "serial"))
     disp("Serial: Supported")
     disp("Serial: Supported")
else
else
Line 48: Line 52:


#similarly with:
#similarly with:
#exist("parallel") == 3
# ! isempty(strfind (supportedinterfaces , "parallel"))
#exist("i2c") == 3
# ! isempty(strfind (supportedinterfaces , "i2c"))
</syntaxhighlight>}}
</syntaxhighlight>}}


Line 63: Line 67:
To be able to use GPIB on windows, the linux-gpib library needs to be 'faked'. This can be done by copying the following script and run it in a bash-terminal.
To be able to use GPIB on windows, the linux-gpib library needs to be 'faked'. This can be done by copying the following script and run it in a bash-terminal.


<source lang="bash">
<syntaxhighlight lang="bash">
#!/bin/bash
#!/bin/bash
# fake_linux_gpib.sh, Kire Pûdsje, Dec 2017
# fake_linux_gpib.sh, Kire Pûdsje, Dec 2017
Line 99: Line 103:
#cleanup  
#cleanup  
rm -f ${NI_DEF_FILE}
rm -f ${NI_DEF_FILE}
</source>
</syntaxhighlight>


== MacOS ==
== MacOS ==
Line 494: Line 498:
* Setting minor, sad, send_eoi and eos_mode is not implemented yet.
* Setting minor, sad, send_eoi and eos_mode is not implemented yet.
* Every read or write command opens and closes a new gpib session, since the linux-gpib session pointer is only valid for single command.
* Every read or write command opens and closes a new gpib session, since the linux-gpib session pointer is only valid for single command.
== SPI ==
=== Configuring interface ===
SPI currently only works in linux.
instrhwinfo will display the avilable devices in the system
{{Code|SPI example|<syntaxhighlight lang="octave" style="font-size:13px">
instrhwinfo("spi")
</syntaxhighlight>
}}
You will need read/write permissions to the device used.
=== Example: basic use ===
Example opening an performing IO on a device /dev/spidev0.0.
{{Code|SPI example|<syntaxhighlight lang="octave" style="font-size:13px">
# open device
spidev = spi("/dev/spidev0.0", 'clockpolarity', 'idlehigh', 'clockphase', 'firstedge')
# I/O to device
data = writeAndRead (spidev, uint8([0x01 0x00]))
# close the device
clear spidev
</syntaxhighlight>
}}


[[Category:Octave Forge]]
[[Category:Octave Forge]]

Navigation menu