Editing Instrument control package

Jump to navigation Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.

Latest revision Your text
Line 7: Line 7:
{| class="wikitable" style="text-align:center"
{| class="wikitable" style="text-align:center"
|-
|-
!  !! Linux                !! [[Octave for Microsoft Windows:GNU Octave on cygwin | Windows (Cygwin)]]         !! Windows (native)        !! FreeBSD                !! Mac OS X  
!  !! Linux                !! Windows (Cygwin)        !! Windows (native)        !! FreeBSD                !! Mac OS X  
|-
|-
! Serial
! Serial
Line 17: Line 17:
! i2c
! i2c
| bgcolor="green" | v0.1.0 || -                        || -                        || bgcolor="skyblue" | stalled || -  
| bgcolor="green" | v0.1.0 || -                        || -                        || bgcolor="skyblue" | stalled || -  
|-
! modbus
| bgcolor="green" | v0.8.0 || bgcolor="green" | v0.8.0 || bgcolor="green" | v0.8.0 || -                        || bgcolor="green" | v0.8.0
|-
|-
! spi
! spi
| bgcolor="green" | v0.6.0 || -                        || -                        || -                          || -  
| bgcolor="yellow"| WIP    || -                        || -                        || -                          || -  
|-
|-
! TCP
! TCP
Line 46: 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 ! isempty(strfind (supportedinterfaces , "serial"))
if (exist("serial") == 3)
     disp("Serial: Supported")
     disp("Serial: Supported")
else
else
Line 55: Line 51:


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


Line 70: Line 66:
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.


<syntaxhighlight lang="bash">
<source 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 106: Line 102:
#cleanup  
#cleanup  
rm -f ${NI_DEF_FILE}
rm -f ${NI_DEF_FILE}
</syntaxhighlight>
</source>


== MacOS ==
== MacOS ==
Line 471: Line 467:
# Convert uint8 array to string,  
# Convert uint8 array to string,  
char(data)  
char(data)  
# close VXI11 session
# close usbtmc session
vxi11_close(t0)
vxi11_close(t0)
</syntaxhighlight>
</syntaxhighlight>
}}
}}
=== Limitations ===
=== Limitations ===
For now,
For now,
Line 503: Line 498:
* 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 ==
[[Category:Octave Forge]]
=== 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:Packages]]
Please note that all contributions to Octave may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see Octave:Copyrights for details). Do not submit copyrighted work without permission!

To edit this page, please answer the question that appears below (more info):

Cancel Editing help (opens in new window)

Template used on this page: