You are on page 1of 17
a Contents 1 - Introduction sen : soe 2+ Remind on $0M@ UNIS non 3-RS485 ink and Modbus protocol so 3.1 -RSABS link 3.2 Connecting a computer the RSAS never “nnn ‘32.1 - Computer equipped wth a seta por aan * 322 Compr euged wth estaloot oe oo 3.3 - Modbus pro}oO sain aoa sonia 33.1 General presentation . 333.2 -Otherprotoclcharacoiscs si = 33.3 Nobus exchanges. - - $33.4 Nobus incons and ames, an aeeaaea coer 334.1 Function Of (0x01: Read Cais a 3.3442: Function 02 (0x2 ead bar inputs (Read Discrete np). = 33.43- FunctionO4 (0x04) read util eitrs (Read nput Registers) : $344. Fncon 9 "cortege Co) i : 3:345- or codes and exceplon C08..nnnnennnnnnannnnnenn - 33.46-Lengt oftames 4-Infomaton avaiable onthe APM3D3 va the RS485 ink scarica csi 41- Binary input and oats (hardware... i scam 44.4 -Binary inputs rare. a : 412 Binary outputs hrtvare), es Si san = 442. Binary inp ad outputs (age) 7 - 442. Binary inputs (ogi) : 422. Binary outputs (eg) 43- Remote conta 44 Blectical and mechanical measurement. on..onn ee 5- Example applications of RS485. ssn 5.1 - Information reading...... sent nei sma “ $5 aan 5.1.1 - Battery voltage reading, “ ” ‘ vol 5:12-Readng’Reed To Load ds ae - 2 “4 5:13 Reading te Conmon Shuto... _ 16 5.4 Reading he stats efx contiguous inputs. : : 15 82: inlomaton rg... oe : oS ‘8 52.1. Sendnga comand he generang sl : ° 16 5.3. Fame cal ith NodBut Dots. oo : 7 List of figures figwe 1 -RSUES ink acter . . 2 figure 2-PC oonnecton ih serio. 3 figure 3-PCcomecton witha seal port —— 3 figure 4-master/slave organisation... - - 4 figure 5 - querylresponse on battery voltage. AT figure 6-querylesponse on "Common Shutdown’ status. - conned figure -querylesponse on the status of09 configured at O18. sc nonn nnn maaan 4 - Introduction This document describes how fo use the RS485 link avaiable on the APM303 module. I comprises 3 pats: = RS485 link and Modbus protoco, “List information avaiable on the APM30S, = Example appicatons ofthe RS485 ink with the APM303. [Note: this documents apolicabe to version 1.1.0.1 ofthe fimware, 2- Reminder on some units ‘This paragraph recaps some cancepis in infarmation encoding bit: the smallest elementary unit of information representation, the bit adopts @ value of 0 oF 1 byte: isequal to bits Word : is equal to Zbytes or 16 bits ong : is equal to 2 words or 4 byles or 32 bits baud: unitof measurement f information transmission speed, also exprassedin bitslsecond (+) ((#) In our case, measurements in bauds or in bits (bps) are equal, since the signal is bivalent (2 values; 0 or 1), ‘bytes a setof 8 bits, writen in the form: 1001 000 (where each bit adopts the value 0 or 1). For each byte, that makes 256 diferent combinations. A word isa set of 16 bits, ie. 65636 possibie values. In this document, when values of addresses are expressed in hexadecimal, they are ahways preceded by the symbol Values not preceded by any symbol are expressed in decimal 3 - RS485 link and Modbus protocol ‘This means of communication available onthe APM303 comprises 2 essential parts: Hardware THe information is exchanged inthe form of Os and ts, This hardware part defines how @ 0 and a 1 are represented, I's the RS485 lnk which caries out this operation, Software The organisation of the 0s and 1 received indicates what message a machine wants to convey to another machine. This “organisation” is known as the protocol, In our ease, the Macbus protocal is used 3.1 - S486 link ‘The RS485 lnk is the physical medium for communication tis a differential (or symmetric) link. It comprises 2 active wires (+ and B-) and shielding, This is 2 multipoint serial link. it interconnects several pieces of equipment. The maximum bus length is £200 metres, ‘The RS4B5 bus requires a line impedance of 120 Ohms. The cable must be an STP (Shielded Twisted Patt). A 120 Ohm - ‘1/2 Wat resistor must be installed at each end, These resistors are commonly known es "end o tine resistors” ‘The diagram below shows the architecture of an RS485 ink a = => ‘spent spent amber’ ‘ember figure + RS#8S Tink architecture “The common software parameters for an RSAB5 link are as folous: description etal setng onthe APUBOS ‘communication speed expressed in bauds 600 [number of ala bis: 7 oF 8 bi Tinor-mosiiadh numberof stop bits: Tor2 i type of party check: none, even, od Tone ‘equipment address: trom 110 255 3 2 ‘Asm, pati nb a 3.2- Connecting a computer to the RS485 network ‘This part explains how to connact a PC to the RS4AS network. Ta do so, you need to know whether the computer tobe used for the connection is quipped witha serial port. 32. - Computer equipped with a serial port “The computer serial port has a builtin S232 serial fink. This link i incompatible with the RS4B5 link, To communicate with the APNIGO3, it Is necessary to use an RS2S2IRS4B5 converter SOMO offers the ADAOOE converter to perform tis function, The connection diagrams a follows: 15752/485 {igure 2- PC connection with seral port 2.2.2. Computer not equipped with a serial port This isthe most cannon sconare nowadays. Todays compuiers practical no longer come with serial ports, The solution ‘tomiordad by SOMO for connacing a confer sot equpped wih a seal pot the RGABe nobwrk to ust USBIRS252 converter coupled tne ADSODE RS2S2RS4B5 converter ‘The connecton diagram e198 flows: 3.3 - Modbus protocol 2.3.4 - General presentation A protocol isa way of organising the data exchanged on a physical medium (eg.: RS489, R232, et.) For example: the ‘adress atthe beginning, then the information, and a the end an information wansmission check, ‘The Modbus protocol is at present very widespread in the fd af industial communication, paticularly on PLCs. Below are the essental characteristics ofthe proto! Tina network. there's a master and “ach slave has a distinct address, “the master aay takes the infaive in communicating, “the reacing and wring operations between equipment are known as “Yunctions" slaves, he nc renin et 3 ‘The schematic representation of ‘masterislave" organisation is as follows: figure 4 master/slave organisation 3.32 - Other protocol characteristics * Slave addressing slave decimal The Modbus protocol starts counting at 1 (table Tist slave 4 ‘opposite. second siave 2 third slave 3 waver * Processing capacity slave. decimal_[ hexadecimal The actual processing capacity depends on the umber of slaves to 255 | Ox001 to OxOFF master and siaves on the bus. readin bit function 7 T10 2000_|“Ox00+ to 0x70 ‘Opposite are some figures for the diferent functions [read n words (funcion 3) | 1 to 125 | 0x007 to-0x07D. Used (see also paragraph 3.3.4), ‘wite n Bits function 15) | “T to 1968 [0x07 to Ox?B0| ‘wtte n words (function 16] | 110 123 | Ox001 to 0x07B 3.8.3 -Modbus exchanges ‘The exchanges are "half-duplex’ (frst transmiting and then receiving). No slave can send a message without a prior request ‘rom the master. Dialogue between slaves is impossible. ‘The sequence of a dialogue is as follows 4. The master queries a slave and then waits forts response, both in reading and write mode, 2 The slave responds to the master. ‘The APM303 behaves as a slave only [It transmils data over the bus only if requested by the master todo so. ‘The chosen communication mode is RTU (Remote Terminal Unit) mode: «> the data are in & bit. 3.3.4 - Modbus functions and frames ‘There are 21 Modbus functions. The following functions are implemented in APM303: we, escripTion ‘applicable calculation. Of] 0x04 read binaty outputs (Read Coils) Internal Bits Or Physical Cois| Bit access ‘02[0x02] ead binary inputs [Read Discrete Inputs) Physical Discrete Inputs | Bit aocess ‘oa x04 Tead analogue inputs (Read input Registers) Physical Inputs Registers 1 Bits access .05[ 0x05] “wile binary output (Write Single Col) Tntemal Bis Or Physical Coils| Bit access ((&) The terms in brackets are the terms used in the document "Modus application protocol specification”, version V1.1b3, available on www.modbus.org {All the frames end in a CRC (Cyciie Redundancy Check). The CRC is a mathematical calculation for checking that the frame received is complete. This calculation Is generally included in programs using the Modbus protocol. All the frames and data ‘contained are expressed in hexadecimal 4 cent mrt pin po a itn mars APMED 3.3.4. - Function 01 (0x01): Read Cols 2 The frame sont bythe master to requost he vale of one or more “ols flows: read request | information | 52. | function | collstar address [ MMBC ole | crc same __[enesdeaia_—[ —tbyte | — Toy Ze Zbyies Zoves] TI] The max. number of coils that can be read is 2000 (0x70). 1 The response sent by the slave is as follows; slave rhumber Nofbytes | values of N Byles reaponse rane | emeton | tte function cna stn RC | tte 1 byte ‘byte Nxt byte bytes The lengih of his Frame depends on the number N of Byles read: N= whole pat of the quotient ofthe civision [number of inputs/8} if the remainder is zero N= whole pat of the quotient of the division [number of Inputs/8), ifthe remainder isnot 0, then N'= Net ‘The maximum numer N willbe: 200078=250 2xample read the status of 10 coils, whole part of [10/8] iving a non-zero remainder, = N = N+1 = 2 bytes ead the status of $2 coils, whole part of [32/8] 4 giving a remainder of zero, > N= 4 bytes * In case ofan error inthe frame, see paragraph 3.3.4.5 3.3.42- Function 02 (0x02) read binary inputs (Read Discrete Inputs) = The frame sent by the master to request the value of one or more binary inputs is as follows: read request | infomation | S82, | tuncion | inputstar adcross | “MBRSTAP™ | ore frame Ti The max_ numberof inputs that can be read is 2000 (0x70). 1 The response sent by the slave is as follows: slave Tumber Nafbyles | values of N bytes response trame | ‘nfrmation | aadroce | function sent back ead cRe encoded in tbyie Tae “Lovie Nxt byes | byes The length ofthis frame depends on the rumber Nof Bytes sent back N= whole part of the quotient ofthe division [number of inputs/6}.f the remainder is zero N= Whole pat of the quotient of the dlvision [number of inputs/B) the remalnder isnot O, then N= N#1 “The maximum number N will be: 2000/8=250 “example: read the status of 10 inputs, whole part of [1018 giving @ non-zero remainder, N= Net =2 bytes read the status of 32 inputs, whole part of {32/8} Siving @ remainder of zero, <> N= 4 bytes: In case of an orror inthe frame, see paragraph 3.3.4.5 '= For more information on function 02, refer tothe specific examples in paragraphs 5.1.2, 6.1.9 and 5.14 3.2.43 - Function 04 (0x04) read multiple registers (Read Input Registers) 1 The frame sent by the master to request the value of one or more reqsiers is as follo slave register start | umber of rogiaTers teadrequest | information [S25 [| tuncion peest be oma RG encoded in ‘byte Tae ‘2bvies bytes Doves TH The max numberof registers that Gan be read: 125 0x007D) 1 The response sent by the slave is as follows: slave number N of values FN) information | adres function _| registers sentback| registers cead | ORC encoded in ‘byte Taye ‘byte Nx2 byes | bytes response frame The lengih ofthe response frame depends on the number N of byles read Incase of an error inthe frame, see paragraph 3.3.45. ' For more information on function 04, refer tothe specific example in paragraph 5.1.1 are pt te weenie the mer [=] APMED 3.3.44 - Function 05 (0105): wite“a.coit (Wie Single Coll) the master to change the value of cols as writerequest | information | 325 | functon aie vaveiowitgin | crc frame [oneodedin | — tbe | Tove 2oytes 2 byes | 2bves The sponge ser by the slave asf: slave a vaueof response tame | ‘fomation | sacress | fwcton | adress Wise oe encoded in...[ “tye | tixie Zbyes Zines [Zee TTeverthing score, the 2 values afe the same, Ihe eeponse ean "echo" of the wile reqUE. ‘Incase of an ero inthe fame, see paragraph 2.3.45. '* For more information on function 05, refer fo the spectic example in paragraph 5.2.1, 9.345 - Error codes ane exception codes in case of or inthe rame, the slave Sends back an enor code and an exception code. slave fron] excaptan fro |_infemation | adits | cove ‘cote ERC eneodedinc | thyte | —tbyle [tyler yes ‘The error codes ar calculated as follows: Tneton ‘rior cade ‘x01 (Ot 1 ‘02 (02, Bz ‘04 (04 Ba (0305 (051 85 ‘The table below describes the meaning ofthe exception code: eiceplion cade moaning OF Tunaion cove noorect 02 adress neorect mm ala invalid Tas oc8 plocessing erat 3.34.6-Lengin of rames For fnctions 01,02, 8 and 05, implemented inthe APM903 module, the length ofthe frames is as follows: Ta aa Faia ar < reas roquet "A $ ft ae a 5 at arable [Japondna ox nual Bs san ba). sesponse vanab " 4 ‘variable (depending on number of bytes sent back) 5 a 6 Seber Baraca 4- Information available on the APM303 via the RS485 link ‘This par presents all the information avalable on the RS4B5 Ink. These data are classified according o thelr ype: Binary inputs and output (hardware), = Binary nt and opts og). [Measurements (electcal, mechanical, miscellaneous). 4.4 - Binary inputs and outputs (hardware) 4.1 -Binary inputs (hardware) inary hardware pws Trformation onthe ame ‘nals is necessary to Know the allocation ofthe APNIGOS inpuls “MadbusTunciog: Modbus acthess Tanai of dala Ot be ndicatad below Sendicated Balow Tength ‘orresponding terminal value ie) ‘and alocation Tavauare brary neuro. 1 [Tos emergeney stop hardware binary Input ho.2 | 710= see ist of input cade hardware bina'y Input no. [Fi see ist of input codes hardware binaey Input no. [ie ese list of rout codes") hardware bina inpul no. 4 —[7i5= Gee list of rout codes") hardware binary input 0.6 [91s G0 list of input codes hardware binay Input no. HS = fees list of not codes" “The st ofnput codes” (or functions) is available in paragraph 4.2.1 4.1.2-Binary outputs (haraware) Tray herds Tnfarmaton on the Fam ae a pin. vine: bits) and allocation a aes! = eet He eeeemees (GH) Note that function ‘ak-oreheating control Teady to toad report ‘ormon shutdown report list of Guipul codes” [or functions) available in paragranh 422 ‘The complet APMED 4.2: Binary inputs and outputs (logic) 43a Binary inputs (logic) ‘its tae ange togetne a tnctons avetale forthe module APIA203 input Teas Banya con “Heda tuncion’ | Bodine adivess edarees vale Tena | nuneton cove ‘a Enaaanee Sa I ‘O:0081 | Remote Star Stop. 4 Tez Sxeage tee bir t ra {BCR = Generator Croult Breer 422 Binary outputs (logic) ‘Thistle brings together the satuses, warnings, shutdowns and functions availabe forthe module APMSOS outputs. Tian ouput Tage) uneons, Sauses, ware and atoms ‘rfomaton onthe ame ead nt anda ‘APMAMadess: | Modbus funcion: ] Modus aditess Tenghaalala 5 iby delay 0402 (8) as cated below as ndieated below Thdestons avaiable Tengih | — code function. satus, sstoes voi bis) | “warning shutioun wo0e0_| Saran i : ‘30021 | Fuel Solna = ‘30022 | Stop Solenoid i 05 y0025—| General Alarm ‘O04 oyo0et | GOB ClosetOpen + O05 ‘y0025_| Ready To Load i ‘O07 9,006 Preheat i ‘O06 oxo027_| Runing [generating sal sae r iat ‘0028 | Automat mode (Auto On 1 sits 10,0028 | Islane Operation (ready to oad, cca brea sed] f Salus 30024 Common Warning 1 in 140028 Wasntenance Required r ering 13002C_[ Low Batery t waning 1010020 | Low Fuel Level | warring oc shutdon ox002E | External Waring 1 n ming ‘oar ExternalWaming 2 +t warning 00030 External Warning 3 i ‘sing ‘0y0031_| Generator CCW Rotator 1 warning 0.0082 Batley Fiat + ning 10,0035 Common Shuidoan + O15 ox003t_| Emergency St Acne Shutdow 010035_| Overspeed t ‘Shutdown, ‘30035 | Undersoeed 1 shutdown, ‘30037 | Low On Pressure i shutdown ‘30038 High Coolant Temperate t utoun, 10,0039 External Shown 1 + shutdown ‘003A External Shutdown 2 shutdown 140038 [ External Shutdown 3 shutdown THOS GOB Fal (cul bear poaTion noone if shutdown, 1030030 | GeneraterV> max. ganeator vols) + shutdown, 0x003E | Generator V< min. generator votagel 1 shutdown 003F | Generator He> (ma, generator query) 1 ‘Shutdown oy0040_[ Generator Hz< (min. generator frequency) 1 shutdown, 0.0041 Stat Fal 1 shutdow 0,0047_[ Sip al i shutdou y0043_| Genealoe A>> [aeneraor sha- crea) 1 shutdown ‘x04 | Generator > (generating set overoad) 1 warning. ‘y0045_[ Choke. i ‘O10 oy0046 | Giow Page + ‘On ‘Oy0047_[ Vaio Extinguisher r O18 (2) Net hat fn fame a urcion or 02 was chosen for 03). GCB = Generator Cruit Breaker (96) depending jon confguration ing the functions, statuses, wamings and shutdowns (he frame structure isthe ap 4.3- Remote control Tesi fhe uncoating opeingmate otb APSE mr Se operaing modou ae alo owich a dak writen at 7a oan Styasant | ae Sena eee sien ade val ea [Ramat an STOP $ = ene Rane RUS DE i are 4.4- Electrical and mechanical measurements ‘Tie ole bos gehen athe aralegie messuements avaiable on the APMED medul, and soma miscallanecus “Seal ad mesa nese at a ae Peg dts ab ean alot =, eisai setae wae ae Tapa | Na Ea ae [a Se aa ten a ve | fast [ vn | nt a a isl et a or Se feevEeane aaa eerste ty oon fee viea ieee cet eet ee ee eee ete wane ee oe ee veeta ine tes aa were et eesti tar eee —4—teaat x rr fenateiszacea a Sika at et ate Sa ca tr fee {en a ee ree oe we ne af eee tiete Tesniaie achen oT Ese fee ta Sear econ seseeeet TE eee eee Sead on feertaget sen ae ed teeta i oer fd oo fester ite gave er iy Tes er jee ‘iol |e sa a “00015 [Load character funsigned| | RUC = tinted ir eo aes pease i Ser ere or Sora a ere eet ects eat ieee te eet ea Ton a Sty eae eeaa oe fata ete tt a ae, tat tear Bak re a isa] rf [Seen sre on — a Fa i cr wa oe | 2 $80 armanestne ret et ce ate Eerste reed] v2 S80 irene ist eS net ett (#)9= matic system, 12US sytem rc 2) 0) 4} 8)() (7) (BS see explanation ret page poe ac aca («| apie TH] FAPIIROS fs “decimal” configured va the parameter ‘Power reading precision, then some values wil be cdsplayed with a decal pont (example: Gan AL‘ 10.7) <> equivalent ofa muller on cetan analogue values: 1 or 0.1 @ | The characters F.L, Care sent n Asci (xx): MSE->0, LSB-CHAR, emply character. space, Ox20: io power measured, TBy_[ value 0 an ne desma value 1 When TST ‘4 Physical status of inary inpat (5)_| Physical siatus ofa binary output (6) [Depending on configuration (bar orp] ‘| Depending on configuration -C oF) (8) (major version x 100 = N (minor version (example 101 represents version 1.) (9) (patch) x 1000 8 (bul) (example: 2005 represents patch 2 5)(#] (4) With the 2 examples above, a complete software version would be: 1.1.2.5 (Ge) Asci = American standard code for information inerchange 5 - Example applications of RS485 ‘his paragraph sol out specfc examples of apalicalions of Modbus communication withthe APMGO3. Forallthese examples, te AMP309 address should be checked onthe “Base setings”scren, on he *Setpons* menu, Modbus parameters" ab Lets assume an APMS03 at acess 05 (standard sting). 5.1 - Information reading 5.1.1 - Battery voltage reading ‘The battery voltage informatio canbe found in paragraph 4.4. The characteris to remember areas follows: ~Moabus function x08 (Rea Input Registers), “aadeross to query: 0019 (25 in docima), length of datum to query. 16 bits or 2 bye “the battery vallage unt of measurement is tenths of Volt ‘Those charactorisis are used to put together the roques fame: anne aigossol | — naar reas |_lomaten [Sime, | tuston | otiertica’ | cogtnwinaend | ORC (#) request [ended] — tbye—| tye | zyes oes | 2byes i a o's wore) Psa mntent os a (NSB LSB), (WSB LSB) (LSB MSE) (#3) el, are ony one PRT ad Te OT ROTC Te AP09 sends bake epensefarebow xampe ane Tana NATH | — vas ow response | wmaten | address | Melon | bytes sentback | cegters read | ORCC) szons® encodedin | —tbye —| tye [Toe Weber [2s coer ae vale 0 oo | czcewey | QO, | eis (4) The vale of CRC needs Tobe calculated (noe. mosteystems Tis value relumed automata) Gee) Nt registerto be read x2= 2,1. value 02 Inhexadacal The pu regsters are sen back n 2 bys, sce the Sze of he reir is east 1 word (2 words for many analogue data) (Gee table n paragraph 44), ‘example a adress Ox0003: Gen VL1.L2 (woltage belweun lve 4 and 2) is encoded in 1 word or 2bytes, since wiht byte, itis impossible to count abavs 256 (FF). Wh 2 bytes, fis possible to count from 0 to 65595 (FF FF) (example: 410 Vots between ive 1 and ive Zl be denoted 01 83) NSB Most Sinifcant yo AN 582s Scan ete “The infomation to checkie a fobows: ~ Sam slave adress as the request ame “Same functon asthe request Paro. umber of bys sent bck = number NX Aer these checks, the battery volage is —Femaenal | — Seana i a reer imal —]_Taiper Tater food by convring the heradecinal vate value vals —_|(seesectoné| vane oa doce vat wer 230 0 Za vali Allthe other infomation ram paragraph 4.4 must be readin the same way. Make sure 1o respect the length ofeach datum, 5.12- Reading * Ready To Load!” status ‘The "Ready To Load" infomation canbe found in paragraph 4.22. The characteristics to seect are as folows: ~ Meds functon: 0x02 (Read Dicer ete Input), fares to ausry. 030025 (7 in decimal). ang of datum fo quen 1 Bt hese characteristics are used io ut together the request ams ave Ta TSTS Rano S ross [information | tees | neon tsa ‘crea | eRce roquest | eneodedin..| —“tbve—| tore 2oves Pines Zoe ‘tame ee a o cos waren | xm auspice, | wsp is seis (FRY In The ea, re ony ove pT {pt303 sends back th response fans boom (exam) Slave suBar Nof ys | vaios opis infomation | 32, | fincton | ESrNSTDA NHS | one c=) response srcodedin_c| — toys —| Toye “tyte Nxt oe | —Poytes valve 35 cs aioe | een | geile) (Go The ale of CRC needs toe calcite, moa ayeama tiavalue returned alonatealy (eas WEPigpalieaemaindernco S20 eT yas bac {Gore ine example, there only one np The ext ndnay of (valve exadecimax 0000 0001 5 fezitanows tthe quarednpte a stat? (Roady Po Lon aves), The Snr Bein Be bye Sontag the inp sit re TSB Most Sloiant te USolesst Sgmtean ye ‘The information to check i a follows ‘ome slave adsress aa the equest frame, "Same funstion asthe request frame, umber of bytes ent back = see calculation for N (#8), 5.1.8 -Reading the “Common Shutdown" status “The “Common Shutdown information can be found in paragraph 4.2.2, The characteristics to remember are as follows * Modbus function: 0102 (Reas Diserete Inputs), adress to query: 0x0035 (51 in decimal), “length of datum fo query. bit. “These characteristics are used to ut togother he request rae: Tart adcrews to] numberotinpats is aa BAERS | ono vaguost Caneodedin | Toe —[— Tvs Ties 2bes Tes a ra worces) | an content 08 oe nseify | qsoisn” | Bie Tar nail Here en re ap rea 25103 son back ho response rams bl exam Taner Notes | vals Tiras ‘eam [tortor [ siveactios | wneion [MEE NEP oy orem) neces tne Tots ois whe [aes =D ‘5 2 ces | orceeny | BBS Tee) Te value TORC needs to be calculated. Most systems, Tis value fs Yelumed auloratcaly (Gees) {byte sent ace, sinc 1/850 and remainder net zero, s0 N=Ne=1 (Gea0¢4) nthe example, tere ionly one input The rsul ih binary of 01 (valu in hexadecimal) is: 0000 0001 “Thisresul shows tha the queried input at status 1 ("Common Shutdown is activated), The other bis inthe byte are at 0. 1MsB = ost Significant By AX USB Lest Sipitean Be “The information to check sas flows: "same slave acess as the request frame, “game lunelion athe request ame, “umber of bytes sont back = see calculation for N (#3) 5.1.4 - Reading the status of x contiguous inputs Its also posse to read the status of “Common Shutdown’ by querying x contiguous inputs. Lets assume thatthe generating set has been shut down for anol pressure problem and thatthe APM303 was set fo AUTO mode before the faut Shutdown. The" Common Shutdown information ean be fund in paragraph 4.2.2 “The characterises to remember areas follows: ‘Modbus function: 0x02 (Read Discrete Inputs), “addresses to query 0x0020 (32 n decimal to 030037 (SSin decimal, Fength of datum to query: 1 bi. “These characteristics are used o put together the request rams: Tar adress te | Nonbor opus 1a | information | slave adsiess | fncion wa ei cre request Teodetm | Toe Te Ziytes bytes Ze cient as a2 0020, 3098 rr (FF) 2 inputs fo ead, is, 00 18h exadscimal (ominder. is possible to road up To 2000 pus, 8. 07 OO). APM909 sends back the response frame below (example) Tesponse slave umber Not vauesoTN tame | _fromaton | asieee | fncton | iter ent back Input ead ore ‘encodedin | — 1 byte | Thate bye Nx toy Dbyies vals 05, @ Ose) oe] ai [#8 | xx bye t | yiea | bye ee) (66) Inthe example, there ate 24 inputs ta query: 24 smainder i ero) ie. bytes sent back 5 api (44 Each byte contains the status of 8 "Discrete Inputs “bye | contains the values at the adresses Ox0420 to 0x0027, “bye 2 contains the values atthe addresses Ox0428 to Ox002F, “bye Scontain the values at the addresses Ox0030 to 0x0087. The detals ofeach bye are as follows byte 4 =the bit at address 0x0020 is onthe right, “ne Bit at adress 030027 son the let. Since "Common Shutdown’ is activated, “General Alam*is iso == COTO TOTeT+ terete) activated, the other bits are 0, which in hexadecimal ives: 08 ee Ra (00001000 in binary) byte 2 =the it at adress 0x0028 is on the ight, ‘he bat adress OxO02F son te let “Automatic Mode" is actvated and we assume that “Low Fuel Ga) Level" and "Exteral Warning 2" could be activated. which gives inhexadecimal:A1 (10100001 in binary) 30600) Lon Foe Le GeO Aor od] byte 3 Ihe bit at addose 00030 is gies in hexadecimal: 68 (0001000 in binary) THOT LowOT Asus] [Toxo Eonal Weng 2- Information writing 5.2.1 - Sending a command to the generating set Let us assume that the AUTO bution has been pressed remotely, The AUTO button information can be found in paragraph 43, The characterises to remember are as flows: Modbus function: 0x0$ (Write Single Col), * auldress to query: 0x0002 (2in decimal), “length of data to query: 1 bit These characteristics are used to put together the request fame: slave a Tlie ewe write pees address Jain address inthis coil CRC (+) request | encoded in_ 1 byte A bye 2 bytes 2 bytes 2 bytes fame 0002 Foor) | re ere a = (SB LSB) (SB LSB) (LSB MSB) ABMGDS sends back he folowing response fame slave a ‘information address function address value of this coil | CRC () response | srcodedin. | — the | bv bites Toes | 7s aocz Fab e) | oe et a « (SB LSB) (MSB LSB) {LSB MSB) (24) The value of GRC needs tobe calculated. in most sya, is value is returned automatically () 0000: AUTO bution= OFF ___ FF 00: AUTO buttor Any other value does notaffect the col statis, N Ay MSB= Most Qantean aye LSB =Least Sigifcant Byte “The information to check isa follows: ~ same slave address as the wie request fame, * same function as the wre request fame, + same resull forthe coll "adress" and “value” boxes, 16 inti acts le Pee a ert APMi> 5.3- Frame capture with ModBus Doctor ‘Modbus Doctor is a freeware available onthe Inlerne, It is used for monitoring frames sent and received after entering & query. ‘Mer configuring the parameters require for connection the folowing results are obtained * Capture of two frames with runetion 04 Battery voltage value tangas — asa z Saal eestin ones Be Hag on ems ened arose B19 es 289) = (ay wis ee ect 7 ITE a | ‘eoporse 7 bee a “ele ser hae COEF (ys 3 & 4) = ERC TE tee 588 =a Tigure 5 queryiresponse on battery volage * Capture of tw frames with funtion 02 “Common Shutdown satus ‘tame one: ja [wis > “ead requestinB bytes ueied addres: 0035 (bytes 28 3) C= 48.44 byes 687) ee “ale sot back Of (yl 3) GREET Taboos) * Capture of two frames with function 02 Status of output T08 configured at O15, tame.ons: ~tead requestin 8 bytes “queried addroes: 00 14 (bytes 2& 3) CCRC = FBAA (bytes 6&7) apo n ye “atte sent back Of te 3) GROSS ies Tigure 7 -queryitesponse on the Salus of TOS configured al O18 A rch A es oT ee amr 7

You might also like