Home

Wifi relay board user manual

image

Contents

1. U sr cn Temperature and Humidity data Transmitter http en usr cn In this example the client requests addressing to the server equipment Function code 01 is used to read the output state operation It will request output state of address 0 x04a1 It only read one output as output domain 0001 stated If there is no output address in the server device the server will return exceptional response of exception code 02 which means illegal data address The excel of MDOBUS exception code the module support is following MODBUS abnormal code 0x01 Illegal function For modules the received function code during querying is un allowed operation Meanwhile it indicate that upper computer send requirements in error status example as it is un configured function and need return data 0x02 Illegal data address For modules the received data address during querying is un allowed address Especially the combination of starting address and data number is invalid For modules starting address 0x0001 request data number is 0x0004 is invalid will appear abnormal code0x02 address 0 00 used for broadcast if try to set module ID to be 0x00 will reply this abnormal code 0x04 Module fault This is not a standard abnormal code in MODBUS protocol but a customized abnormal code When module reply 0 need to judge the reason of the code by commands that upper computer sent when upper computer command is to set module ID
2. 1 Serial interface Baud rate 9600 Data bits 8 Stop bits 1 No parity bit 2 Module ID Ox indicate hexadecimal numbers the same below 0x11 1 6 Tips before using 1 Certain foundation of the MODBUS protocol is necessary before you use this Or refer to 2 2 command format in Chapter Two Working mode to design command you use and upper computer program lts data transmission is Serial MODBUS protocol accordingly We provide technical support based on it You can use network to serial port module send module instruction and data via Serial MODUBS agreement However we don t support this knowledge and application solutions please refer to relevant documents Besides it supports 3 ASCII commands to read the current environmental temperature and humidity data Note Only one module is available on the line more modules will lead to disorder As for format and parameters of command please refer to 2 3 Simple ASCII Command in Chapter Two Working mode Jinan USR IOT Technology Limited Page 5 18 tec usr cn E BABE Usr cn Temperature and Humidity data Transmitter http en usr cn 2 Check code filed is necessary in sending and receiving commands It adapts CRC16 check and respond to your commands when checked correct so as to ensure the accuracy of the data transmission and stability of the system you build The source code of CRC checking is in Appendix II 3 It receives commands of 8 byte and variable le
3. OxB8C1 OxB981 0 7940 OxBBO1 0 0 7 80 0 41 OxBEO1 0 Ox 7F80 OxBF41 Ox D00 OxBDC1 0xBC81 0x C40 0 401 0 74 0 0x7580 0 541 0 7700 OxB C1 0xB681 0x 7640 0 7200 OxB2C1 0 381 0 7340 0 101 0 7100 0 7080 0 041 0 5000 Ox90C1 0 9181 0 5140 0 9301 0 53 0 0x5280 0x9241 0 9601 0 56 0 0 5780 0 9741 0 5500 0x95C1 0x9481 0x5440 0 9 01 Ox5CCO 0Ox5D80 0 9041 0Ox5F00 Ox9FC1 Ox9E81 0x5E40 Ox5A00 Ox9AC1 Ox9B81 0 5840 0x9901 0 99 0 0x5880 0x9841 0 8801 0 48 0 0 4980 0 8941 0 4 00 0 9 1 0x8A81 0x4A40 0 4 00 Ox8EC1 Ox8F81 Ox4F40 Ox8D01 Ox4DCO 0x4C80 0x8C41 0 4400 0 84 1 0 8581 0 4540 0 8701 0 47 0 0x4680 0x8641 0 8201 0 42 0 0 4380 0 8341 0 4100 0x81C1 0 8081 0 4040 unsigned int cal_crc16 unsigned char ptr unsigned char len unsigned int crc OXffff Jinan USR IOT Technology Limited Page 17 18 tec usr cn E BABE Usr cn Temperature and Humidity data Transmitter http en usr cn while len gt 0 crc ccitt table crc amp Oxff crc gt gt 8 return crc 3 Contract us Jinan USR IOT Technology Limited Address 1 728 Huizhan Guoji Cheng Gaoxin Qu Jinan Shandong China Tel 86 531 55507297 86 531 88826739 803 Web http en usr cn Skype lisausr Email sales usr cn tec usr cn Jinan USR IOT Technology Limited Page 18 18 tec us
4. the module will return a normal response a normal MODBUS frame 2 If module does not receive the request due to communication error and can t return response PC program will handle the timeout mode 3 If module receives the request but detect a communication error Odd even check LRC CRC can t return response PC program will handle the timeout mode 4 If module receives the request without communication error but can t deal with this request for example if the request is to read a nonexistent output or register the module will return an exceptional response and reveal the essential of the user error Exceptional response packet has two domains different with the normal one Function code domain In the normal response the module responses function code domain to answer function code of the initial request All function codes most significant bit MSB is O their values are less than hex 80 while it is 1 in abnormal response which makes the function code in the exceptional response 0x80 higher than normal PC application can identify exceptional response and detect its data domain by setting MSB of the function code Data domain in normal response the module can return data within or statistics all requirements requested while module return abnormal data and defines the exceptional state The example of user device request and server abnormal reply Jinan USR IOT Technology Limited Page 12 18 tec usr cn 97 BARK
5. During address 0x0001 High byte is used to store baud rate parameters low byte is used to set check stop bit Setting format is as below Baud rate parameters 0 1200 1 4800 2 9600 3 19200 4 38400 5 57600 Check stop bit parameters byte7 byte6 empy dhg Byte 5 byte 4 STOP stop bit to set bits of stop 00 1 stop bit 10 2 stop bits Byte 2 oddleven control enable O disabiel tenable Byte 1 oddeven select 0ever J Note when the stop bit is set to 2 the check bit can only be set to 0 When check bit is Odd even stop bit can only be set to 1 When using a simple ASCII command parameters of serial port Settings also must comply with the rules Command frame 0x11 0x06 0x00 0x01 0x02 0x04 OxDA 0x39 ID function code address baud rate Check stop bit check code Jinan USR IOT Technology Limited Page 11 18 tec usr cn 5 97 BARK U sr cn Temperature and Humidity data Transmitter http en usr cn Respond frame 0x11 0x06 0x00 0x01 0x02 0x04 OxDA 0x39 ID respond function code return address return data CRC check code The command set module baud rate to be 9600 1 stop bit even parity check 2 2 4 MODBUS exceptional response When the PC device sends a request to the module PC hope a normal response The following four condition may occur in hub station inquiry 1 If the module receives the request without communication error and can properly deal with inquiry
6. begins and ends or data will be written and 2Bytes CRC The command frame address filed values 0 00 0 7 Broadcast acts when It values 0 and All equipment support MODBUS protocol operates according to the command but does not return data function code support values 0x03 read temperature and humidity data temperature humidity or temperature amp humidity 0x04 read temperature and humidity data temperature humidity or temperature amp humidity 0x06 set equipment ID and module serial parameters opecially when PC send broadcast command the module support a customized function code OxGE The code will reset equipment ID to factory Default when users ignore or not sure with module ID During reading temperature and humidity data the first 2 Bytes means read begins and ends High byte is before low byte 0x00 0x00 means to read from the first data 0x00 0x01 means to read from the second data The last 2Byte means the number of reading data High byte is before low byte 0x00 0x01 means to read 1 data 0x00 0x02 means to read 2 data Error checking adapts CRC16 2Bytes High byte is before low byte which is recommended by MODBUS protocol 2 2 2 MODBUS response frame MDOBUS response frame includes 1 Byte address filed return module ID to PC 1Byte function code exception code return function code exception code module received 2Bytes 5Bytes data 1Byte means the number of byte r
7. 97 BARK U sr cn Temperature and Humidity data Transmitter http en usr cn Temperature and humidity data Transmitter Instruction Version V1 0 Date 2014 4 15 USR SENS WSD T USR SENS WSD 2 USR SENS WSD 4 Jinan USR IOT Technology Limited Page 1 18 tec usr cn E BABE Usr cn Temperature and Humidity data Transmitter http en usr cn Content Vg WTF OG ION ITI 3 Ts OV uc nmm 3 f ers icu e NR 3 Ud 3 14 menace GS IMM O TNT 5 N m 5 1 6 Tips before 5 2 Working NOG __ _6________6___ 6 _ T PES 6 0 ACM AINA T 2 2 CONT e _______________ T 2 2 1 MODBUS command ene nnne T 2 2 2 MODBUS response frame eee e enne eene 8 2 2 9 MODBUS Frame 2 9 2 2 4 MODBUS exceptional response sss 12 2 2 5 MODBUS exceptional responseframe 13 2 3 ASCII COIT ______________ 15 Lug 32 15 23220109 15 Me po 16 eee ee 17 Language C implementation
8. High byte is before low byte which is recommended by MODBUS protocol 2 2 3 MODBUS Frame Example The below is MODBUS command frame format and respond frame format to read module data Command frame ID is not fixed and it is set by default in the example All MODBUS Frame ID should keep updated if users make re configuration Respond frame data is not fixed but the format fixed 2 2 3 1 Read device ID Respond frame 0x11 0 03 0x01 0x11 0x34 0x84 ID respond code return byte number device ID CRC check code 2 2 3 2 Read Humidity data Command frame 0x11 0x04 0x00 0x00 0x01 0x33 Ox5A ID function code begins and ends read number of data CRC check code Respond frame 0x11 0x04 0x02 0x01 OxC3 0x39 0x32 ID respond code return byte number return humidity data CRC check code Humidity data returned is 0x01C3 equal to decimalism 451 It means relativehumidity is 45 1 at moment Jinan USR IOT Technology Limited Page 9 18 tec usr cn 5 Usr cn Temperature and Humidity data Transmitter http en usr cn 2 2 3 3 Read Temperature data Command frame 11 0 04 0 00 0x01 0x01 0 62 Ox9A ID function code begins and ends read number of data CRC check code Respond frame 0x11 0x04 0x02 0x00 OxEE OxF8 OxBF ID respond code returned byte num return temperature data check code Temperature data returned is OxOOEE equal to decimalism 238 It means current temperature is 23 8 2 2 3 4 Read Humidi
9. eturned 1Byte 4Bytes means selectable data and 2Bytes CRC check code used to error checking Response frame address filed Command frame address filed The module compare address filed and CRC check code it get from PC command frame with own ID and calculated one If they are same and CRC Check correct it will read the data and send respond frame If not no response Respond function code domain function code support values 0x03 read temperature and humidity data temperature humidity or temperature amp humidity 0x04 read temperature and humidity data temperature humidity or temperature amp humidity 0x06 Set module ID and serial port parameters reset module ID Jinan USR IOT Technology Limited Page 8 18 tec Qusr cn Usr cn Temperature and Humidity data Transmitter http en usr cn Return Abnormal code there s two parts 1 Byte each part The first reveals where s the problem the second directs how to slove it Data part 2Bytes 5Byte During returned data the first Bytes means numbers fo bytes returned Following 4 bytes means data returned High byte is before low byte Humidity data is before temperature High byte is before low byte lt is positive temperature when its highest is 0 and negative temperature when it is 1 Returned data is 10 times higher than actual measurement data As returned temperature data is 185 while the actual is 18 5 C Error checking adapts CRC16 2Bytes
10. module need restart to set ID when upper computer command is read data this code means not able to read data At 0x03 Illegal data value For modules the value during querying is un allowed This value indicate the remaining structure defaults in combination request Example In MODBUS protocol this time upper computer need to delay a few seconds should gt 2s then send data If still reply this code it means the sensor on module is broken need repair 2 2 5 MODBUS exceptional responseframe example 2 2 5 1 Illegal function command Jinan USR IOT Technology Limited Page 13 18 tec usr cn Usr cn Temperature and Humidity data Transmitter http en usr cn Command frame Ox 11 0x01 0x00 0x00 0x00 0x02 0x73 0x5B ID function code begins and ends read number of data CRC check code Respond frame 0x11 0x81 0x01 0x80 0x55 ID respond function code exceptional code CRC check code The command frame instruct module to read the first address O x0000 up the value of the two coil discrete because the module is without discrete quantity so the function code 0 x01 is not supported If the response frame is exceptional respond function code will add 0 x80 on function code received and response function code returned is 0 x81 function code 0x01 is not supported so exceptional code domain is 0x01 and so is check code domain 2 2 5 2 Illegal data address Command frame 11 0x04 0x00 0x01 0x00 0x02 0x73 0x5B ID func
11. n usr cn Appendix A Language C implementation of CRC16 check algorithm const unsigned int ccitt table 256 0x0000 OxCOC1 0xC181 0x0140 0xC301 0x03CO0 0x0280 0xC241 0xC601 0 06 0 0x0780 0xC741 0x0500 OxC5C1 0xC481 0x0440 OxCC01 OxOCCO 0 0080 OxCD41 OxOFO0 OxCFC1 OxCE81 0x0E40 0 00 OxCAC1 OxCB81 0 0 40 0xC901 0 09 0 0x0880 0xC841 OxD801 0 18 0 0x1980 OxD941 0 1 00 OxDBC1 OxDA81 0x1A40 0x1E00 OxDEC1 OxDF81 0x1F40 0 0001 Ox1DCO 0x1C80 0xDC41 0x1400 0xD4C1 0xD581 0x1540 OxD701 0x17CO0 0x1680 0xD641 0 0201 0 12 0 0x1380 OxD341 0x1100 OxD1C1 0 0081 0 1040 0OxF001 0 30 0 0x3180 OxF141 0 3300 OxF3C1 OxF281 0x3240 Ox3600 OxF6C1 OxF 81 0 3740 OxF501 0 35 0 0x3480 0xF441 0x3C00 OxFCC1 OxFD81 Ox3D40 OxFFO1 Ox3FCO Ox3E80 0xFE41 OxFA0O1 0 3 80 41 0x3900 OxF9C1 OxF881 0x3840 0 2800 OxE8C1 OxE981 0x2940 OxEBO1 0 2 0 2 80 0 41 OxEEO1 Ox2ECO Ox2F80 OxEF41 Ox2D00 OxEDC1 OxEC81 0x2C40 OxE401 0 24 0 0 2580 OxE541 0x2700 OxE C1 OxE681 0x2640 0 2200 OxE2C1 OxE381 0 2340 OxE101 0 2100 0 2080 0 041 0 001 0 60 0 0 6180 141 0 6300 OxA3C1 281 0 6240 Ox6600 OxA6C1 0 781 0 6740 OxA501 0 65 0 0x6480 0xA441 0x6C00 OxACC1 OxAD81 Ox6D40 OxAFO1 Ox6FCO Ox6E80 0xAE41 1 Ox6B80 OxAB41 0x6900 9 1 0xA881 0x6840 0 7800
12. ngth one is not available currently Although it may return commands of length more than 8 type it result from that how much data returned the module judge according determines how much data should be output Jinan USR IOT Technology Limited 6 18 tec usr cn 97 5 A U sr cn Temperature and Humidity data Transmitter http en usr cn 2 Working mode 2 1 System Diagram USR SENS WSD Temperature and humidity data acquisition module Module as below is temperature humidity data acquisition terminal in production site It receives and analysis MODBUS protocol frames send by computer then return the data according to commands The module adopts five line interface Data line reserved and need computer supply power System diagram is as below 2 2 Command Format The format of MODBUS protocol frames the module can support is as below ADU Address ME Error check ep PDU 2 2 1 MODBUS command frame The Module performs initialization 2 seconds after power on then receive MODBUS protocol frames and execute according the computer commands Jinan USR IOT Technology Limited Page 7 18 tec Qusr cn Usr cn Temperature and Humidity data Transmitter http en usr cn MODBUS command frameincludes 1 Byte address field to instruct and respond the module address of PC commands 1Byte function code instruct module according to assigned address to respond 4Bytes Data instruct read write
13. of CRC16 check 17 SCONTI 18 Jinan USR IOT Technology Limited Page 2 18 tec Qusr cn 97 BARK U sr cn Temperature and Humidity data Transmitter http en usr cn 1 Introduction 1 1 Overview USR SENS WSD temperature and humidity data acquisition module is of high performance With optional RS485 RS232 TTL different level output and MODBUS industrial control bus protocol it allows multiple modules connected to the bus network and build network with equipment in accordance with the MODBUS protocol to monitor Production site environment changes in time and steadily So that users can accurately grasp the changes of different applied field and act quickly to guarantee the stability of the production site environment 1 2 Characteristics DATA VCC GND RXD RS85 A TXD RS485 B interface simple and reliable easy to expand RS232 RS485 TTL signal transmitted methods Data transmission based on MODBUS Industrial control protocol Reliable 9 performance good compatibility easy to network Support simple character instruction single module easily used in simple applications omall size easily installed Moisture proof handling suitable for damp environment as greenhouse Serial port configuration parameters Baud rate 1200 4800 9600 19200 38400 57600 Data bits 8 Parity No Odd Even otop bit 1 2 Inter
14. r cn
15. rupt the power and restart the configuration takes effect Configuration commands please refer to 2 2 3 7 Serial port parameter setting in Chapter Two Working mode 1 3 Features Measuring Temperature Range 40 C 80 C Resolution 0 1 C Accuracy 40 2 Working temperature range 40 C 80 C Measuring humidity range 0 100 RH Relative Humidity Resolution 0 196 RH Accuracy t29o RH at surrounding temperature below 25 Jinan USR IOT Technology Limited Page 3 18 tec Qusr cn B BARE U sr cn Temperature and Humidity data Transmitter http en usr cn Working humidity range 0 100 RH Relative Humidity Power input 5V DC Support data formats serial MODBUS protocol Simple ASCII character instruction READ AUTO STOP The module ID can be configured Range 1 247 Outline dimension Jinan USR IOT Technology Limited Page 4 18 tec Qusr cn Qr BARK Usr cn Temperature and Humidity data Transmitter http en usr cn 1 4 Interface definition m Interface arrangement CEN a a s E 3 Es ry bk g CIN a V OXM g ax DATA reserved VCC VDD 5V DC GND GND signal ground RXD A T TTL RXD signal line 2 RS232 RXD signal line 4 5485 A signal line B TXD B T TTL RXD signal 2 RS232 RXD signal line 4 RS485 B end signal line 1 5 Default settings
16. s check code 2 2 5 4 Module fault Command frame Ox 11 0x04 0x00 0 00 0 02 0x73 0x5B ID function code begins and ends read number of data CRC check code Respond frame 0x11 0x84 OxOC 0x42 0 0 ID respond function code exceptional code CRC check code The command frame instruct module to return temperature and humidity data If module sensor fault occurs right data cann t be received Then it will return a exceptional response frame Respond function code will add 0 x80 on function code received and response function code returned is 0 x84 The module is at abnormal stage so exceptional code domain is OxOC and so is check code 2 3 ASCII commands ASCII commands include 4 ASCllcharacters Data transmission are ASCII 2 3 1 READ It is to read environment temperature and humidity data once Send instruction format READ Return data format 29 8 56 5 2 3 2 AUTO It is to instruct to return current environment temperature and humidity data every 2 seconds Send instruction format AUTO Return data format 29 8 56 5 Jinan USR IOT Technology Limited Page 15 18 tec usr cn E BABE Usr cn Temperature and Humidity data Transmitter http en usr cn 2 3 3 STOP It is to stop returning environment temperature and humidity data Send instruction format STOP Return data format No Jinan USR IOT Technology Limited Page 16 18 tec usr cn 8 97 5 ARE U sr cn Temperature and Humidity data Transmitter http e
17. tion code begins and ends read number of data CRC check code Respond frame 0x11 0x84 0x02 OxC3 0x04 ID respond function code exceptional code CRC check code The command frame instruct module to read the first address0x0001 value of the two registers Because there s only two registers within the module respectively O x0000 humidity O x0001 temperature data so begins and ends and number of data of the command frame requested is invalid then module will return exceptional response frame as the above Respond function code will add O x80 on function code received and response function code returned is 0 x84 Data requested by command frame is out of range so exceptional code domain is 0x02 and so is check code 2 2 5 3 Illegal data values Command frame Ox 11 0x06 0x00 0x00 0x00 0x00 0x8B 0x5A ID function code address set ID CRC check code Respond frame 11 0 86 0 0 0x03 OxA4 respond function code exceptional code CRC check code Jinan USR IOT Technology Limited Page 14 18 tec usr cn Usr cn Temperature and Humidity data Transmitter http en usr cn The command frame instruct module to set ID to be 0x0 however it is to broadcast in MODBUS so it is illegal then it will return a exceptional response frame Respond function code will add O x80 on function code received and response function code returned is O x86 Data requested by command frame is illegal so exceptional code domain is 0x03 and so i
18. ty amp Temperature data Command frame 11 0x04 0x00 0x00 0x02 0x73 Ox5B ID function code begins and ends read number of data CRC check code Respond frame 0x11 0x04 0x04 0x01 OxC8 0x00 OxED OxAA Ox0A ID respond code returned byte num Humidity data Temperature data CRC check code Humidity data returned is 0x01C8 equal to decimalism 456 It means relativehumidity is 45 6 Temperature data returned is OxOOED equal to decimalism 237 It means current temperature is 23 7 C 2 2 3 5 Set module ID Module ID is register variables with 0x0000 home address It can be set via function code 0x06 Command frame 0x11 0x06 0x00 0x00 0x00 0x02 OxOA Ox9B ID function code address set ID CRC check code Respond frame 0x02 0x06 0 00 0x00 0x00 0x02 0x08 0x38 ID respond function code return address return data CRC check code Jinan USR IOT Technology Limited Page 10 18 tec usr cn 5 Usr cn Temperature and Humidity data Transmitter http en usr cn 2 2 3 6 Reset module ID Command frame 0x00 Ox6E 0x00 0x00 0x00 0x00 OxE9 Ox D2 ID function code address set ID CRC check code It is a pointed command The module ID turns to 0x11 after receiving it is adapted to avoid conflicts with other devices because it is of broadcast mode And the module reset ID as the four bytes behind function code are O 2 2 3 Sett serial parameters Use function code 0x06 to set when the module internal address is 0x0001

Download Pdf Manuals

image

Related Search

Related Contents

  Manual PCU-10 - TetraTec Instruments  Rockford Fosgate 550X User's Manual  Size: 125 kB 7th Jul 2014 EEP  Manual - PDF - Grizzly Industrial Inc.  Samsung SNP-3120P surveillance camera  Horizon Fitness R3 Exercise Bike User Manual  (11 lingue) - Complete instruction manual  Voice Module AF-MUL User Manual - Woertz-USA  StorageWatch User`s Manual  

Copyright © All rights reserved.
Failed to retrieve file