emModbusMasterSetup | Top Next

emModbusMasterSetup set up embedded Modbus Master Since R2019b Library: embeddedCreatorLib ( Dafulai Electronics) / Embedded Modbus Master / emModbusMasterSetup Description This block sets up Modbus master parameters. Every embedded target which uses Modbus master must have only-one of this block. When master is in "Idle" state, You can set up all sequences of modbus master operations (Reading blocks or Writing blocks), and then Master will exit "Idle" state and operate in sequences. We provide block to check if all sequences finish. In order to start new group of modbus operations, you must set Modbus master into "Idle" state when all sequences done. In general, you can assign one device's operation (this device is modbus server) in one sequence. So in modbus master "idle", you can assign all devices operations (in different sequences). For device itself sequence operations, for example, after 2 secs when all devices operation done, we send other different operations to all devices. You just use "finite state machine" to do this controls. Notes: You can add only - one embedded Modbus Master or Client. You cannot create 2 or 2+ Modbus Masters or Clients. Parameters Please double click this block to open parameters dialog below: When you click on tab "Read Command Seqs", it will display "Read command Types" instead of "Write command Types" : Let us explain parameters.
• | UART No: — In one embedded Micro-controller, there are many serial ports. This drop list parameter will tell target which serial port of Micro-controller will be used for this embedded modbus master.
• | Baud Rate — embedded serial port baud rate in unit bit/sec. Actually, actual baud rate is decided by embedded target IDE configuration software. Here just use it to decide time for Modbus RTU packet separation (3.5 characters)
• | Force longer space — true will make Modbus Master request packet to be separated with server response packet much longer time (in standard Modbus RTU Protocol, it is 3.5 characters time). It will increase anti-noise ability. false will use standard 3.5 characters space time.
• | Servers Max Qty each writing action — Scalar or vector. The length of Vector denotes how many sequences for writing operation. Max length is 15. Vector's element value denotes how many servers for this writing operations. For example, in figure above, vector=[2 4 7], it tells us total 3 sequences for writing operation. The 1st writing sequence has 2 Modbus servers. The 2nd writing sequence has 4 Modbus servers. The 3rd writing sequence has 7 Modbus servers.
• | The 1st Write command type — This is the 1st writing operation type, it has 5 options from drop list: "Single-Write-holding"/ "Multiple-Write-holdings" / "Single-Write-coil" / "Multiple-Write-coils" / "Mask-write-holding".
• | The 2nd Write command type — This is the 2nd writing operation type, it has 5 options from drop list: "Single-Write-holding"/ "Multiple-Write-holdings" / "Single-Write-coil" / "Multiple-Write-coils" / "Mask-write-holding".
• | The 3rd Write command type — This is the 3rd writing operation type, it has 5 options from drop list: "Single-Write-holding"/ "Multiple-Write-holdings" / "Single-Write-coil" / "Multiple-Write-coils" / "Mask-write-holding"
• | The 4th Write command type — This is the 4th writing operation type, it has 5 options from drop list: "Single-Write-holding"/ "Multiple-Write-holdings" / "Single-Write-coil" / "Multiple-Write-coils" / "Mask-write-holding".
• | The 5th Write command type — This is the 5th writing operation type, it has 5 options from drop list: "Single-Write-holding"/ "Multiple-Write-holdings" / "Single-Write-coil" / "Multiple-Write-coils" / "Mask-write-holding".
• | The 6th Write command type — This is the 6th writing operation type, it has 5 options from drop list: "Single-Write-holding"/ "Multiple-Write-holdings" / "Single-Write-coil" / "Multiple-Write-coils" / "Mask-write-holding".
• | The 7th Write command type — This is the 7th writing operation type, it has 5 options from drop list: "Single-Write-holding"/ "Multiple-Write-holdings" / "Single-Write-coil" / "Multiple-Write-coils" / "Mask-write-holding".
• | The 8th Write command type — This is the 8th writing operation type, it has 5 options from drop list: "Single-Write-holding"/ "Multiple-Write-holdings" / "Single-Write-coil" / "Multiple-Write-coils" / "Mask-write-holding".
• | The 9th Write command type — This is the 9th writing operation type, it has 5 options from drop list: "Single-Write-holding"/ "Multiple-Write-holdings" / "Single-Write-coil" / "Multiple-Write-coils" / "Mask-write-holding".
• | The 10th Write command type — This is the 10th writing operation type, it has 5 options from drop list: "Single-Write-holding"/ "Multiple-Write-holdings" / "Single-Write-coil" / "Multiple-Write-coils" / "Mask-write-holding".
• | The 11th Write command type — This is the 11th writing operation type, it has 5 options from drop list: "Single-Write-holding"/ "Multiple-Write-holdings" / "Single-Write-coil" / "Multiple-Write-coils" / "Mask-write-holding".
• | The 12th Write command type — This is the 12th writing operation type, it has 5 options from drop list: "Single-Write-holding"/ "Multiple-Write-holdings" / "Single-Write-coil" / "Multiple-Write-coils" / "Mask-write-holding".
• | The 13th Write command type — This is the 13th writing operation type, it has 5 options from drop list: "Single-Write-holding"/ "Multiple-Write-holdings" / "Single-Write-coil" / "Multiple-Write-coils" / "Mask-write-holding".
• | The 14th Write command type — This is the 14th writing operation type, it has 5 options from drop list: "Single-Write-holding"/ "Multiple-Write-holdings" / "Single-Write-coil" / "Multiple-Write-coils" / "Mask-write-holding".
• | The 15th Write command type — This is the 15th writing operation type, it has 5 options from drop list: "Single-Write-holding"/ "Multiple-Write-holdings" / "Single-Write-coil" / "Multiple-Write-coils" / "Mask-write-holding".
• | Register Max QTY (inside tab "Write command Seqs" ) — Scalar or vector. The length of Vector denotes how many sequences for writing operation. Max length is 15. So it must be equal to the length of parameter vector "Servers Max Qty each writing action". Vector's element value denotes Maximum Registers QTY for this writing operations, For example, in figure above, vector=[2 1 45], it tells us total 3 sequences for writing operation. The 1st writing sequence has Maximum 2 registers involved. The 2nd writing sequence has Maximum 1 register involved. The 3rd writing sequence has Maximum 45 registers involved.
• | The 1st Read command type — This is the 1st reading operation type, it has 4 options from drop list: "Read-InputsReg"/ "Read-Holdings" / "Read-Discretes" /"Read-Coils".
• | The 2nd Read command type — This is the 2nd reading operation type, it has 4 options from drop list: "Read-InputsReg"/ "Read-Holdings" / "Read-Discretes" /"Read-Coils".
• | The 3rd Read command type — This is the 3rd reading operation type, it has 4 options from drop list: "Read-InputsReg"/ "Read-Holdings" / "Read-Discretes" /"Read-Coils".
• | The 4th Read command type — This is the 4th reading operation type, it has 4 options from drop list: "Read-InputsReg"/ "Read-Holdings" / "Read-Discretes" /"Read-Coils".
• | The 5th Read command type — This is the 5th reading operation type, it has 4 options from drop list: "Read-InputsReg"/ "Read-Holdings" / "Read-Discretes" /"Read-Coils".
• | The 6th Read command type — This is the 6th reading operation type, it has 4 options from drop list: "Read-InputsReg"/ "Read-Holdings" / "Read-Discretes" /"Read-Coils".
• | The 7th Read command type — This is the 7th reading operation type, it has 4 options from drop list: "Read-InputsReg"/ "Read-Holdings" / "Read-Discretes" /"Read-Coils".
• | The 8th Read command type — This is the 8th reading operation type, it has 4 options from drop list: "Read-InputsReg"/ "Read-Holdings" / "Read-Discretes" /"Read-Coils".
• | The 9th Read command type — This is the 9th reading operation type, it has 4 options from drop list: "Read-InputsReg"/ "Read-Holdings" / "Read-Discretes" /"Read-Coils".
• | The 10th Read command type — This is the 10th reading operation type, it has 4 options from drop list: "Read-InputsReg"/ "Read-Holdings" / "Read-Discretes" /"Read-Coils".
• | The 11th Read command type — This is the 11th reading operation type, it has 4 options from drop list: "Read-InputsReg"/ "Read-Holdings" / "Read-Discretes" /"Read-Coils".
• | The 12th Read command type — This is the 12th reading operation type, it has 4 options from drop list: "Read-InputsReg"/ "Read-Holdings" / "Read-Discretes" /"Read-Coils".
• | The 13th Read command type — This is the 13th reading operation type, it has 4 options from drop list: "Read-InputsReg"/ "Read-Holdings" / "Read-Discretes" /"Read-Coils".
• | The 14th Read command type — This is the 14th reading operation type, it has 4 options from drop list: "Read-InputsReg"/ "Read-Holdings" / "Read-Discretes" /"Read-Coils".
• | The 15th Read command type — This is the 15th reading operation type, it has 4 options from drop list: "Read-InputsReg"/ "Read-Holdings" / "Read-Discretes" /"Read-Coils".
• | The 16th Read command type — This is the 16th reading operation type, it has 4 options from drop list: "Read-InputsReg"/ "Read-Holdings" / "Read-Discretes" /"Read-Coils".
• | Register Max QTY (inside tab "Read command Seqs" ) — Scalar or vector. The length of Vector denotes how many sequences for reading operation. Max length is 16. Vector's element value denotes Maximum Registers QTY for this reading operations, For example, in figure above, vector=[30 7 200 300 5 6 7 8 9 10 11 12 13 14 15], it tells us total 15 sequences for reading operation. The 1st reading sequence has Maximum 30 registers involved. The 2nd reading sequence has Maximum 7 register involved. The 3rd reading sequence has Maximum 200 registers involved, ... , The 15th reading sequence has Maximum 15 registers involved.
• | Try Times when error occurs — Scalar. When Modbus Master operation has communication error, Modbus Master can try how many times before it reports communication error.
• | Modbus Master Timeout in ms — Scalar. When Modbus Master sends request to Modbus server, this is maximum time Modbus master can wait for Modbus server to response.
• | How to specify Tx Enable Port — In RS485/422 interface, generally, you need one GPIO output to control Tx Enable. You can choose one of 2 ways to specify this GPIO outport. "By physical port name and bit number" will specify which GPIO Port Name (drop list) and which Port bit number (drop list) used for "Tx Enable". "By C language writing variable/macro name" will directly specify C language's GPIO output variable or macro for "Tx Enable". If your hardware don't use "Tx Enable", you just give this parameter empty string "".
• | Port Name — It is for "Tx Enable". When you use "By physical port name and bit number", it specify GPIO Port Name (drop list).
• | Port Bit number — It is for "Tx Enable". When you use "By physical port name and bit number", it specify which Port bit number (drop list).
• | Target RS485 Tx Enable C language operation Name — It is for "Tx Enable". When you use "By C language writing variable/macro name", it will directly specify C language's GPIO output variable or macro for "Tx Enable". If your hardware don't use "Tx Enable", you just give this parameter empty string "".
• | Target RS485 Tx Enable polarity is High — It is for "Tx Enable". True means GPIO port Logic High will enable "RS485/RS422" transmit. False means GPIO port Logic Low will enable "RS485/RS422" transmit.
Ports Input None Outport None Examples