background image

Display

F1X5_RS

Data: 13/01/16

file: F1X5_RS_ing.doc

Pag 10/12

MODBUS PROTOCOL OF SERIAL PORT CONNECTION

The device has a serial output connection RS485 (or RS232) with MODBUS RTU protocol to dialogue with

remote units, 8bit data; 1 bit di stop; no parity. The Protocol is based on a QUERY/RESPONSE structure: the

slave devices reply to the queries with a message that contains the identifying address and the requested

data. It is possible to read and write the parameters of the F1X5_RS, called configuration registers.

The MODBUS protocol ensures the validity of the exchanged data through the line by a “Cyclic Redundance

Check” error check; two CRC bytes of are added to the messages. The algorithm to make two bytes of CRC

in Pascal language and  C is provided.

Routine CRC in linguaggio PASCAL

Routine CRC in linguaggio C

Function CRC16(messaggio:string; var Hi: byte; var Lo: byte):Word;
const auchCRCHi: array[0..255] of byte = (
        $00, $C1, $81, $40, $01, $C0, $80, $41, $01, $C0,
        $80, $41, $00, $C1, $81, $40, $01, $C0, $80, $41,
        $00, $C1, $81, $40, $00, $C1, $81, $40, $01, $C0,
        $80, $41, $01, $C0, $80, $41, $00, $C1, $81, $40,
        $00, $C1, $81, $40, $01, $C0, $80, $41, $00, $C1,
        $81, $40, $01, $C0, $80, $41, $01, $C0, $80, $41,
        $00, $C1, $81, $40, $01, $C0, $80, $41, $00, $C1,
        $81, $40, $00, $C1, $81, $40, $01, $C0, $80, $41,
        $00, $C1, $81, $40, $01, $C0, $80, $41, $01, $C0,
        $80, $41, $00, $C1, $81, $40, $00, $C1, $81, $40,
        $01, $C0, $80, $41, $01, $C0, $80, $41, $00, $C1,
        $81, $40, $01, $C0, $80, $41, $00, $C1, $81, $40,
        $00, $C1, $81, $40, $01, $C0, $80, $41, $01, $C0,
        $80, $41, $00, $C1, $81, $40, $00, $C1, $81, $40,
        $01, $C0, $80, $41, $00, $C1, $81, $40, $01, $C0,
        $80, $41, $01, $C0, $80, $41, $00, $C1, $81, $40,
        $00, $C1, $81, $40, $01, $C0, $80, $41, $01, $C0,
        $80, $41, $00, $C1, $81, $40, $01, $C0, $80, $41,
        $00, $C1, $81, $40, $00, $C1, $81, $40, $01, $C0,
        $80, $41, $00, $C1, $81, $40, $01, $C0, $80, $41,
        $01, $C0, $80, $41, $00, $C1, $81, $40, $01, $C0,
        $80, $41, $00, $C1, $81, $40, $00, $C1, $81, $40,
        $01, $C0, $80, $41, $01, $C0, $80, $41, $00, $C1,
        $81, $40, $00, $C1, $81, $40, $01, $C0, $80, $41,
        $00, $C1, $81, $40, $01, $C0, $80, $41, $01, $C0,
        $80, $41, $00, $C1, $81, $40) ;

const auchCRCLo: array [0..255] of byte = (
        $00, $C0, $C1, $01, $C3, $03, $02, $C2, $C6, $06,
        $07, $C7, $05, $C5, $C4, $04, $CC, $0C, $0D, $CD,
        $0F, $CF, $CE, $0E, $0A, $CA, $CB, $0B, $C9, $09,
        $08, $C8, $D8, $18, $19, $D9, $1B, $DB, $DA, $1A,
        $1E, $DE, $DF, $1F, $DD, $1D, $1C, $DC, $14, $D4,
        $D5, $15, $D7, $17, $16, $D6, $D2, $12, $13, $D3,
        $11, $D1, $D0, $10, $F0, $30, $31, $F1, $33, $F3,
        $F2, $32, $36, $F6, $F7, $37, $F5, $35, $34, $F4,
        $3C, $FC, $FD, $3D, $FF, $3F, $3E, $FE, $FA, $3A,
        $3B, $FB, $39, $F9, $F8, $38, $28, $E8, $E9, $29,
        $EB, $2B, $2A, $EA, $EE, $2E, $2F, $EF, $2D, $ED,
        $EC, $2C, $E4, $24, $25, $E5, $27, $E7, $E6, $26,
        $22, $E2, $E3, $23, $E1, $21, $20, $E0, $A0, $60,
        $61, $A1, $63, $A3, $A2, $62, $66, $A6, $A7, $67,
        $A5, $65, $64, $A4, $6C, $AC, $AD, $6D, $AF, $6F,
        $6E, $AE, $AA, $6A, $6B, $AB, $69, $A9, $A8, $68,
        $78, $B8, $B9, $79, $BB, $7B, $7A, $BA, $BE, $7E,
        $7F, $BF, $7D, $BD, $BC, $7C, $B4, $74, $75, $B5,
        $77, $B7, $B6, $76, $72, $B2, $B3, $73, $B1, $71,
        $70, $B0, $50, $90, $91, $51, $93, $53, $52, $92,
        $96, $56, $57, $97, $55, $95, $94, $54, $9C, $5C,
        $5D, $9D, $5F, $9F, $9E, $5E, $5A, $9A, $9B, $5B,
        $99, $59, $58, $98, $88, $48, $49, $89, $4B, $8B,
        $8A, $4A, $4E, $8E, $8F, $4F, $8D, $4D, $4C, $8C,
        $44, $84, $85, $45, $87, $47, $46, $86, $82, $42,
        $43, $83, $41, $81, $80, $40) ;

var i, index: integer;
begin
    Hi := $FF ;
    Lo := $FF ;

    for i:=1 to length(messaggio) do
    begin
       index := Hi xor ORD(messaggio[i]);
       Hi := Lo xor auchCRCHi[index];
       Lo := auchCRCLo[index];
    end;

static unsigned char auchCRCHi[] = {
0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0,
0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41,
0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0,
0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40,
0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1,
0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41,
0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1,
0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41,
0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0,
0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40,
0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1,
0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40,
0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0,
0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40,
0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0,
0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40,
0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0,
0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41,
0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0,
0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41,
0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0,
0x80, 0x41, 0x00, 0xC1, 0x81, 0x40, 0x00, 0xC1, 0x81, 0x40,
0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1,
0x81, 0x40, 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41,
0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41, 0x01, 0xC0,
0x80, 0x41, 0x00, 0xC1, 0x81, 0x40
} ;

static char auchCRCLo[] = {
0x00, 0xC0, 0xC1, 0x01, 0xC3, 0x03, 0x02, 0xC2, 0xC6, 0x06,
0x07, 0xC7, 0x05, 0xC5, 0xC4, 0x04, 0xCC, 0x0C, 0x0D, 0xCD,
0x0F, 0xCF, 0xCE, 0x0E, 0x0A, 0xCA, 0xCB, 0x0B, 0xC9, 0x09,
0x08, 0xC8, 0xD8, 0x18, 0x19, 0xD9, 0x1B, 0xDB, 0xDA, 0x1A,
0x1E, 0xDE, 0xDF, 0x1F, 0xDD, 0x1D, 0x1C, 0xDC, 0x14, 0xD4,
0xD5, 0x15, 0xD7, 0x17, 0x16, 0xD6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 0x4C, 0x8C,
0x44, 0x84, 0x85, 0x45, 0x87, 0x47, 0x46, 0x86, 0x82, 0x42,
0x43, 0x83, 0x41, 0x81, 0x80, 0x40
} ;

unsigned short CRC16(unsigned short usDataLen)

{

uchCRCHi = 0xFF ;
uchCRCLo = 0xFF ;

while (usDataLen--)

{
uIndex = uchCRCHi ^ *+ ;
uchCRCHi = uchCRCLo ^ auchCRCHi[uIndex] ;
uchCRCLo = auchCRCLo[uIndex] ;
}

return (uchCRCHi << 8 | uchCRCLo) ;

Summary of Contents for F1X5 RS

Page 1: ...Display F1X5_RS Data 13 01 16 file F1X5_RS_ing doc Pag 1 12 USER S MANUAL AND MAINTENANCE MICROPROCESSOR DISPLAY F1X5_RS WITH MODBUS RTU SERIAL OUTPUT RS232 RS485 ...

Page 2: ...d weather avoid open areas Avoid putting the instrument directly on the ground Store the instrument in its original packing Conformity declaration and EC marking The instrument answers to the following Communitarian Directives 2014 30 EU Electromagnetic compatibility 2014 35 EU Low voltage 2011 65 EU RoHS Maintenance Reparations should be done only and exclusively at the FIAMA technical assistance...

Page 3: ...upply Transducer Terminal Block Serial Output M2 M1 7 8 9 10 Installation Before installing the instrument read the following warnings a Connect the instrument strictly following the instructions of the manual b Carry out the connections using the correct wires within the limits of the tension and power supply as indicated in the technical data c The instrument does not have an ON OFF switch hence...

Page 4: ...etween neutral and earth 1V and the resistance 6 Ohm Connections entries and exits a Physically separate the entry wires from those of the power supply the exits and the power connections use twined and shielded wires with the display connected to the earth only at one point b Connect the exits of adjustments alarms meters electrovalves motors ventilators etc assembling units RC resistance and con...

Page 5: ...ue N B If you input a false password the instrument will immediately leave the programming phase Press RESET ENTER and modify the constant value by means of the digits Press RESET ENTER again to confirm your choice Press to start working with other constants or Press to leave the programming section The constants which have to be programmed and can be run over by the digit are the following ones T...

Page 6: ...ioned values you will get 123 4567 x 100 123456 and IMPULS 10000 The value will be composed by 6 numerals instead of 4 for every visualization Example 2 If you have a proximity sensor and after 10 impulses you need to see the value 7 pls programme in the following way VISUAL 7 and IMPULS 10 Decimal Numbers This constant shows the decimal point position programme 0 if you have not any decimal numbe...

Page 7: ...al contacts A Increasing count impulses from closed to open phase B Decreasing count impulses from closed to open phase B has to be connected to GND if the sensor is NPN to 12V if the sensor is PNP see connection scheme Debounce Filter for Count Inputs If you use an input coming from a mechanical contact in order to avoid debounce impulses you have to programme this constant 1 In this case you can...

Page 8: ... Open collector or push pull PNP Mono directional or proximity transducer connection Open collector or push pull NPN Mono directional or proximity encoder connection Open collector or push pull PNP GND B A 12V A B GND A B 12V B A GND A Vcc GND A Vcc NB With jumper Decreasing count B GND Without jumper Increasing B GND count NB With jumper Decreasing B 12V count Without any jumper increasing B 12V ...

Page 9: ...c 0 15 30Vdc GND Vcc B GND A A B M1 Bi directional connection to the encoder Line driver differential output Micro RESET PRESET max 60 mA F1X50 F1X52 F1X53 0 F1X51 SERIAL OUTPUT CONNECTION M2 1 2 3 4 5 6 GND SERIAL OUT 7 8 RX RS232 RS RS485 TX RS232 RS RS485 NB only one serial output port RS232 or RS485 is active Please refer to F1X5 model ...

Page 10: ...index end static unsigned char auchCRCHi 0x00 0xC1 0x81 0x40 0x01 0xC0 0x80 0x41 0x01 0xC0 0x80 0x41 0x00 0xC1 0x81 0x40 0x01 0xC0 0x80 0x41 0x00 0xC1 0x81 0x40 0x00 0xC1 0x81 0x40 0x01 0xC0 0x80 0x41 0x01 0xC0 0x80 0x41 0x00 0xC1 0x81 0x40 0x00 0xC1 0x81 0x40 0x01 0xC0 0x80 0x41 0x00 0xC1 0x81 0x40 0x01 0xC0 0x80 0x41 0x01 0xC0 0x80 0x41 0x00 0xC1 0x81 0x40 0x01 0xC0 0x80 0x41 0x00 0xC1 0x81 0x40...

Page 11: ...G OF REGISTERS To write the registers of the instrument the master must send a query composed as follows every element is a byte ADDRESS 0x10 START_REG_HI START_REG_LO N_REG_HI N_REG_LO NBYTE DATA_1_HI DATA_1_LO DATA_2_HI DATA_2_LO CRC_HI CRC_LO NBYTE is the number of the given bytes that follow The instrument replies with the following message ADDRESS 0x10 START_REG_HI START_REG_LO N_REG_HI N_REG...

Page 12: ...x14 2 Operation Register 0x15 2 byte HIGH byte don t care this parameter is expressed in encoder count number then is not multiplied by VISUAL IMPULS correction factor The value read from serial port is equal to the display value only if VISUAL IMPULS 4 Technical Features Power supply 115Vac 230Vac 24Vac 15 30Vdc 10 Line frequency 50 60 Hz Power absorbtion 3 VA Display 99999 999999 Inputs type Opt...

Reviews: