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

📄 digin_sfcn_9s12.tlc

📁 simulink real-time workshop for dragon12 development board from
💻 TLC
字号:
%% File : digIn_sfcn_9S12.tlc
%%
%% Description: 
%%   Digital input device driver
%%
%%   fw-03-05
%%
%implements  digIn_sfcn_9S12 "C"

%% (P1) SAMPLE_TIME -- real_T
%% (P2) PORT		-- real_T
%% (P3) PIN_ARRAY	-- real_T [array]
%% (P4) VON			-- real_T
%% (P5) VOFF		-- real_T

%% add required include files... -- fw-03-05
%<LibAddToCommonIncludes("<mc9s12dp256.h>")>
%<LibAddToCommonIncludes("tmwtypes.h")>


%% Function: Start ==========================================================
%%
%% Purpose:
%%      Code generation for initilization of digital input
%%
%function Start(block, system) Output

	/* Initialize digital inputs for port %<block.RTWdata.portStr> */ 
	%<block.RTWdata.ddrStr> &= ~%<block.RTWdata.pinMask>;

%endfunction


%% Function: Outputs ==========================================================
%%
%% Purpose:
%%      Code generation for signal input
%%
%function Outputs(block, system) Output

	/* read port data register and return (%<block.RTWdata.portStr>) */
	{
	   uint8_T	value = %<block.RTWdata.portStr>;
	   
		%assign rollVars = ["Y", "P"]
		%% setting 'RollThreshold = 2' => this is when the loop overhead
		%% becomes less than the cost of individual assignments --  fw-03-05
		%roll sigIdx = RollRegions, lcv = 2, block, "Roller", rollVars
			
			%assign y = LibBlockOutputSignal(0, "", lcv, sigIdx)
			%assign p = LibBlockParameter(P3, "", lcv, sigIdx)
			
			if((value & (uint8_T)(1 << (uint8_T)(%<p>))) > 0) %<y> = 1.0;
			else                                              %<y> = 0.0;
			
		%endroll
		
	}

%endfunction

%% [EOF] digIn_sfcn_9S12.tlc





⌨️ 快捷键说明

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