# Modbus

You can use simple CSV file to import definition of modbus device into your Mervis IDE project.

### Columns

Name Description
Name Variable name
The concrete bit position (LSB=.1 to MSB=.16) or byte (.Lo or .Hi) can be specified for Registers - see examples below
Count Number of modbus elements to be read/written
Function Coil/DiscreteInput/InputRegister/HoldingRegister
StType Standard Mervis IDE variable type
ByteOrder Leave empty for default byte order or specify correct byte positions as numbers from 1 to 8 (eg. 1234/3412/4321/2143 for 32 bit number)
K Transformation parameter for y = Kx + Q
Q Transformation parameter for y = Kx + Q
X1 Alternative definition for y = Kx + Q, where the parameters are computed from [X1,Y1], [X2,Y2] points of the line.
Y1 Alternative definition for y = Kx + Q, where the parameters are computed from [X1,Y1], [X2,Y2] points of the line.
X2 Alternative definition for y = Kx + Q, where the parameters are computed from [X1,Y1], [X2,Y2] points of the line.
Y2 Alternative definition for y = Kx + Q, where the parameters are computed from [X1,Y1], [X2,Y2] points of the line.
ModbusDefinition.csv
```StationNumber,Name,Element,Count,Function,Writable,StType,ByteOrder,K,Q,X1,Y1,X2,Y2
1,Variable001,1201,1,InputRegister,0,Int,12,,,,,,
1,Variable002,1202,1,InputRegister,0,Int,12,,,,,,
1,Variable003,1203,1,InputRegister,0,Int,12,,,,,,
1,Variable004,501,2,InputRegister,0,Real,3412,,,,,,
1,Variable005,503,2,InputRegister,0,Real,3412,,,,,,
1,Variable006,505,2,InputRegister,0,Real,3412,,,,,,
1,Variable007,507,2,InputRegister,0,Real,,,,,,,
1,Variable008,407,1,HoldingRegister,0,Int,,0.1,,,,,
1,Variable009,408,1,HoldingRegister,0,Int,,,,,,,
1,Variable010,409,1,HoldingRegister,0,Int,,,,,,,
1,Variable011,425,1,HoldingRegister,0,Int,,,,,,,
1,Variable012,426,1,HoldingRegister,0,Int,,,,,,,
1,Variable013,427,1,HoldingRegister,0,Int,,,,,,,
1,Variable014,428,1,HoldingRegister,0,Int,,,,,,,
1,Variable015,429,1,HoldingRegister,0,Int,,,,,,,
1,Variable016,1,2,HoldingRegister,0,Real,,0.1,0,,,,
1,Variable017,3,2,HoldingRegister,0,Real,,,,0,0,20,10
1,Variable018,5,2,HoldingRegister,0,Real,,,,,,,
1,Variable019,7,2,HoldingRegister,0,Real,,,,,,,```
ModbusDefinition2.csv
```StationNumber,Name,Element,Count,Function,Writable,StType,ByteOrder,K,Q,X1,Y1,X2,Y2
1,Variable001_bit1,1201.1,1,InputRegister,0,Bool,12,,,,,,
1,Variable001_bit10,1201.10,1,InputRegister,0,Bool,12,,,,,,
1,Variable001_Hi,1201.Hi,1,InputRegister,0,Usint,12,,,,,,```