#warning "**VERIFY USART2_TX PIN - assuming PORTB.6**"
#warning "**VERIFY USART2_RX PIN - assuming PORTB.7**"
My guess is I am not setting the PPS pins correctly. The PPS module shows the example "pps.assign_output(RA0PPS, PPS_TMR0)" and "assign_input(PPS_RX2, PPS_IN_RP0)". The input example is very close to what I'm using so don't think the problem is there. However, when I make the output "pps.assign_output(RA1PPS, PPS_TX2)" like the example, I get an error. I am unsure of the output syntax.
Code: Select all
Device = 18F27J13
Clock = 8
Config IOL1WAY = OFF
// import modules...
Include "intosc.bas"
Include "convert.bas"
Include "system.bas"
Include "USART.BAS"
Include "USART2.bas"
#option USART2_TX = PORTA.1 ' SPI data out - RP1
#option USART2_RX = PORTA.5 ' SPI data in - RP2
Include "spi.bas"
Include "setdigitalio.bas"
Include "PPS.bas"
Private Dim
b1 As Byte
'****************************************************************
Public Sub SET_2_SERIAL()
pps.unlock()
pps.assign_input(PPS_RX2, PPS_IN_RP2) ' RA.5
pps.assign_output(PPS_TX2, PPS_OUT_RP1) ' RA.1
pps.lock()
USART2.SetBaudrate(br9600)
End Sub
'****************************************************************
SET_2_SERIAL()
'****************************************************************
MAIN:
USART2.Write("I'M ALIVE!",10,13)
DelayMS(5)