MountainA
- 9th April 2014, 01:41
Hello all
I am having problems reading a configurable serial port of a PIC 18LF. I am able to send data but unable to make sense of any of the data received. I have attached the cut down code I have been working on)
Observations:
The Define HSER2_BAUD instruction does not appear to set up the Pic's baud rate generator, I have to do this manually to get it working correctly.
Once configured I am able to send a small test string "hello world" however it is proceeded by a zero. This is not too much of a problem, I am sure I can sort something out to resolve that issue.
When I type a character to be received by the pic through an RS232 interface, the characters received are unintelligible.
Things I have checked.
I have checked using a scope that the RS232 driver is sending the data correctly to the pick. The letter "A" or any other character is observed to be arriving at the UART of the pic correctly and in the right phase (not inverted)
I have sent the received data to an LCD to be displayed as well as sending the received character out to a terminal, in both circumstances the data is unintelligible.
I have looked directly at the RCREG2 to ensure there was no problem there but what I see is the same unintelligible data.
I have checked that I have the correct re-mappable pin for the UART. (The RX interrupt does not work if I select any other pin, in other words the UART is reacting to the data received)
I have set BAUDCON2.3 = 1 to enable the UART to wake up from sleep mode, without this bit set, the UART does not wake up the PIC.
I have spent some time on this now and I am clearly not getting anywhere. I am about to check UART1 operation to confirm if I have the same problem but as I have limited access to this port (it will be talking to another device) it’s a little more complicated. In the meantime if anyone could shed some light on the matter I would be very grateful.
Cheers
Ant :eek:
I am having problems reading a configurable serial port of a PIC 18LF. I am able to send data but unable to make sense of any of the data received. I have attached the cut down code I have been working on)
Observations:
The Define HSER2_BAUD instruction does not appear to set up the Pic's baud rate generator, I have to do this manually to get it working correctly.
Once configured I am able to send a small test string "hello world" however it is proceeded by a zero. This is not too much of a problem, I am sure I can sort something out to resolve that issue.
When I type a character to be received by the pic through an RS232 interface, the characters received are unintelligible.
Things I have checked.
I have checked using a scope that the RS232 driver is sending the data correctly to the pick. The letter "A" or any other character is observed to be arriving at the UART of the pic correctly and in the right phase (not inverted)
I have sent the received data to an LCD to be displayed as well as sending the received character out to a terminal, in both circumstances the data is unintelligible.
I have looked directly at the RCREG2 to ensure there was no problem there but what I see is the same unintelligible data.
I have checked that I have the correct re-mappable pin for the UART. (The RX interrupt does not work if I select any other pin, in other words the UART is reacting to the data received)
I have set BAUDCON2.3 = 1 to enable the UART to wake up from sleep mode, without this bit set, the UART does not wake up the PIC.
I have spent some time on this now and I am clearly not getting anywhere. I am about to check UART1 operation to confirm if I have the same problem but as I have limited access to this port (it will be talking to another device) it’s a little more complicated. In the meantime if anyone could shed some light on the matter I would be very grateful.
Cheers
Ant :eek: