亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? msbl21xx.c

?? modbus 運用事例
?? C
?? 第 1 頁 / 共 2 頁
字號:
/********* Sample Program ****************************************************


MSBl21xx.c	Copyright(c) 2003 Z-World Engineering.
					
Legal Notice	This program has been written by the Technical Support Staff at 
					Z-World in response to several customer requests.  As such, it 
					has NOT had the testing and validation procedures which our 
					"standard" software products have.  It is being made available 
					as a sample.  There is no warranty, implied or otherwise. 

DESCRIPTION:	Sample program demonstrating modbus slave control via RS485
					for the BL21xx SBC's.
				
					This sample will allow control via a Modbus Master controller
					of the following;
					
					1. Read from/Write to  digital outputs
					2.	Read the status of digital inputs 
					3. Read the Analog inputs (Cal. Data).
					4. Read from/Write to the analog output channels (Cal. data).
MODBUS
COMMAND 
FUNCTIONS
USED:				
					01:	Discrete Coil Status
					01:	Discrete Coil Writing
					02:	Discrete Input Status
					03:	Holding Register Status
					03:	Holding Register Writing
					04:	Input Register Status
					 
					The modbus master software used with this sample can be 
					downloaded (Demo Version) via the following company link.
					
					WinTECH Software Systems incorporated
					
					http://www.win-tech.com
					(modscan32.exe)
					
NOTES:			This sample does show 1 technique on how to convert float
					values (in this case the analog channel values), to unsigned
					int register pairs for use with the Modbus master.
					          

*****************************************************************************/

/******   Start of user configurable macros *********************************/

// Define the number of channels for each type of input

// Number of analog inputs/outputs.
#define	ADC_AMOUNT			11
#define	DAC_AMOUNT			4

// Maximum VDC output allowed, If the Master tries to send a value higher
// a MS_BADDATA (0x03) err will be sent back.
#define	MAX_DAC_VOLTS		10.00
 
// Number of digitial I/O
#define	INPUT_AMOUNT		24
#define	OUTPUT_AMOUNT		16

// Provide an ID for the slave device.  It MUST BE UNIQUE from any other 
// Modbus device connected. (Address 0 is the Master device).
#define	SLAVE_ADDRESS		0x01

// The baudrate used for the MODBUS protocol.
#define	MODBUS_BAUDRATE	9600	// 9600 is default, 19200 works to.

// Choose the protocol type, 0 for ASCII, 1 for RTU.  This MUST match the
// Modbus master protocol selection.
#define	MODBUS_TYPE			1	

/******  Done with user configurable macros *********************************/

// Setup up the serial port buffer size
#define	DINBUFSIZE	31
#define	DOUTBUFSIZE	31

// Modbus slave library, it also calls ms_rab.lib
#use		"msz_rab.lib"

//	Digital Output Shadow Registers
char 		acShad[OUTPUT_AMOUNT + 1];

//	Analog Output Shadow Registers
float		aoShad[DAC_AMOUNT + 1];


/************************ MODBUS FUNCTIONS *********************************\

The following are the individual Modbus functions.  The function Names must
stay the same for they are used in the ms_rab.lib.  The content of the
function will change for each application.  The following functions are
required to be in you application;

msDone, msStart, and msRun  

msXinit, msXrx, msXtx (X = A,B,C, or D for the serial port you are using).


/***************************************************************************/

/*=========================================================================*\
msDone:

	Called just after a received Modbus command has been
	processed and just before the reply is sent. This function is intended
	to be used to unlock resources that were locked by msStart(). Locking
	resources may or may not be required, depending on how the msIn(),
	msInput(), msOutRd() and msOutWr() functions are implemented in a
	particular Modbus slave application. Note that Modbus command handler
	functions in MS_RAB.LIB may make multiple calls to those functions while
	responding to a single Modbus command.
	
\*=========================================================================*/
		
nodebug
void msDone(void)
{
	// place any locked resources required.
}

/*=========================================================================*\
msStart:

	Called just before a received Modbus packet is processed,
	this function is primarily intended to be used to lock resources so
	that data returned in one Modbus response packet are atomic. Locking
	resources may or may not be required, depending on how the msIn(),
	msInput(), msOutRd() and msOutWr() functions are implemented in a
	particular Modbus slave application. Note that Modbus command handler
	functions in MS_RAB.LIB may make multiple calls to those functions while
	responding to a single Modbus command.

\*=========================================================================*/

nodebug
void msStart(void)
{
	// place any locked resources required.
}


/*=========================================================================*\
msDinit:
	Sets up and opens the serial port.  default settings are 8 data bits
	1 stop bit, no parity, no flow control.  You can change the settings 
	to match the Modbus serial control of your system.

\*=========================================================================*/

int msDinit(unsigned qBaud)
{
	// Open the serial port.  THIS MUST BE DONE PRIOR TO SETTING THE
	// DATA BITS AND PARITY SETTINGS.
	serDopen(qBaud); 
	  
	// setup parity.  Either PARAM_OPARITY, PARAM_EPARITY, PARAM_NOPARITY, 
	// or PARAM_2STOP  
	serDparity(PARAM_EPARITY);
	 
	// setup data bits. Either PARAM_7BIT, or PARAM_8BIT  
	serDdatabits(PARAM_8BIT);
	
  	// Set the Serial port mode. Used for Zworld SBC's only.  
	serMode(0);  
	return(1);
}

/*=========================================================================*\
msDtx:
	User definable function for enabling the rs485 transmitter (if needed).
	If you are doing RS232 simply leave the function blank.  The function
	itself must be present.

\*=========================================================================*/

void msDtx()
{
	// Turn on the transmitter. 
	ser485Tx();
}

/*=========================================================================*\
msDrx:
	User definable function for disabling the rs485 transmitter (if needed).
	If you are doing RS232 simply leave the function blank. The function  
	itself must be present.

\*=========================================================================*/

void msDrx()
{	
	// Make sure all of the data has been sent by;
	// 1.) checking the write buffer for any bytes left
	// 2.) checking the status of the Write interrupt transmit bit (2).
	// 3.) checking the status of the Write interrupt data bit (3)
	while (serDwrUsed() || BitRdPortI(SDSR,2) || BitRdPortI(SDSR,3)); 
	// turn off the transmitter
	ser485Rx();
	// Since we echo what we send, flush the read buffer, so that you are
	// ready for the next packet.
	serDrdFlush();	 
}

/*=========================================================================*\
	msOutRd:	(01:   Discrete Coil Status)
	
		Used for reading output coil status.  A user defined shadow register
		is required in your code which will  be updated when digital
		outputs change states using the msOutWr function.
		
		registers used;    
			0x00001 -> 	0x00016 	Digital Output 0 -> Digital Output 15    
		    
\*=========================================================================*/

int msOutRd(unsigned wCoil, int *pnState)
{
	//  Check to see if a valid output channel is being called.
	if (wCoil > (OUTPUT_AMOUNT) )	return MS_BADADDR;
	// copy the contents of the coil shadow element.
	*pnState = acShad[wCoil];
	return 0;
}

/*=========================================================================*\
	msOutWr:	(01:  Discrete Coil Writing)  
		Used for Writing to individual output coils, as well as updating
		the shadow register used in the above function msOutRd. 
		 
		registers used;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
调教+趴+乳夹+国产+精品| 亚洲人成网站影音先锋播放| 亚洲精品国产第一综合99久久 | 欧美午夜精品一区二区三区| 日本一区二区三区四区在线视频| 国产盗摄精品一区二区三区在线 | 国产一区二区看久久| 精品国内二区三区| 日韩精品自拍偷拍| 国产白丝精品91爽爽久久| 国产精品福利在线播放| 欧美亚洲综合在线| 欧美a级一区二区| 中文字幕日韩一区| 久久久综合网站| 一本大道久久精品懂色aⅴ| 蜜臀久久99精品久久久久久9| 国产毛片一区二区| 日韩国产一区二| 亚洲女与黑人做爰| 欧美高清在线视频| 日韩欧美视频一区| 555www色欧美视频| av成人免费在线| 成人av资源在线观看| 激情久久五月天| 日本 国产 欧美色综合| 偷拍亚洲欧洲综合| 亚洲免费观看高清完整版在线观看 | 91天堂素人约啪| 不卡一区二区中文字幕| 成人免费视频caoporn| 国产福利一区二区三区视频在线| 奇米777欧美一区二区| 精品亚洲aⅴ乱码一区二区三区| 日韩高清不卡在线| 蜜桃一区二区三区在线| 精品亚洲国内自在自线福利| 精品亚洲成a人| 国产乱妇无码大片在线观看| av中文字幕不卡| 91久久久免费一区二区| 欧美性一区二区| 日韩精品资源二区在线| 久久久久久久久久久99999| 国产精品系列在线| 亚洲夂夂婷婷色拍ww47| 久久黄色级2电影| 不卡一卡二卡三乱码免费网站| 色婷婷亚洲综合| 911精品产国品一二三产区| 国产在线看一区| 5566中文字幕一区二区电影 | 国产精品成人免费在线| 一区二区三区.www| 久久精品国产精品亚洲红杏| 丁香网亚洲国际| 91麻豆精品国产91久久久| 欧美极品少妇xxxxⅹ高跟鞋| 午夜电影一区二区三区| 成人一区二区在线观看| 日韩欧美一级二级三级| 亚洲大型综合色站| 亚洲情趣在线观看| 国产一区二区0| 精品美女在线播放| 国产在线精品国自产拍免费| 欧美日本在线一区| 亚洲午夜在线观看视频在线| 91免费国产在线| 久久久久99精品国产片| 亚洲一二三专区| 欧美日高清视频| 国产成人av电影在线| 精品动漫一区二区三区在线观看| 免费成人av在线播放| 日韩一区二区三区视频在线| 午夜日韩在线观看| 欧美一卡2卡三卡4卡5免费| 日韩成人av影视| 日韩美女在线视频 | 亚洲精品中文在线观看| 成人精品视频一区二区三区尤物| 亚洲精品在线电影| 狠狠色丁香婷婷综合| 国产精品电影一区二区三区| 在线精品视频一区二区| 亚洲福利视频三区| 日韩欧美的一区| 99久久精品国产麻豆演员表| 亚洲国产乱码最新视频| 91精品国产全国免费观看| 国产精品一区三区| 亚洲天堂精品在线观看| 欧美日韩精品一区二区天天拍小说 | 欧美xingq一区二区| 顶级嫩模精品视频在线看| 亚洲一线二线三线久久久| 亚洲精品在线观| 欧美日韩一区久久| 国产主播一区二区| 夜夜嗨av一区二区三区| 日韩免费观看高清完整版在线观看| 成人免费视频视频| 国产麻豆精品视频| 日韩国产高清在线| 亚洲综合丝袜美腿| 欧美va亚洲va在线观看蝴蝶网| 99久久精品免费看国产| 亚洲国产aⅴ天堂久久| 亚洲精品免费看| 在线观看免费视频综合| www.99精品| 国产精品亚洲第一区在线暖暖韩国| 色综合天天性综合| 懂色av一区二区在线播放| 国产一区二区三区| 久久综合综合久久综合| 日韩av一级电影| 日本91福利区| 国产精品一区免费在线观看| 国产成人在线网站| 成人亚洲一区二区一| 色8久久精品久久久久久蜜| 国产suv精品一区二区883| 成人在线综合网站| 欧美最猛黑人xxxxx猛交| 欧美一区二区三区公司| 欧美mv和日韩mv的网站| 久久一区二区视频| 亚洲欧美日韩在线| 日韩经典中文字幕一区| 久久成人羞羞网站| 色综合天天综合在线视频| 一本大道av一区二区在线播放| 欧美高清激情brazzers| 国产精品久久久久久久久免费相片| 国产欧美精品一区二区色综合| 亚洲综合免费观看高清完整版| 日韩av不卡在线观看| 国产99久久久精品| 欧美少妇bbb| 亚洲丝袜另类动漫二区| 激情综合网最新| 色综合夜色一区| 亚洲欧美在线视频观看| 久久99精品久久久久久国产越南 | 国产精品天干天干在线综合| 亚洲电影中文字幕在线观看| 成人免费视频app| 欧美极品aⅴ影院| 国模冰冰炮一区二区| 欧美少妇一区二区| 亚洲精品网站在线观看| av在线一区二区| 国产色一区二区| 色先锋资源久久综合| 一区二区三区在线观看国产| 6080日韩午夜伦伦午夜伦| 国产精品久久久久久久久免费桃花 | 欧美日韩国产成人在线免费| 日韩视频国产视频| 图片区小说区区亚洲影院| 欧美一级在线视频| 日产精品久久久久久久性色| 欧美一区二区啪啪| 国产很黄免费观看久久| 日本一区二区三区久久久久久久久不| 激情六月婷婷综合| 国产偷国产偷亚洲高清人白洁| 国产91精品精华液一区二区三区| 国产午夜亚洲精品理论片色戒 | 色www精品视频在线观看| 国产精品久久一级| 欧美自拍偷拍午夜视频| 一级做a爱片久久| 欧美精品在线观看播放| 精品对白一区国产伦| 国产精品77777| 久久久久国产精品人| 972aa.com艺术欧美| 午夜视频在线观看一区二区 | 欧美剧情片在线观看| 蜜臀久久久99精品久久久久久| 日韩精品一区二区三区视频在线观看 | 日韩久久久精品| 成人激情免费视频| 亚洲久本草在线中文字幕| 日韩欧美国产高清| 91热门视频在线观看| 捆绑调教美女网站视频一区| 精品不卡在线视频| 一本久久综合亚洲鲁鲁五月天| 日本va欧美va精品| 视频一区二区欧美| 中文字幕综合网| 欧美激情艳妇裸体舞| 2014亚洲片线观看视频免费| 欧美无人高清视频在线观看| 在线观看国产一区二区|