Page 1 of 1

RS232 Baud Rate? Interrupts

Posted: Mon Dec 03, 2012 1:08 am
by cobra1
Hi,
Im trying to communicate with a PIC via PC Terminal.

I have the terminal set at a Baud rate of 9600. My Pic is set at 8Mhz
The PIC baud rate on my pic is also set at 9600, and im using the software Uart as the PIC does not have Hardware Uart.

Running on the PIC are 2 interrupts. Interrupt 1 is interrupting at 100hz, it senses the zero crossing of a mains line.
Interrupt 2 is interrupting at 10Khz, it interrupts every 100uS.

Due to these interrupts it throws out the baud on the uart and im not exactly sure how to fix it. Disabling the interrupts fixes the communication problem and data is sent and received correctly, however these interrupts have to run constantly to work correctly.

I have looked at pretty much all the threads in the forum to try and find a solution and all i can see is that you have to use the custom setting in the baud to fix the problem. Is there some sort of formula that is required to calculate this?

Any help on this would be great.

Re: RS232 Baud Rate? Interrupts

Posted: Mon Dec 03, 2012 12:02 pm
by Benj
Hello,

My advise would be to use a chip with a hardware UART. If you have already designed the hardware then let us know your current chip and we may be able to offer a suggestion.

Getting the timings correct for the software UART with interupts kicking in and out will be very tricky. If the hardware UART is not possible then it may be possible to tweak the baud rates to try and pick up valid data some of the time. Using a INT pin or interrupt on change may also be used to try and help improve the data reception.