User`s manual

sub procedure RS485master_write(dim byref data as byte[2],
dim datalen as byte, dim address as byte)
MCU must be initialized as Master in 485 communication. It is programmer's
responsibility to ensure (by protocol) that only one device sends data via 485 bus
at a time.
dim byref data as byte[2], dim datalen as byte
Sends number of bytes (1 < datalen <= 3) from buffer via 485.
sub procedure RS485slave_read(dim byref data as byte[5])
MCU must be initialized as Slave in 485 communication.
dim byref data as byte[5]
Only messages that appropriately address Slaves will be received. As messages are
multi-byte, this procedure must be called for each byte received (see the example
at the end of the chapter). Upon receiving a message, buffer is filled with the fol-
lowing values:
data[0..2] is data; data[3] is number of bytes received (1..3) ; data[4] is set to
255(TRUE) when message is received; data[5] is set to 255(TRUE) if an error has
occurred; rest of the buffer is undefined
Procedure automatically sets data[4] and data[5] upon every received message.
These flags need to be cleared repeatedly from the program.
mikroBASIC
- Basic Compiler for Microchip PIC microcontrollers
152
mikroBASIC
MikroElektronika: Development tools - Books - Compilers
making it simple...
page
RS485master_write
Prototype:
Parameters:
Effects:
Precondition:
RS485slave_read
Prototype:
Parameters:
Effects:
Precondition: