Mikroelektronika MIKROE-350 Datenbogen
RS485Master_Send
329
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroBasic PRO for AVR
CHAPTER 6
Prototype
sub procedure Rs485Master_Send(dim byref data_buffer as byte[20],
dim datalen as byte, dim slave_address as byte)
dim datalen as byte, dim slave_address as byte)
Returns
Nothing.
Description
Sends message to Slave(s). Message format can be found at the bottom of this
page.
page.
Parameters :
-
data_buffer:
data to be sent
-
datalen:
number of bytes for transmition. Valid values: 0...3.
-
slave_address:
Slave(s) address
Requires
MCU must be initialized as a Master for RS-485 communication. See
RS485Master_Init.
RS485Master_Init.
It is the user’s responsibility to ensure (by protocol) that only one device sends
data via 485 bus at a time.
data via 485 bus at a time.
Example
dim msg as byte[20]
...
' send 3 bytes of data to slave with address 0x12
RS485Master_Send(msg, 3, 0x12)
...
' send 3 bytes of data to slave with address 0x12
RS485Master_Send(msg, 3, 0x12)