PIC16 from datasheet
Typical ASM for PIC16:Bit SPEN (RCSTA<7>) and bits TRISC<7:6> have to be
set in order to configure pins RC6/TX/CK and RC7/RX/DT
as the Universal Synchronous Asynchronous Receiver
Transmitter.
Code: Select all
;usart_c67.ppas,25 ::
MOVLW 144
BCF STATUS, RP0
MOVWF RCSTA
;usart_c67.ppas,31 ::
BSF STATUS, RP0
BSF TRISC, 7
;usart_c67.ppas,32 ::
BCF TRISC, 6
18F4520 from datasheet:In order to configure pins RC6/TX/CK and RC7/RX/DT
as the Universal Synchronous Asynchronous Receiver
Transmitter:
• bit SPEN (RCSTA<7>) must be set (= 1),
• bit TRISC<6> must be cleared (= 0), and
• bit TRISC<7> must be set (=1).
Typical ASM for P18:The pins of the Enhanced USART are multiplexed
with PORTC. In order to configure RC6/TX/CK and
RC7/RX/DT as a USART:
• bit SPEN (RCSTA<7>) must be set (= 1)
• bit TRISC<7> must be set (= 1)
• bit TRISC<6> must be set (= 1)
Code: Select all
$008A $ _Usart_Init:
BSF TXSTA, 5, 0
MOVLW 144
MOVWF RCSTA, 0
BSF TRISC, 7, 0
BCF TRISC, 6, 0