It's the RN-171. I'm using this code and I can see the data coming out of the RN-171 and into the 4550 but the 4550 isn't doing anything. Am I at least in the ballpark?
Code:
DEFINE OSC 48
@ __CONFIG _CONFIG1L, _PLLDIV_5_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L
@ __CONFIG _CONFIG1H, _FOSC_HSPLL_HS_1H & _FCMEN_OFF_1H & _IESO_OFF_1H
@ __CONFIG _CONFIG2L, _PWRT_OFF_2L & _BOR_OFF_2L & _BORV_3_2L & _VREGEN_ON_2L
@ __CONFIG _CONFIG2H, _WDT_OFF_2H & _WDTPS_32768_2H
@ __CONFIG _CONFIG3H, _CCP2MX_ON_3H & _PBADEN_OFF_3H & _LPT1OSC_OFF_3H & _MCLRE_ON_3H
@ __CONFIG _CONFIG4L, _STVREN_ON_4L & _LVP_OFF_4L & _ICPRT_ON_4L & _XINST_OFF_4L
CMCON = 7
PORTD.1=0 'diagnostic LED
PORTD.0=0 'diagnostic LED
DEFINE HSER_BAUD 9600
DEFINE HSER_RCSTA 90h
DEFINE HSER_TXSTA 20h
DEFINE HSER_CLROERR 1
in1 var byte
HIGH PORTD.0
HIGH PORTD.1
mainloop:
IF RCSTA.1 = 1 THEN 'if USART overrun error flag OERR is set...
RCSTA.4 = 0 'clear and then set CREN bit to recover
RCSTA.4 = 1
in1 = RCREG 'read data to clear out RCREG
IF PIR1.5 = 1 THEN in1 = RCREG 'clear possible 2nd byte in RCREG
ENDIF
WHILE PIR1.5 = 0 'stay here until USART receives data
WEND
LOW portD.0 'data in RCREG; turn on diagnostic LED <----my code won't go past this point even though I can see data being sent with an oscope.
goto mainloop
Bookmarks