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

📄 out32.c

📁 MATSNL is a package of MATLAB M-files for computing wireless sensor node lifetime/power budget and
💻 C
字号:
/*******************************************************************************
 * Execute outport I/O instruction.                                            *
 * Syntax: Out32(Port, Data)                                                   *
 *                                                                             *
 *    Input Parameters:                                                        *
 *    ================                                                         *
 *                                                                             *
 *       Port ------> I/O port address (positive integer).                     *
 *       Data ------> Port value (positive integer).                           *
 *                                                                             *
 *    Output Parameters:                                                       *
 *    =================                                                        *
 *                                                                             *
 *       NONE.                                                                 *
 *                                                                             *
 *    See also Inp32().                                                        *
 *                                                                             *
 * Compile: mex -v out32.c inpout32.lib                                        *
 * Version: 01-05-2005                                                         *
 *                                                                             *
 * (C) 2005 Stephan Hengstler, Stanford Wireless Sensor Networks Lab           *
 *******************************************************************************/


#include <stdio.h>
#include <windows.h>
#include "mex.h"

/* prototypes of inpout32.dll functions */
short _stdcall Inp32(short port);
void _stdcall  Out32(short port, short data);

void mexFunction(int nlhs, mxArray *plhs[],int nrhs, const mxArray *prhs[])
{
	short	      data, port;

	/* get the value(s) of the input variable(s) */
	port   		= (short) mxGetScalar(prhs[0]);
	data   		= (short) mxGetScalar(prhs[1]);

	/* call the respective subroutine(s) */
	Out32(port, data);

   /* show debug information */
	if (nrhs == 3)
	{
		printf("Debug Information\n");
		printf("port   	= 0x%04x\n", (short) port);
		printf("data   	= 0x%02x\n", (short) data);
	}

	/* clean exit */
	return;
}

⌨️ 快捷键说明

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