Please enable JavaScript to view this site.

This function writes the specified COILS always using the Modbus function code of the corresponding multiple writes FC 15, unlike mbc_write_coils() which can also use FC 05 (if single COIL).

Syntax

i32 mbc_write_multiple_coils( i32 mbc, i32 offsCoilStart, i32 nCoil, source)

mbc

Handle value returned by mbc_init()

offsCoilStart

Initial index of the COIL

nCoil

Number of COILS to be written.

NOTE: The maximum number of COILS that can be written is 1968.

source

Area where to take the data to be written.

Can be i16/u16/i32 or array of i16/u16/i32

Result

Returns:

Value

Meaning

0 [MBC_OK]

Command executed

-1 [MBC_INVAL]

Invalid arguments

-2 [MBC_BUSY]

Resource occupied

-3 [MBC_PERM]

Permission denied

-4 [MBC_CONN]

Connection failed

-5 [MBC_NOBUFS]

Buffer exhausted

-6 [MBC_NOMEM]

Insufficient memory

-7 [MBC_TX_ERR]

Transmission error

-8 [MBC_RX_ERR]

Receive error

-9 [MBC_TIMEOUT]

Blocking command timeout

-10 [MBC_EXC_CODE_1]

Response with exception 1 (function code not supported by server)

-11 [MBC_EXC_CODE_2]

Response with exception 2 (invalid address)

-12 [MBC_EXC_CODE_3]

Response with exception 3 (invalid quantity or value)

-13 [MBC_EXC_CODE_4]

Response with exception 4 (operation failed)

-14 [MBC_WRONG_ANSWER]

Invalid response

-15 [MBC_INVAL_MBC]

Invalid mbc id

Validity

Task

Note

The function is blocking. Exits only when the task is completed

 

  

Keyboard Navigation

F7 for caret browsing
Hold ALT and press letter

This Info: ALT+q
Page Header: ALT+h
Topic Header: ALT+t
Topic Body: ALT+b
Contents: ALT+c
Search: ALT+s
Exit Menu/Up: ESC