inputdemo.m

来自「daqaxis help for national instruments」· M 代码 · 共 40 行

M
40
字号
%function InputDemo
%week1 - Reading switches and outputting to LEDs
%Set Switch3 0010 Switch4  1000
%    Switch5 R  Switch 6 R Switch 7 R 
base = 888; 
	disp('Hello Bytronics')
	%send control word to set ports to correct
	%input and output status
               %Port A,B,CH,CL     1 in  0 out
	PortModeSet(base,0,0, 1, 1);

	%loop around this section of the programme until
	%positive number entered
	
	x=0
	while x<1
		% read inputs then write result to output
		portCvalue = PPIInpVal(base);
		PPIOutVal(base, portCvalue);
		% display result on screen
		disp(portCvalue);

		x=input('Press 0 to continue; Press 2 to exit');%// wait 3 s
        %delay(3); delay in seconds
        secs=3; 
        t1 = clock;
        e =0;
        while e < secs
            e = etime(clock,t1);
        end;		

	end;
	






⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?