⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 inputdemo.m

📁 daqaxis help for national instruments
💻 M
字号:
%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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -