Mikroelektronika MIKROE-738 Datenbogen
![Mikroelektronika](https://files.manualsbrain.com/attachments/e0529b3b58069a916ad7bb89f7e9f5f0eda73421/common/fit/150/50/1b07b99aa3112e022a916b06db07f1f4f211e91d41878452d87c7638b1bf/brand_logo.gif)
408
mikoC PRO for PIC32
MikroElektronika
RS485Slave_Init
Prototype
void RS485Slave_Init(char Slave_address);
Description Initializes MCU as a Slave for RS-485 communication.
Parameters -
Parameters -
Slave_address
: Slave address
Returns
Nothing.
Requires
Global variables:
-
RS485_rxtx_pin
- this pin is connected to RE/DE input of RS-485 transceiver(see schematic at
the bottom of this page). RE/DE signal controls RS-485 transceiver operation mode. Valid values:
1
(for transmitting) and
0
(for receiving
-
RS485_rxtx_pin_direction
- direction of the RS-485 Transmit/Receive pin.
must be defined before using this routine.
UART HW module needs to be initialized. See UARTx_Init.
Example
Initialize MCU as a Slave with address 160:
// RS485 module pinout
sbit RS485_rxtx_pin at RC2_bit; // transmit/receive control set to
PORTC.B2
sbit RS485_rxtx_pin_direction at TRISC2_bit; // RxTx pin direction set as
output
// End of RS485 module pinout
...
UART1_Init(9600); // initialize UART1 module
RS485Slave_Init(160); // intialize MCU as a Slave for RS-485
communication with address 160
Notes
None