RS232 Baud Rate? Interrupts

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 2 and 3.

Moderators: Benj, Mods

cobra1
Posts: 175
Joined: Thu Feb 04, 2010 7:44 am
Has thanked: 3 times
Been thanked: 3 times
Contact:

RS232 Baud Rate? Interrupts

Postby cobra1 » Mon Dec 03, 2012 1:08 am

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.

User avatar
Benj
Matrix Staff
Posts: 14574
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4603 times
Been thanked: 4241 times
Contact:

Re: RS232 Baud Rate? Interrupts

Postby Benj » Mon Dec 03, 2012 12:02 pm

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.