Mikroelektronika MIKROE-442 데이터 시트
628
mikoBasic PRO for dsPIC30/33 and PIC24
MikroElektronika
UART_Set_Active
Prototype
sub procedure UART_Set_Active (dim read_ptr as ^TUART_Rd_Ptr, dim write_
ptr as ^TUART_Wr_Ptr, dim ready_ptr as ^TUART_Rdy_Ptr, dim tx_idle_ptr as
^TUART_TX_Idle_Ptr)
Description Sets active UART module which will be used by UARTx_Data_Ready, UARTx_Read and UARTx_
Write routines.
Parameters Parameters:
-
read_ptr
: UARTx_Read handler
-
write_ptr
: UARTx_Write handler
-
ready_ptr
: UARTx_Data_Ready handler
-
tx_idle_ptr
: UARTx_Tx_Idle handler
Returns
Nothing.
Requires
Routine is available only for MCUs with multiple UART modules.
Used UART module must be initialized before using this routine. See UARTx_Init and UARTx_Init_
Advanced routines.
Example
UART1_Init(9600); ‘ initialize UART1 module
UART2_Init(9600); ‘ initialize UART2 module
RS485Master_Init(); ‘ initialize MCU as Master
UART_Set_Active(@UART1_Read, @UART1_Write, @UART1_Data_Ready, @UART1_Tx_
Idle); ‘ set UART1 active
RS485Master_Send(dat,1,160); ‘ send message through UART1
UART_Set_Active(@UART2_Read, @UART2_Write, @UART2_Data_Ready, @UART2_Tx_
Idle); ‘ set UART2 active
RS485Master_Send(dat,1,160); ‘ send through UART2
Notes
None.