Another excellent tutorial, although one really needs to pay attention to the red changes that flash up in the video. Not all of the changes have been made to the code sample in github. (I went there when I could not make my code work). My development board uses a 4Mhz crystal, instead of the recommended 16Mhz crystal in these tutorials. I needed to change the SPBRG value from 25 to 6, in order to get a baud rate of 9600, and the telnet session to work.
Some good basic information on what needs to be done to Receive and Transmit serial data in assembler. Whilst following you, I was thinking how one might achieve the same thing using the XC compiler. Could the same thing all be done in C?
Hi. I am interfacing PIC16f877a through UART with Freescale MCF51CN128. +5V Vcc for PIC while 3.3V Vcc for MCF supply. I am using 10k pull up resistors for both Rx and Tx pins of PIC. I am also using a CD4050B IC to convert 3.3-5V and vice versa. I am facing this condition of PIC program hanging that happens every now and then during regular execution of program. Without UART function, no hanging issue is found. Issue is resolved only upon Manual reset of PIC via PushButton. Voltage levels at both Rx and Tx pins are in +5 range itself during hanging. In your experience, have you faced such a situation? If so, what maybe the solution. WDT disabled in configuration bits. Thanks
1. Do not use pullups on your date lines the the UART driver should do that by themselves. 2. You can just use a resistor voltage divider to do the signal level conversation. Ratio of 1.5. 3. Try attaching a debugger to see where the code hangs. Likely you are not clearing a error flag on the UART. 4. The line being at 5V during the hang just tells me the UART is in Idle state. 5. if you got 5V on the MCF51CN128. Then your IO is likely toast. 6. Try slowing down the baud rate. The slew rate of the CD4050B might be causing the UART to error out.