ADC block - support for differential mode

function [x,y,typ] = mdaq_adc(job,arg1,arg2)
    adc_desc = ["This block reads MicroDAQ analog inputs (AI).";
    "Select ADC type according to your hardware setup.";
    "";
    "output(1) - 16bit raw ADC value";
    "output(2) - measured value in volts";
    "";
    "Converter:";
    "   ADC01 - 8 channel, 166ksps, 12-bit, ±10V range";
    "   ADC02 - 8 channel, 166ksps, 16-bit, ±10V range";
    "   ADC03 - 8 channel, 600ksps, 12-bit, ±10V range";
    "   ADC04 - 16 channel, 600ksps, 12-bit, ±10V range";
    "   ADC05 - 16 channel, 500ksps, 16-bit, ±10V range";
    "";
    "Range: 5, 10";
    "";
    "Polarity:";
    "   1 - Unipolar";
    "   2 - Bipolar";
    "";
    "Mode:";
    "   0 - Single-ended";
    "   1 - Differential";
    "";
    "Set block parameters:"];

    x=[];y=[];typ=[];
    select job
    case 'set' then
        x=arg1
        model=arg1.model;
        graphics=arg1.graphics;
        exprs=graphics.exprs;
        while %t do
            try
                getversion('scilab');
                [ok,adc_converter_str,adc_channels, adc_range,adc_polarity,adc_mode,exprs]=..
                scicos_getvalue(adc_desc,..
                ['Converter:';
                'Channels:';
                'Range:';
                'Polarity:';
                'Mode:'],..
                list('str',1,'vec',-1,'vec',1,'vec',1,'vec',1),exprs)
            catch
                [ok,adc_converter_str,adc_channels, adc_range,adc_polarity,adc_mode,exprs]=..
                scicos_getvalue(adc_desc,..
                ['Converter:';
                'Channels:';
                'Range:';
                'Polarity:';
                'Mode:'],..
                list('str',1,'vec',-1,'vec',1,'vec',1,'vec',1),exprs)
            end

            if ~ok then
                break
            end

            adc_converter_str = convstr(adc_converter_str, 'l');
            adc_converter = strtod(part(adc_converter_str, 4:5));
            if isnan(adc_converter) == %t | part(adc_converter_str, 1:3) <> "adc" then
                ok = %f;
                message("Wrong converter selected!");
            end

            if adc_converter > 5 | adc_converter < 1 then
                ok = %f;
                message("Wrong ADC converter selected!");
            end

            global %microdaq;
            if adc_converter <> %microdaq.private.mdaq_hwid(2) & %microdaq.private.mdaq_hwid(3) > 0 then
                message("Selected ADC converter is different than detected - run mdaq_hwinfo() for more details!");
            end

            n_channels = size(adc_channels);
            if (adc_converter < 4 & n_channels(2) > 8) | (adc_converter > 3 & n_channels(2) > 16) then
                ok = %f;
                error_msg = 'Too many channels selected for ADC0' + string(adc_converter) + '!';
                message(error_msg);
            end

            if (adc_converter < 4 & max(adc_channels) > 8) | (adc_converter > 3 & max(adc_channels) > 16) then
                ok = %f;
                error_msg = 'Wrong channel number selected for ADC0' + string(adc_converter) + '!';
                message(error_msg);
            end

            if min(adc_channels) < 1 then
                ok = %f;
                error_msg = 'Wrong channel number selected for ADC0' + string(adc_converter) + '!';
                message(error_msg);
            end

            if adc_range <> 5 & adc_range <> 10 then
                ok = %f;
                message("Wrong ADC range selected - use 5 or 10!");
            end

            if adc_polarity < 1 | adc_polarity > 2 then
                ok = %f;
                message("Wrong ADC range selected - use 5 or 10!");
            else
                if adc_converter > 2 & adc_polarity == 1 then
                    ok = %f;
                    message("This converter doesn''t support unipolar mode!");
                end
            end

            if adc_mode <> 0 & adc_mode <> 1 then
                ok = %f;
                message("Wrong ADC mode selected - use 0 or 1 to set single-ended or differential mode!");
            end

            if ok then
                [model,graphics,ok] = check_io(model,graphics, [], [n_channels(2),n_channels(2)], 1, []);
                graphics.exprs = exprs;
                model.rpar = [];
                model.ipar = [adc_converter;adc_range;adc_polarity;adc_mode;n_channels(2);adc_channels'];
                model.dstate = [];
                x.graphics = graphics;
                x.model = model;
                break;
            end
        end

    case 'define' then
        adc_converter_str = [];
        adc_converter = 1;
        adc_channels = 1;
        n_channels = 1;
        adc_range = 10;
        adc_polarity = 2;
        adc_mode = 0;
        model=scicos_model()
        model.sim=list('mdaq_adc_sim',5)
        model.in =[]
        model.out=[1;1]
        model.out2=[7;1]
        model.outtyp=[1;1]
        model.evtin=1
        model.rpar=[]
        model.ipar=[adc_converter;adc_range;adc_polarity;adc_mode;1;adc_channels]
        model.dstate=[];
        model.blocktype='d'
        model.dep_ut=[%t %f]
        exprs=["ADC01";sci2exp(adc_channels);sci2exp(adc_range);sci2exp(adc_polarity); sci2exp(adc_mode)]
        gr_i=['xstringb(orig(1),orig(2),[''CH: '' ; string(adc_channels)],sz(1),sz(2),''fill'');']
        x=standard_define([4 3],model,exprs,gr_i)
        x.graphics.in_implicit=[];
        x.graphics.exprs=exprs;
        x.graphics.style=["blockWithLabel;verticalLabelPosition=center;displayedLabel=CH:%2$s;fontColor=#5f5f5f"]
    end
endfunction

function [x,y,typ] = mdaq_adc(job,arg1,arg2)
    adc_desc = ["This block reads MicroDAQ analog inputs (AI).";
    "Select ADC type according to your hardware setup.";
    "";
    "output(1) - 16bit raw ADC value";
    "output(2) - measured value in volts";
    "";
    "Converter:";
    "   ADC01 - 8 channel, 166ksps, 12-bit, ±10V range";
    "   ADC02 - 8 channel, 166ksps, 16-bit, ±10V range";
    "   ADC03 - 8 channel, 600ksps, 12-bit, ±10V range";
    "   ADC04 - 16 channel, 600ksps, 12-bit, ±10V range";
    "   ADC05 - 16 channel, 500ksps, 16-bit, ±10V range";
    "";
    "Range: 5, 10";
    "";
    "Polarity:";
    "   1 - Unipolar";
    "   2 - Bipolar";
    "";
    "Set block parameters:"];

    x=[];y=[];typ=[];
    select job
    case 'set' then
        x=arg1
        model=arg1.model;
        graphics=arg1.graphics;
        exprs=graphics.exprs;
        while %t do
            try
                getversion('scilab');
                [ok,adc_converter_str,adc_channels, adc_range, adc_polarity,exprs]=..
                scicos_getvalue(adc_desc,..
                ['Converter:';
                'Channels:';
                'Range:';
                'Polarity:'],..
                list('str',1,'vec',-1,'vec',1,'vec',1),exprs)
            catch
                [ok,adc_converter_str,adc_channels, adc_range, adc_polarity,exprs]=..
                scicos_getvalue(adc_desc,..
                ['Converter:';
                'Channels:';
                'Range:';
                'Polarity:'],..
                list('str',1,'vec',-1,'vec',1,'vec',1),exprs)
            end

            if ~ok then
                break
            end

            adc_converter_str = convstr(adc_converter_str, 'l');
            adc_converter = strtod(part(adc_converter_str, 4:5));
            if isnan(adc_converter) == %t | part(adc_converter_str, 1:3) <> "adc" then
                ok = %f;
                message("Wrong converter selected!");
            end

            if adc_converter > 5 | adc_converter < 1 then
                ok = %f;
                message("Wrong ADC converter selected!");
            end

            global %microdaq;
            if adc_converter <> %microdaq.private.mdaq_hwid(2) & %microdaq.private.mdaq_hwid(3) > 0 then
                message("Selected ADC converter is different than detected - run mdaq_hwinfo() for more details!");
            end

            n_channels = size(adc_channels);
            if (adc_converter < 4 & n_channels(2) > 8) | (adc_converter > 3 & n_channels(2) > 16) then
                ok = %f;
                error_msg = 'Too many channels selected for ADC0' + string(adc_converter) + '!';
                message(error_msg);
            end

            if (adc_converter < 4 & max(adc_channels) > 8) | (adc_converter > 3 & max(adc_channels) > 16) then
                ok = %f;
                error_msg = 'Wrong channel number selected for ADC0' + string(adc_converter) + '!';
                message(error_msg);
            end

            if min(adc_channels) < 1 then
                ok = %f;
                error_msg = 'Wrong channel number selected for ADC0' + string(adc_converter) + '!';
                message(error_msg);
            end

            if adc_range <> 5 & adc_range <> 10 then
                ok = %f;
                message("Wrong ADC range selected - use 5 or 10!");
            end

            if adc_polarity < 1 | adc_polarity > 2 then
                ok = %f;
                message("Wrong ADC range selected - use 5 or 10!");
            else
                if adc_converter > 2 & adc_polarity == 1 then
                    ok = %f;
                    message("This converter doesn''t support unipolar mode!");
                end
            end

            if ok then
                //Differential mode is not supported, only one option is available
                adc_mode = 0;
                [model,graphics,ok] = check_io(model,graphics, [], [n_channels(2),n_channels(2)], 1, []);
                graphics.exprs = exprs;
                model.rpar = [];
                model.ipar = [adc_converter;adc_range;adc_polarity;adc_mode;n_channels(2);adc_channels'];
                model.dstate = [];
                x.graphics = graphics;
                x.model = model;
                break;
            end
        end

    case 'define' then
        adc_converter_str = [];
        adc_converter = 1;
        adc_channels = 1;
        n_channels = 1;
        adc_range = 10;
        adc_polarity = 2;
        adc_mode = 1;
        model=scicos_model()
        model.sim=list('mdaq_adc_sim',5)
        model.in =[]
        model.out=[1;1]
        model.out2=[7;1]
        model.outtyp=[1;1]
        model.evtin=1
        model.rpar=[]
        model.ipar=[adc_converter;adc_range;adc_polarity;adc_mode;1;adc_channels]
        model.dstate=[];
        model.blocktype='d'
        model.dep_ut=[%t %f]
        exprs=["ADC01";sci2exp(adc_channels);sci2exp(adc_range);sci2exp(adc_polarity)]
        gr_i=['xstringb(orig(1),orig(2),[''CH: '' ; string(adc_channels)],sz(1),sz(2),''fill'');']
        x=standard_define([4 3],model,exprs,gr_i)
        x.graphics.in_implicit=[];
        x.graphics.exprs=exprs;
        x.graphics.style=["blockWithLabel;verticalLabelPosition=center;displayedLabel=CH:%2$s;fontColor=#5f5f5f"]
    end
endfunction


Update link to userdisk

Update link to userdisk

function mdaq_userdisk()
    [ip_address, result] = mdaq_get_ip();
    if result < 0 then
        message("ERROR: Unable to get device IP address!");
        return;
    end
    if getos() == 'Windows' then
        unix_s("start http://" + ip_address + "/index.php?page=mdaq_storage");
    else
        unix_s("xdg-open http://" + ip_address + "/index.php?page=mdaq_storage");
    end
endfunction

function mdaq_userdisk()
    [ip_address, result] = mdaq_get_ip();
    if result < 0 then
        message("ERROR: Unable to get device IP address!");
        return;
    end
    if getos() == 'Windows' then
        unix_s("start http://" + ip_address + "/user-disk/dsp/data/");
    else
        unix_s("xdg-open http://" + ip_address + "/user-disk/dsp/data/");
    end
endfunction


Don't print error description from mlink_connect - upper layer should handle this

function [link_fd, hwid] = mlink_connect(ip, port)
    [link_fd, result] = call("sci_mlink_connect",..
            ip, 1, "c",..
            port, 2, "i",..
        "out",..
            [1, 1], 3, "i",..
            [1, 1], 4, "i");

    if result > -1 then
            [hwid, result] = call("sci_mlink_hwid",..
            link_fd, 1, "i",..
        "out",..
            [5, 1], 2, "i",..
            [1, 1], 3, "i");

        if result > -1 then
            global %microdaq;
            if isequal(%microdaq.private.mdaq_hwid, hwid) == %F then
                %microdaq.private.mdaq_hwid = hwid;
                %microdaq.model = 'MicroDAQ E' + string(hwid(1))..
                                + '-ADC0' + string(hwid(2))..
                                + '-DAC0' + string(hwid(3))..
                                + '-' + string(hwid(4)) + string(hwid(5));
                                mdaq_hwid = hwid;

                adc_info = get_adc_info(hwid);
                dac_info = get_dac_info(hwid);
                save(mdaq_toolbox_path() + "etc"+filesep()+"mlink"+filesep()+"hwid", 'mdaq_hwid','adc_info','dac_info');

                %microdaq.private.adc_info = adc_info;
                %microdaq.private.dac_info = dac_info;
            end
        end
    end
endfunction

function [link_fd, hwid] = mlink_connect(ip, port)
    [link_fd, result] = call("sci_mlink_connect",..
            ip, 1, "c",..
            port, 2, "i",..
        "out",..
            [1, 1], 3, "i",..
            [1, 1], 4, "i");

    if result > -1 then
            [hwid, result] = call("sci_mlink_hwid",..
            link_fd, 1, "i",..
        "out",..
            [5, 1], 2, "i",..
            [1, 1], 3, "i");

        if result > -1 then
            global %microdaq;
            if isequal(%microdaq.private.mdaq_hwid, hwid) == %F then
                %microdaq.private.mdaq_hwid = hwid;
                %microdaq.model = 'MicroDAQ E' + string(hwid(1))..
                                + '-ADC0' + string(hwid(2))..
                                + '-DAC0' + string(hwid(3))..
                                + '-' + string(hwid(4)) + string(hwid(5));
                                mdaq_hwid = hwid;

                adc_info = get_adc_info(hwid);
                dac_info = get_dac_info(hwid);
                save(mdaq_toolbox_path() + "etc"+filesep()+"mlink"+filesep()+"hwid", 'mdaq_hwid','adc_info','dac_info');

                %microdaq.private.adc_info = adc_info;
                %microdaq.private.dac_info = dac_info;
            end
        end
    else
        mdaq_error(result);
    end
endfunction


sb120: #i111252# disabled failing tests for now

#i98339 -o svx.AccessibleControlShape
-o svx.AccessibleEditableTextPara
-o svx.AccessibleGraphicShape
#i46736 -o svx.AccessibleImageBullet
#i111252 -o svx.AccessibleOLEShape
-o svx.AccessiblePageShape
#i111216 -o svx.AccessiblePresentationGraphicShape
#i111216 -o svx.AccessiblePresentationOLEShape
#i85539 -o svx.AccessiblePresentationShape
-o svx.AccessibleShape
#i90294 -o svx.GraphicExporter
-o svx.SvxDrawPage
#i85501 -o svx.SvxGraphCtrlAccessibleContext
#i87746 -o svx.SvxGraphicObject
#i85263 -o svx.SvxShape
#i87746 -o svx.SvxShapeCircle
-o svx.SvxShapeCollection
#i85263 -o svx.SvxShapeConnector
#i87746 -o svx.SvxShapeControl
#i87746 -o svx.SvxShapeDimensioning
#i87746 -o svx.SvxShapeGroup
#i87746 -o svx.SvxShapePolyPolygon
#i87746 -o svx.SvxShapePolyPolygonBezier
-o svx.SvxUnoNumberingRules
-o svx.SvxUnoText
-o svx.SvxUnoTextContent
-o svx.SvxUnoTextContentEnum
-o svx.SvxUnoTextCursor
-o svx.SvxUnoTextField
-o svx.SvxUnoTextRange
-o svx.SvxUnoTextRangeEnumeration

#i98339 -o svx.AccessibleControlShape
-o svx.AccessibleEditableTextPara
-o svx.AccessibleGraphicShape
#i46736 -o svx.AccessibleImageBullet
-o svx.AccessibleOLEShape
-o svx.AccessiblePageShape
#i111216 -o svx.AccessiblePresentationGraphicShape
#i111216 -o svx.AccessiblePresentationOLEShape
#i85539 -o svx.AccessiblePresentationShape
-o svx.AccessibleShape
#i90294 -o svx.GraphicExporter
-o svx.SvxDrawPage
#i85501 -o svx.SvxGraphCtrlAccessibleContext
#i87746 -o svx.SvxGraphicObject
#i85263 -o svx.SvxShape
#i87746 -o svx.SvxShapeCircle
-o svx.SvxShapeCollection
#i85263 -o svx.SvxShapeConnector
#i87746 -o svx.SvxShapeControl
#i87746 -o svx.SvxShapeDimensioning
#i87746 -o svx.SvxShapeGroup
#i87746 -o svx.SvxShapePolyPolygon
#i87746 -o svx.SvxShapePolyPolygonBezier
-o svx.SvxUnoNumberingRules
-o svx.SvxUnoText
-o svx.SvxUnoTextContent
-o svx.SvxUnoTextContentEnum
-o svx.SvxUnoTextCursor
-o svx.SvxUnoTextField
-o svx.SvxUnoTextRange
-o svx.SvxUnoTextRangeEnumeration


INTEGRATION: CWS eforms2 (1.3.34); FILE MERGED 2004/11/03 17:36:41 sw 1.3.34.2: #i32925# 2004/08/13 14:40:46 sw 1.3.34.1: #i32860#

-o forms.OGridControlModel
-o forms.OImageButtonModel
-o forms.OGroupBoxModel
-o forms.OFormattedFieldWrapper
-o forms.OImageControlModel
-o forms.OEditControl
-o forms.OTimeControl
-o forms.OButtonControl
-o forms.OButtonModel
-o forms.OCheckBoxControl
-o forms.OCheckBoxModel
-o forms.OComboBoxControl
-o forms.OComboBoxModel
-o forms.OCurrencyControl
-o forms.OCurrencyModel
### i30258 ###-o forms.ODatabaseForm
-o forms.ODateControl
-o forms.ODateModel
-o forms.OFileControlModel
-o forms.OFixedTextModel
-o forms.OFormattedControl
-o forms.OFormsCollection
-o forms.OGroupBoxControl
-o forms.OHiddenModel
-o forms.OImageButtonControl
-o forms.OImageControlControl
-o forms.OListBoxControl
-o forms.OListBoxModel
-o forms.ONumericControl
-o forms.ONumericModel
-o forms.OPatternControl
-o forms.OPatternModel
-o forms.ORadioButtonControl
-o forms.ORadioButtonModel
-o forms.OTimeModel
-o forms.OSpinButtonModel
-o forms.OScrollBarModel
-o forms.ONavigationBarControl
-o forms.ONavigationBarModel
-o forms.OEditModel

-o forms.ONavigationBarControl
-o forms.ONavigationBarModel
-o forms.OButtonControl
-o forms.OButtonModel
-o forms.OCheckBoxControl
-o forms.OCheckBoxModel
-o forms.OComboBoxControl
-o forms.OComboBoxModel
-o forms.OCurrencyControl
-o forms.OCurrencyModel
-o forms.ODatabaseForm
-o forms.ODateControl
-o forms.ODateModel
-o forms.OEditControl
-o forms.OEditModel
-o forms.OFileControlModel
-o forms.OFixedTextModel
-o forms.OFormattedControl
-o forms.OFormattedFieldWrapper
-o forms.OFormsCollection
-o forms.OGridControlModel
-o forms.OGroupBoxControl
-o forms.OGroupBoxModel
-o forms.OHiddenModel
-o forms.OImageButtonControl
-o forms.OImageButtonModel
-o forms.OImageControlControl
-o forms.OImageControlModel
-o forms.OListBoxControl
-o forms.OListBoxModel
-o forms.ONumericControl
-o forms.ONumericModel
-o forms.OPatternControl
-o forms.OPatternModel
-o forms.ORadioButtonControl
-o forms.ORadioButtonModel
-o forms.OTimeControl
-o forms.OTimeModel
-o forms.OSpinButtonModel
-o forms.OScrollBarModel