Code covered by the BSD License  

Highlights from
Matlab LibTiePie 0.4.3 instrument driver for Handyscope HS5

Matlab LibTiePie 0.4.3 instrument driver for Handyscope HS5

by

 

03 Oct 2013 (Updated )

MatlabLibTiePie : TiePie engineering's instrument library for Matlab 7.6 = 2008a and higher.

LibTiePie.OscilloscopeChannel
% LibTiePie.OscilloscopeChannel controls a LibTiePie oscilloscope channel.
% Do not create LibTiePie.OscilloscopeChannel objects directly.
% They are automatically created when an oscilloscope is opened with Library.List.OpenOscilloscope().
%
% For more information, see api.tiepie.com and www.tiepie.com/LibTiePie .
%
% (c) 2012-2013 TiePie engineering.

classdef OscilloscopeChannel < handle
  properties ( Access = protected )
    oOscilloscope;
    wChannelIndex;
    % Cached for efficiency. Gotten from oOscilloscope:
    oLibTiePie;
    sLibrary;
    hDevice;
  end
  properties
    Enabled;
    Coupling;
    AutoRanging;
    Range;
    ProbeGain;

    TriggerEnabled;
    TriggerKind;
    TriggerLevel;
    TriggerHysteresis;
    TriggerCondition;
    TriggerTime;
  end
  properties ( SetAccess = private )
    HasConnectionTest;

    ConnectorType;
    IsDifferential;
    Couplings;
    Ranges;

    HasTrigger;
    TriggerKinds;
    TriggerLevelCount;
    TriggerHysteresisCount;
    TriggerTimeCount;
    TriggerConditions;
  end

  methods
    function obj = OscilloscopeChannel( oOscilloscope , wChannelNumber )
      obj.oOscilloscope = oOscilloscope;
      obj.wChannelIndex = wChannelNumber - 1;
      obj.oLibTiePie = oOscilloscope.oLibTiePie;
      obj.sLibrary = oOscilloscope.oLibTiePie.sLibrary;
      obj.hDevice = oOscilloscope.hDevice;
    end

    function delete( self )
      % Release references:
      self.oOscilloscope = 0;
      self.oLibTiePie = 0;
    end;

    function [ dRangeMin , dRangeMax ] = DataValueRange( self )
      [ dRangeMin , dRangeMax ] = calllib( self.sLibrary , 'ScpChGetDataValueRange' , self.hDevice , self.wChannelIndex , 0 , 0 );
    end
  end

  methods
    function dwConnectorType = get.ConnectorType( self )
      dwConnectorType = LibTiePie.Enum.CONNECTORTYPE( calllib( self.sLibrary , 'ScpChGetConnectorType' , self.hDevice , self.wChannelIndex ) );
    end

    function bIsDifferential = get.IsDifferential( self )
      bIsDifferential = calllib( self.sLibrary , 'ScpChIsDifferential' , self.hDevice , self.wChannelIndex );
    end

    function bEnabled = get.Enabled( self )
      bEnabled = calllib( self.sLibrary , 'ScpChGetEnabled' , self.hDevice , self.wChannelIndex );
    end
    function set.Enabled( self , bEnabled )
      calllib( self.sLibrary , 'ScpChSetEnabled' , self.hDevice , self.wChannelIndex , bEnabled );
      self.oLibTiePie.CheckStatus;
    end

    function arCouplings = get.Couplings( self )
      arCouplings = LibTiePie.Enum.CK( LibTiePie.BitMask2Array( calllib( self.sLibrary , 'ScpChGetCouplings' , self.hDevice , self.wChannelIndex ) ) );
    end
    function qwCoupling = get.Coupling( self )
      qwCoupling = LibTiePie.Enum.CK( calllib( self.sLibrary , 'ScpChGetCoupling' , self.hDevice , self.wChannelIndex ) );
    end
    function set.Coupling( self , qwCoupling )
      calllib( self.sLibrary , 'ScpChSetCoupling' , self.hDevice , self.wChannelIndex , uint64( qwCoupling ) );
      self.oLibTiePie.CheckStatus;
    end

    function bAutoRanging = get.AutoRanging( self )
      bAutoRanging = calllib( self.sLibrary , 'ScpChGetAutoRanging' , self.hDevice , self.wChannelIndex );
    end
    function set.AutoRanging( self , bAutoRanging )
      calllib( self.sLibrary , 'ScpChSetAutoRanging' , self.hDevice , self.wChannelIndex , bAutoRanging );
    end

    function dRange = get.Range( self )
      dRange = calllib( self.sLibrary , 'ScpChGetRange' , self.hDevice , self.wChannelIndex );
    end
    function set.Range( self , dRange )
      calllib( self.sLibrary , 'ScpChSetRange' , self.hDevice , self.wChannelIndex , dRange );
      self.oLibTiePie.CheckStatus;
    end
    function darRanges = get.Ranges( self )
      dwLength = calllib( self.sLibrary , 'ScpChGetRanges' , self.hDevice , self.wChannelIndex  , [] , 0 );
      [ dwLength , darRanges ] = calllib( self.sLibrary , 'ScpChGetRanges' , self.hDevice , self.wChannelIndex , zeros( dwLength , 1 ) , dwLength );
    end   

    function dProbeGain = get.ProbeGain( self )
      dProbeGain = calllib( self.sLibrary , 'ScpChGetProbeGain' , self.hDevice , self.wChannelIndex );
    end
    function set.ProbeGain( self , dProbeGain )
      calllib( self.sLibrary , 'ScpChSetProbeGain' , self.hDevice , self.wChannelIndex , dProbeGain );
      self.oLibTiePie.CheckStatus;
    end

    function bHasTrigger = get.HasTrigger( self )
      bHasTrigger = calllib( self.sLibrary , 'ScpChHasTrigger' , self.hDevice , self.wChannelIndex );
    end

    function bTriggerEnabled = get.TriggerEnabled( self )
      bTriggerEnabled = calllib( self.sLibrary , 'ScpChTrGetEnabled' , self.hDevice , self.wChannelIndex );
    end
    function set.TriggerEnabled( self , bTriggerEnabled )
      calllib( self.sLibrary , 'ScpChTrSetEnabled' , self.hDevice , self.wChannelIndex , bTriggerEnabled );
      self.oLibTiePie.CheckStatus;
    end

    function arTriggerKinds = get.TriggerKinds( self )
      arTriggerKinds = LibTiePie.Enum.TK( LibTiePie.BitMask2Array( calllib( self.sLibrary , 'ScpChTrGetKinds' , self.hDevice , self.wChannelIndex ) ) );
    end
    function qwTriggerKind = get.TriggerKind( self )
      qwTriggerKind = LibTiePie.Enum.TK( calllib( self.sLibrary , 'ScpChTrGetKind' , self.hDevice , self.wChannelIndex ) );
    end
    function set.TriggerKind( self , qwTriggerKind )
      calllib( self.sLibrary , 'ScpChTrSetKind' , self.hDevice , self.wChannelIndex , uint64( qwTriggerKind ) );
      self.oLibTiePie.CheckStatus;
    end

    function dwTriggerLevelCount = get.TriggerLevelCount( self )
      dwTriggerLevelCount = calllib( self.sLibrary , 'ScpChTrGetLevelCount' , self.hDevice , self.wChannelIndex );
    end
    function dTriggerLevel = get.TriggerLevel( self )
      dTriggerLevel = calllib( self.sLibrary , 'ScpChTrGetLevel' , self.hDevice , self.wChannelIndex , 0 );
    end
    function set.TriggerLevel( self , dTriggerLevel )
      calllib( self.sLibrary , 'ScpChTrSetLevel' , self.hDevice , self.wChannelIndex , 0 , dTriggerLevel );
      self.oLibTiePie.CheckStatus;
    end

    function dwTriggerHysteresisCount = get.TriggerHysteresisCount( self )
      dwTriggerHysteresisCount = calllib( self.sLibrary , 'ScpChTrGetHysteresisCount' , self.hDevice , self.wChannelIndex );
    end
    function dTriggerHysteresis = get.TriggerHysteresis( self )
      dTriggerHysteresis = calllib( self.sLibrary , 'ScpChTrGetHysteresis' , self.hDevice , self.wChannelIndex , 0 );
    end
    function set.TriggerHysteresis( self , dTriggerHysteresis )
      calllib( self.sLibrary , 'ScpChTrSetHysteresis' , self.hDevice , self.wChannelIndex , 0 , dTriggerHysteresis );
      self.oLibTiePie.CheckStatus;
    end

    function arTriggerConditions = get.TriggerConditions( self )
      arTriggerConditions = LibTiePie.Enum.TC( LibTiePie.BitMask2Array( calllib( self.sLibrary , 'ScpChTrGetConditions' , self.hDevice , self.wChannelIndex ) ) );
    end
    function dwTriggerCondition = get.TriggerCondition( self )
      dwTriggerCondition = LibTiePie.Enum.TC( calllib( self.sLibrary , 'ScpChTrGetCondition' , self.hDevice , self.wChannelIndex ) );
    end
    function set.TriggerCondition( self , dwTriggerCondition )
      calllib( self.sLibrary , 'ScpChTrSetCondition' , self.hDevice , self.wChannelIndex , uint32( dwTriggerCondition ) );
      self.oLibTiePie.CheckStatus;
    end

    function dwTriggerTimeCount = get.TriggerTimeCount( self )
      dwTriggerTimeCount = calllib( self.sLibrary , 'ScpChTrGetTimeCount' , self.hDevice , self.wChannelIndex );
    end
    function dTriggerTime = get.TriggerTime( self )
      dTriggerTime = calllib( self.sLibrary , 'ScpChTrGetTime' , self.hDevice , self.wChannelIndex , 0 );
    end
    function set.TriggerTime( self , dTriggerTime )
      calllib( self.sLibrary , 'ScpChTrSetTime' , self.hDevice , self.wChannelIndex , 0 , dTriggerTime );
      self.oLibTiePie.CheckStatus;
    end
  end
  methods
    function bHasConnectionTest = get.HasConnectionTest( self )
      bHasConnectionTest = calllib( self.sLibrary , 'ScpChHasConnectionTest' , self.hDevice , self.wChannelIndex );
    end
  end
end

Contact us