已閱讀5頁(yè),還剩19頁(yè)未讀, 繼續(xù)免費(fèi)閱讀
版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
freemodbus之協(xié)議模塊2007-12-27 10:43:32作者:來(lái)源:freemodbus之Modbus協(xié)議配置瀏覽次數(shù):844文字大?。骸敬蟆俊局小俊拘 亢?jiǎn)介:Detailed Description詳細(xì)描述 #include mb.h This module defines the interface for the application. It contains the basic functions and types required to use the Modbus protocol stack. A ty .Detailed Description詳細(xì)描述#include mb.h This module defines the interface for the application. It contains the basic functions and types required to use the Modbus protocol stack. A typical application will want to call eMBInit() first. If the device is ready to answer network requests it must then call eMBEnable() to activate the protocol stack. In the main loop the function eMBPoll() must be called periodically. The time interval between pooling depends on the configured Modbus timeout. If an RTOS is available a separate task should be created and the task should always call the function eMBPoll().這個(gè)模塊為應(yīng)用定義了接口。它包括了使用Modbus協(xié)議棧所必須的基本功能函數(shù)和類型。一個(gè)典型的應(yīng)用程序?qū)?huì)首先調(diào)用eMBInit()函數(shù)。如果該設(shè)備需要回應(yīng)網(wǎng)絡(luò)請(qǐng)求,則其必須調(diào)用eMBEnable()函數(shù)來(lái)激活協(xié)議棧。在主循環(huán)中,函數(shù)eMBPoll()將會(huì)被周期性調(diào)用。兩次調(diào)用的時(shí)間間隔決定于Modbus的超時(shí)時(shí)間設(shè)置。如果使用了RTOS,用戶則必須創(chuàng)建一個(gè)獨(dú)立的任務(wù),并且該任務(wù)必須一直調(diào)用函數(shù)eMBPoll()。/ Initialize protocol stack in RTU mode for a slave with address 10 = 0x0A eMBInit( MB_RTU, 0x0A, 38400, MB_PAR_EVEN ); / Enable the Modbus Protocol Stack. eMBEnable( ); for( ; ) / Call the main polling loop of the Modbus protocol stack. eMBPoll( ); . Defines定義#defineMB_TCP_PORT_USE_DEFAULT0Enumerations枚舉類型enum eMBModeMB_RTU,MB_ASCII,MB_TCPModbus協(xié)議的模式:RTU,ASCII和TCPenum eMBRegisterModeMB_REG_READ,MB_REG_WRITEModbus寄存器的模式:READ和WRITEenum eMBErrorCodeMB_ENOERR,MB_ENOREG,MB_EINVAL,MB_EPORTERR,MB_ENORES,MB_EIO,MB_EILLSTATE,MB_ETIMEDOUT錯(cuò)誤碼:沒(méi)有錯(cuò)誤,沒(méi)有寄存器,無(wú)效,IO錯(cuò)誤,無(wú)效,超時(shí)enum eMBParityMB_PAR_NONE,MB_PAR_ODD,MB_PAR_EVENModbus數(shù)據(jù)幀的校驗(yàn)類型:無(wú)校驗(yàn),偶校驗(yàn),奇校驗(yàn)Functions函數(shù)eMBErrorCodeeMBInit(eMBModeeMode, UCHAR ucSlaveAddress, UCHAR ucPort, ULONG ulBaudRate,eMBParityeParity)協(xié)議初始化函數(shù)輸入?yún)?shù):eMBModeeMode, Modubus協(xié)議模式UCHAR ucSlaveAddress,子模塊地址UCHAR ucPort,端口ULONG ulBaudRate,波特率eMBParityeParity串行數(shù)據(jù)的奇偶校驗(yàn)eMBErrorCodeeMBTCPInit(USHORT usTCPPort)如果使用了TCP協(xié)議,則用該函數(shù)進(jìn)行初始化eMBErrorCodeeMBClose(void)關(guān)閉Modbus協(xié)議棧eMBErrorCodeeMBEnable(void)使能Modbus協(xié)議棧eMBErrorCodeeMBDisable(void)禁止Modbus協(xié)議棧eMBErrorCodeeMBPoll(void)周期性調(diào)用的協(xié)議處理函數(shù)eMBErrorCodeeMBSetSlaveID(UCHAR ucSlaveID, BOOL xIsRunning, UCHAR const *pucAdditional, USHORT usAdditionalLen)設(shè)置子模塊ID輸入?yún)?shù):UCHAR ucSlaveID,子模塊IDBOOL xIsRunning,UCHAR const *pucAdditional,USHORT usAdditionalLeneMBErrorCodeeMBRegisterCB(UCHAR ucFunctionCode, pxMBFunctionHandler pxHandler)Modbus協(xié)議的寄存器回調(diào)函數(shù)輸入?yún)?shù):UCHAR ucFunctionCode,功能碼pxMBFunctionHandler pxHandler功能碼對(duì)應(yīng)的處理函數(shù)Define Documentation文檔#define MB_TCP_PORT_USE_DEFAULT0Use the default Modbus TCP port (502).使用缺省的ModbusTCP移植Examples:MCF5235TCP/demo.c,STR71XTCP/demo.c, andWIN32TCP/demo.cpp.Enumeration Type Documentation枚舉類型定義enumeMBErrorCodeErrorcodes used by all function in the protocol stack.在協(xié)議棧中所有函數(shù)使用的錯(cuò)誤碼Enumeration values:枚舉值MB_ENOERRno error.沒(méi)有錯(cuò)誤MB_ENOREGillegal register address.無(wú)效的寄存器地址MB_EINVALillegal argument.無(wú)效的參數(shù)MB_EPORTERRporting layer error.移植層錯(cuò)誤MB_ENORESinsufficient resources.資源不足MB_EIOI/O error. I/O錯(cuò)誤MB_EILLSTATEprotocol stack in illegal state.協(xié)議棧狀態(tài)錯(cuò)誤MB_ETIMEDOUTtimeout error occurred.超時(shí)錯(cuò)誤Examples:例子:AT91SAM7X_ROWLEY/demo.c,AVR/demo.c,LINUX/demo.c,MCF5235/demo.c,MCF5235TCP/demo.c,MSP430/demo.c,STR71X/simple2.c,STR71XTCP/demo.c,WIN32/demo.cpp, andWIN32TCP/demo.cpp.enumeMBModeModbus serial transmission modes (RTU/ASCII).Modubs串行傳輸模式Modbus serial supports two transmission modes. Either ASCII or RTU. RTU is faster but has more hardware requirements and requires a network with a low jitter. ASCII is slower and more reliable on slower links (E.g. modems)Modbus串行傳輸支持兩種模式,ASCII或者是RTU。RTU模式較快但是具有較高的硬件要求并且要求網(wǎng)絡(luò)延遲要低。ASCII模式較慢,但是在低速連接中更加可靠(如moderms)。Enumeration values:MB_RTURTU transmission mode. RTU傳輸模式MB_ASCIIASCII transmission mode. ASCII傳輸模式MB_TCPTCP mode. TCP模式enumeMBParityParity used for characters in serial mode.串行模式中字符的極性The parity which should be applied to the characters sent over the serial link. Please note that this values are actually passed to the porting layer and therefore not all parity modes might be available.串行字符傳輸時(shí)應(yīng)用的校驗(yàn)格式。需要注意,這個(gè)值其實(shí)是傳給移植層,并且不是所有的奇偶模式都能有效。Enumeration values:MB_PAR_NONENo parity.無(wú)奇偶校驗(yàn)MB_PAR_ODDOdd parity.偶校驗(yàn)MB_PAR_EVENEven parity.奇校驗(yàn)enumeMBRegisterModeIf register should be written or read.寄存器是讀還是寫This value is passed to the callback functions which support either reading or writing register values. Writing means that the application registers should be updated and reading means that the modbus protocol stack needs to know the current register values.值將傳給支持讀或者寫寄存器的回調(diào)函數(shù)。寫意味著應(yīng)用寄存器更新,讀表示Modbus協(xié)議棧需要知道當(dāng)前寄存器的數(shù)值。See also:eMBRegHoldingCB( ),eMBRegCoilsCB( ),eMBRegDiscreteCB( )andeMBRegInputCB( ).Enumeration values:MB_REG_READRead register values and pass to protocol stack.讀寄存器數(shù)值并且傳給協(xié)議棧MB_REG_WRITEUpdate register values.更新寄存器數(shù)值Examples:AT91SAM7X_ROWLEY/demo.c,AVR/demo.c,LINUX/demo.c,MCF5235/demo.c,MCF5235TCP/demo.c,MSP430/demo.c,STR71X/simple2.c,STR71XTCP/demo.c,WIN32/demo.cpp, andWIN32TCP/demo.cpp.Function DocumentationeMBErrorCodeeMBClose(void)Release resources used by the protocol stack.釋放協(xié)議棧使用的資源。This function disables the Modbus protocol stack and release all hardware resources. It must only be called when the protocol stack is disabled.該函數(shù)禁止Modbus協(xié)議棧并且釋放所有的硬件資源。只有當(dāng)協(xié)議棧被禁止了,才能調(diào)用這個(gè)函數(shù)。Note:注意Note all ports implement this function. A port which wants to get an callback must define the macro MB_PORT_HAS_CLOSE to 1.注意所有的移植都要實(shí)現(xiàn)這個(gè)函數(shù)。需要獲取回調(diào)Returns:If the resources where released it returneMBErrorCode:MB_ENOERR. If the protocol stack is not in the disabled state it returnseMBErrorCode:MB_EILLSTATE.如果資源釋放了,該函數(shù)返回eMBErrorCode:MB_ENOERR。如果協(xié)議棧不是處于禁止?fàn)顟B(tài),它返回eMBErrorCode:MB_EILLSTATE。Examples:LINUX/demo.c,MCF5235TCP/demo.c,STR71XTCP/demo.c,WIN32/demo.cpp, andWIN32TCP/demo.cpp.eMBErrorCodeeMBDisable(void)Disable the Modbus protocol stack.禁止Modbus協(xié)議棧。This function disables processing of Modbus frames.這個(gè)函數(shù)禁止處理Modbus幀。Returns:返回If the protocol stack has been disabled it returnseMBErrorCode:MB_ENOERR. If it was not in the enabled state it returnseMBErrorCode:MB_EILLSTATE.Examples:LINUX/demo.c,MCF5235TCP/demo.c,STR71XTCP/demo.c,WIN32/demo.cpp, andWIN32TCP/demo.cpp.eMBErrorCodeeMBEnable(void)Enable the Modbus protocol stack.使能Modbus協(xié)議棧This function enables processing of Modbus frames. Enabling the protocol stack is only possible if it is in the disabled state.本函數(shù)使能Modbus幀的處理。Returns:If the protocol stack is now in the state enabled it returnseMBErrorCode:MB_ENOERR. If it was not in the disabled state it returneMBErrorCode:MB_EILLSTATE.Examples:AT91SAM7X_ROWLEY/demo.c,AVR/demo.c,LINUX/demo.c,MCF5235/demo.c,MCF5235TCP/demo.c,MSP430/demo.c,STR71X/simple2.c,STR71XTCP/demo.c,WIN32/demo.cpp, andWIN32TCP/demo.cpp.eMBErrorCodeeMBInit(eMBModeeMode,UCHARucSlaveAddress,UCHARucPort,ULONGulBaudRate,eMBParityeParity)Initialize the Modbus protocol stack.初始化Modbus協(xié)議棧This functions initializes the ASCII or RTU module and calls the init functions of the porting layer to prepare the hardware. Please note that the receiver is still disabled and no Modbus frames are processed untileMBEnable( )has been called.該函數(shù)初始化為ASCII或者RTU模式,并且調(diào)用移植層的初始化函數(shù)來(lái)準(zhǔn)備硬件。需要注意的是,接受依然是禁止的,并且Modbus數(shù)據(jù)幀都不會(huì)得到處理,除非eMBEnable( )被調(diào)用。Parameters:eModeIf ASCII or RTU mode should be used. Modbus模式ucSlaveAddressThe slave address. Only frames sent to this address or to the broadcast address are processed.子模塊地址。只有發(fā)向本模塊地址或者廣播地址的數(shù)據(jù)幀能得到處理。ucPortThe port to use. E.g. 1 for COM1 on windows. This value is platform dependent and some ports simply choose to ignore it.使用的端口。該值是硬件相關(guān)的,許多移植都會(huì)選擇忽略該參數(shù)。ulBaudRateThe baudrate. E.g. 19200. Supported baudrates depend on the porting layer.波特率,所支持的波特率決定于移植層。eParityParity used for serial transmission.串行傳輸使用的校驗(yàn)。Returns:If no error occurs the function returnseMBErrorCode:MB_ENOERR. The protocol is then in the disabled state and ready for activation by callingeMBEnable( ). Otherwise one of the following error codes is returned:eMBErrorCode:MB_EINVALIf the slave address was not valid. Valid slave addresses are in the range 1 - 247.eMBErrorCode:MB_EPORTERRIF the porting layer returned an error.如果沒(méi)有錯(cuò)誤,這個(gè)函數(shù)返回eMBErrorCode:MB_ENOERR。協(xié)議棧將處于禁止?fàn)顟B(tài),可以通過(guò)調(diào)用eMBEnable( )來(lái)激活。否則,將返回下列的一個(gè)錯(cuò)誤:eMBErrorCode:MB_EINVAL如果子模塊地址無(wú)效。eMBErrorCode:MB_EPORTERR如果移植層返回一個(gè)錯(cuò)誤。Examples:AT91SAM7X_ROWLEY/demo.c,AVR/demo.c,LINUX/demo.c,MCF5235/demo.c,MSP430/demo.c,STR71X/simple2.c, andWIN32/demo.cpp.eMBErrorCodeeMBPoll(void)The main pooling loop of the Modbus protocol stack.Modbus協(xié)議棧的主輪詢函數(shù)。This function must be called periodically. The timer interval required is given by the application dependent Modbus slave timeout. Internally the function calls xMBPortEventGet() and waits for an event from the receiver or transmitter state machines.該函數(shù)必須被周期性調(diào)用。兩次調(diào)用的時(shí)間間隔決定于Modbus的超時(shí)時(shí)間設(shè)置。在函數(shù)內(nèi)部調(diào)用了xMBPortEventGet()函數(shù)來(lái)等待接受或者發(fā)送狀態(tài)機(jī)發(fā)出的事件。Returns:If the protocol stack is not in the enabled state the function returnseMBErrorCode:MB_EILLSTATE. Otherwise it returnseMBErrorCode:MB_ENOERR.如果協(xié)議棧沒(méi)有被使能,這個(gè)函數(shù)返回eMBErrorCode:MB_EILLSTATE.,否則返回eMBErrorCode:MB_ENOERR.Examples:AT91SAM7X_ROWLEY/demo.c,AVR/demo.c,LINUX/demo.c,MCF5235/demo.c,MCF5235TCP/demo.c,MSP430/demo.c,STR71X/simple2.c,STR71XTCP/demo.c,WIN32/demo.cpp, andWIN32TCP/demo.cpp.eMBErrorCodeeMBRegisterCB(UCHARucFunctionCode,pxMBFunctionHandlerpxHandler)Registers a callback handler for a given function code.為給定的功能碼注冊(cè)一個(gè)回調(diào)處理函數(shù)。This function registers a new callback handler for a given function code. The callback handler supplied is responsible for interpreting the Modbus PDU and the creation of an appropriate response. In case of an error it should return one of the possible Modbus exceptions which results in a Modbus exception frame sent by the protocol stack.這個(gè)函數(shù)為一個(gè)給定的功能代碼注冊(cè)一個(gè)新的回調(diào)函數(shù)。提供的回調(diào)函數(shù)負(fù)責(zé)解釋Modbus PDU并且創(chuàng)建一個(gè)合適的應(yīng)答。當(dāng)錯(cuò)誤發(fā)生時(shí),這個(gè)函數(shù)會(huì)返回一個(gè)Modbus異常,該異常是由協(xié)議棧發(fā)送的Modbus異常。Parameters:參數(shù)ucFunctionCodeThe Modbus function code for which this handler should be registers. Valid function codes are in the range 1 to 127.注冊(cè)的功能碼,有效的功能碼范圍是1到127pxHandlerThe function handler which should be called in case such a frame is received. IfNULLa previously registered function handler for this function code is removed.功能碼對(duì)應(yīng)的回調(diào)函數(shù)。如果為空,一個(gè)以前定義功能碼回調(diào)函數(shù)將被去掉。Returns:返回eMBErrorCode:MB_ENOERRif the handler has been installed. If no more resources are available it returnseMBErrorCode:MB_ENORES. In this case the values inmbconfig.hshould be adjusted. If the argument was not valid it returnseMBErrorCode:MB_EINVAL.eMBErrorCode:MB_ENOERR如果回調(diào)函數(shù)正常安裝。如果資源不足,將返回eMBErrorCode:MB_ENORES.在這種情況下,在mbconfig.h中定義的數(shù)值必須進(jìn)行修改。如果參數(shù)無(wú)效,函數(shù)將返回eMBErrorCode:MB_EINVAL.eMBErrorCodeeMBSetSlaveID(UCHARucSlaveID,BOOLxIsRunning,UCHAR const *pucAdditional,USHORTusAdditionalLen)Configure the slave id of the device.設(shè)置設(shè)備的IDThis function should be called when the Modbus functionReport Slave IDis enabled ( By defining MB_FUNC_OTHER_REP_SLAVEID_ENABLED inmbconfig.h).當(dāng)使用Modbus的Report Slave ID功能時(shí),這個(gè)函數(shù)將會(huì)被調(diào)用(通過(guò)在mbconfig.h中定義MB_FUNC_OTHER_REP_SLAVEID_ENABLED)。Parameters:ucSlaveIDValues is returned in theSlave IDbyte of theReport Slave IDresponse.xIsRunningIf TRUE theRun Indicator Statusbyte is set to 0xFF. otherwise theRun Indicator Statusis 0x00.pucAdditionalValues which should be returned in theAdditionalbytes of theReport Slave IDresponse.usAdditionalLenLength of the bufferpucAdditonal.Returns:If the static buffer defined by MB_FUNC_OTHER_REP_SLAVEID_BUF inmbconfig.his to small it returnseMBErrorCode:MB_ENORES. Otherwise it returnseMBErrorCode:MB_ENOERR.Examples:AVR/demo.c,LINUX/demo.c,MCF5235/demo.c, andWIN32/demo.cpp.eMBErrorCodeeMBTCPInit(USHORTusTCPPort)Initialize the Modbus protocol stack for Modbus TCP.Modbus TCP的協(xié)議初始化This function initializes the Modbus TCP Module. Please note that frame processing is still disabled untileMBEnable( )is called.該函數(shù)初始化Modbus TCP模塊。注意,幀處理在eMBEnable()函數(shù)調(diào)用之前是禁止掉的。Parameters:參數(shù)usTCPPortThe TCP port to listen on.監(jiān)聽(tīng)的TCP端口Returns:返回If the protocol stack has been initialized correctly the function returnseMBErrorCode:MB_ENOERR. Otherwise one of the following error codes is returned:eMBErrorCode:MB_EINVALIf the slave address was not valid. Valid slave addresses are in the range 1 - 247.eMBErrorCode:MB_EPORTERRIF the porting layer returned an error.如果協(xié)議棧初始化正確,函數(shù)返回MB_ENOERR。否則,函數(shù)會(huì)返回如下的錯(cuò)誤碼:eMBErrorCode:MB_EINVAL如果子模塊地址無(wú)效,有效的子地址范圍是1247eMBErrorCode:MB_EPORTERR如果移植層返回一個(gè)錯(cuò)誤。Examples:MCF5235TCP/demo.c,STR71XTCP/demo.c, andWIN32TCP/demo.cpp.簡(jiǎn)介:Modbus Registers Modbus的寄存器 Detailed Description 詳細(xì)描述 #include mb.h The protocol stack does not internally allocate any memory for the registers. This makes the protocol stack .Modbus RegistersModbus的寄存器Detailed Description詳細(xì)描述#include mb.h The protocol stack does not internally allocate any memory for the registers. This makes the protocol stack very small and also usable on low end targets. In addition the values dont have to be in the memory and could for example be stored in a flash.Whenever the protocol stack requires a value it calls one of the callback function with the register address and the number of registers to read as an argument. The application should then read the actual register values (for example the ADC voltage) and should store the result in the supplied buffer.If the protocol stack wants to update a register value because a write register function was received a buffer with the new register values is passed to the callback function. The function should then use these values to update the application register values.協(xié)議棧不在內(nèi)部為寄存器分配空間。這就使得協(xié)議棧非常小并且適用于低端目標(biāo)應(yīng)用。并且Modbus寄存器的值不一定存儲(chǔ)在內(nèi)存中,而是可以存儲(chǔ)在如flash之類的存儲(chǔ)器中。當(dāng)協(xié)議棧需要獲取數(shù)值是,它通過(guò)調(diào)用回調(diào)函數(shù)來(lái)實(shí)現(xiàn),該回調(diào)函數(shù)以寄存器地址和數(shù)量作為參數(shù)。應(yīng)用程序?qū)⒆x實(shí)際的寄存器數(shù)值(如ADC電壓),并且存儲(chǔ)在特定的緩沖區(qū)中。如果協(xié)議棧收到了一個(gè)寫寄存器命令,將會(huì)執(zhí)行寄存器更新操作,一個(gè)包含新寄存器數(shù)值的緩沖區(qū)會(huì)傳給回調(diào)函數(shù)。這個(gè)回調(diào)函數(shù)將用這些值來(lái)更新應(yīng)用寄存器數(shù)值。Functions功能函數(shù)eMBErrorCodeeMBRegInputCB(UCHAR *pucRegBuffer, USHORT usAddress, USHORT usNRegs)輸入寄存器回調(diào)函數(shù)eMBErrorCodeeMBRegHoldingCB(UCHAR *pucRegBuffer, USHORT usAddress, USHORT usNRegs,eMBRegisterModeeMode)保持寄存器回調(diào)函數(shù)eMBErrorCodeeMBRegCoilsCB(UCHAR *pucRegBuffer, USHORT usAddress, USHORT usNCoils,eMBRegisterModeeMode)線圈狀態(tài)寄存器回調(diào)函數(shù)eMBErrorCodeeMBRegDiscreteCB(UCHAR *pucRegBuffer, USHORT usAddress, USHORT usNDiscrete)離散寄存器回調(diào)函數(shù)Function Documentation功能函數(shù)文檔eMBErrorCodeeMBRegCoilsCB(UCHAR *pucRegBuffer,USHORTusAddress,USHORTusNCoils,eMBRegisterModeeMode)Callback function used if aCoil Registervalue is read or written by the protocol stack. If you are going to use this function you might use the functionsxMBUtilSetBits( )andxMBUtilGetBits( )for working with bitfields.如果協(xié)議棧需要對(duì)線圈狀態(tài)寄存器進(jìn)行讀寫,則需要調(diào)用回調(diào)函數(shù)。如果用戶用到這個(gè)功能,用戶可能用到xMBUtilSetBits( )和xMBUtilGetBits( )來(lái)處理位域。Parameters:參數(shù)pucRegBufferThe bits are packed in bytes where the first coil starting at addressusAddressis stored in the LSB of the first byte in the bufferpucRegBuffer. If the buffer should be written by the callback function unused coil values (I.e. if not a multiple of eight coils is used) should be set to zero.位組成一個(gè)字節(jié),起始寄存器對(duì)應(yīng)的位處于該字節(jié)pucRegBuffer的最低位LSB。如果回調(diào)函數(shù)要寫這個(gè)緩沖區(qū),沒(méi)有用到的線圈(例如不是8個(gè)一組的線圈狀態(tài))對(duì)應(yīng)的位的數(shù)值必須設(shè)置位0。usAddressThe first coil number.第一個(gè)線圈地址usNCoilsNumber of coil values requested.請(qǐng)求的線圈個(gè)數(shù)eModeIfeMBRegisterMode:MB_REG_WRITEthe application values should be updated from the values supplied in the bufferpucRegBuffer. IfeMBRegisterMode:MB_REG_READthe application should store the current values in the bufferpucRegBuffer.如果該參數(shù)為eMBRegisterMode:MB_REG_WRITE,用戶的應(yīng)用數(shù)值將從pucRegBuffer中得到更新。如果該參數(shù)為eMBRegisterMode:MB_REG_READ,用戶需要將當(dāng)前的應(yīng)用數(shù)據(jù)存儲(chǔ)在pucRegBuffer中。Returns:返回The function must return one of the following error codes:這個(gè)函數(shù)將返回如下的錯(cuò)誤碼:eMBErrorCode:MB_ENOERRIf no error occurred. In this case a normal Modbus response is sent.eMBErrorCode:MB_ENOERR如果沒(méi)有錯(cuò)誤發(fā)生。在這種情況下,發(fā)送一個(gè)正常的Modbus應(yīng)答。eMBErrorCode:MB_ENOREGIf the application does not map an coils within the requested address range. In this case aILLEGAL DATA ADDRESSis sent as a response.eMBErrorCode:MB_ENOREG如果請(qǐng)求的地址范圍中沒(méi)有線圈狀態(tài)寄存器,在這種情況下,發(fā)送一個(gè)ILLEGAL DATA ADDRESS應(yīng)答。eMBErrorCode:MB_ETIMEDOUTIf the requested register block is currently not available and the application dependent response timeout would be violated. In this case aSLAVE DEVICE BUSYexception is sent as a response.eMBErrorCode:MB_ETIMEDOUT如果請(qǐng)求的寄存器區(qū)當(dāng)前無(wú)效,并且應(yīng)用相關(guān)的應(yīng)當(dāng)超時(shí)。這種情況下,發(fā)送一個(gè)SLAVE DEVICE BUSY應(yīng)答。eMBErrorCode:MB_EIOIf an unrecoverable error occurred. In this case aSLAVE DEVICE FAILUREexception is sent as a response.eMBErrorCode:MB_EIO如果一個(gè)其他錯(cuò)誤發(fā)生。在這種情況下,發(fā)送一個(gè)SLAVE DEVICE FAILURE應(yīng)答。Examples:例子AT91SAM7X_ROWLEY/demo.c,AVR/demo.c,LINUX/demo.c,MCF5235/demo.c,MCF5235TCP/demo.c,MSP430/demo.c,STR71X/simple2.c,STR71XTCP/demo.c,WIN32/demo.cpp, andWIN32TCP/demo.
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2024年銀團(tuán)貸款協(xié)議
- 2025年度補(bǔ)充協(xié)議范本:簽約次數(shù)限定與實(shí)施標(biāo)準(zhǔn)6篇
- 2024年食品包裝材料供貨合同
- 2024年碎石加工與石材深加工融合合同范本3篇
- 2024移動(dòng)支付技術(shù)服務(wù)與許可合同
- 2024轄區(qū)物業(yè)滅鼠與公共設(shè)施保養(yǎng)服務(wù)合同3篇
- 2025年度跨境電商代理招聘合作協(xié)議2篇
- 2024預(yù)制混凝土構(gòu)件產(chǎn)業(yè)鏈上下游企業(yè)合作協(xié)議范本3篇
- 南開(kāi)大學(xué)時(shí)間序列分析往年期末試題考題
- 2025年度社區(qū)食堂經(jīng)營(yíng)權(quán)租賃合同3篇
- 2024年公安機(jī)關(guān)理論考試題庫(kù)及答案(真題匯編)
- 2023-2024學(xué)年天津市四校聯(lián)考高一(下)期末地理試卷
- 2025年浙江舟山國(guó)家遠(yuǎn)洋漁業(yè)基地建設(shè)發(fā)展集團(tuán)有限公司招聘筆試參考題庫(kù)附帶答案詳解
- 2024秋新商務(wù)星球版地理7年級(jí)上冊(cè)教學(xué)課件 第5章 地球表層的人文環(huán)境要素 第3節(jié) 世界文化的多樣性
- 重慶市渝北區(qū)六校聯(lián)盟2024-2025學(xué)年八年級(jí)上學(xué)期12月月考數(shù)學(xué)試題
- 2024年山東省聊城市中考英語(yǔ)真題含解析
- 安徽省蕪湖市2023-2024學(xué)年高一上學(xué)期期末考試 地理 含答案
- 全新標(biāo)前協(xié)議書范本下載
- 企業(yè)反恐安全經(jīng)費(fèi)使用制度
- 可行性研究報(bào)告 范文“母親水窖”建設(shè)項(xiàng)目可行性研究報(bào)告
- Teeth歌詞下載,Teeth原唱歌詞中文翻譯5SecondsofSummer
評(píng)論
0/150
提交評(píng)論