📄 out32.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 + -