Home
Prox / RFID
Verichips
Ladder Logic
[interfacing] †
Tube Joints
Key Code From Photo
SolveSpace (3d CAD)
SketchFlat (2d CAD)
Photographs
Miscellany
Resume / Consulting
Contact Me

LDmicro Forum - A Small problem with UART and scan time

(you are viewing a thread; or go back to list of threads)

A Small problem with UART and scan time (by David R)
Hi,
I have a small issue with my pic receiving UART.
I am sending some char's to the PIC and when Char='C' or 'O'
it rings A buzzer.

The problem is the buzzer rings sometimes when 'c' or 'O' is not sent.


I tracked it down to scan time, with 10ms it sometime does incorrect detect.

with scan time set to 1ms every thing works well.

Do you think this is my problem or have I done something else wrong ?

What is the best scan time when using UART ?

Kind Regards
David.
Sat Oct 24 2009, 03:04:50, download attachment house_controller_14.7456mhz.ld
(no subject) (by Jonathan Westhues)
One potential issue is that bytes may get dropped if they come in faster than one per cycle time.

At 9600 bps and 10 bit times per byte, that's 960 bytes per second max. In that case, 1 ms is (barely) fine, and 10 ms is potentially too slow. So at 10 ms, you might lose characters, unless the sender always leaves at least an extra ~9 ms in between. You could put some delays in the sender, or slow down the baud rate.

But that wouldn't explain why you're receiving unexpected bytes. I might be more inclined to suspect a noise problem or something like that.
Sat Oct 24 2009, 04:06:33
(no subject) (by David R)
Hi,
I don't think it is noise as I connected A MAX232 next to the pic and feed it into the PC and all was good there.
The sender is A pic using formatted string so I don't know what
delay that has between Char's.

The sender is sending "GBeam/r/n" every 500ms and the receiver
sometimes thinks there is "GC" in there but only when set to 10ms, all good when set to 1ms.
It is random it might happen once every 5 minuets or so.

I will slowly ramp up the time to see if there is a point when it fails.

Regards
David.
Sat Oct 24 2009, 04:38:28
(no subject) (by Jonathan Westhues)
The "formatted string over UART" op transmits one character per cycle time.

If the sending PIC is also running with a 10 ms cycle time, then the timing would be just on the edge; so perhaps that would explain the mystery. You might try a slightly slower cycle time on the sending PIC.
Sat Oct 24 2009, 04:45:16
(no subject) (by David R)
The sending pic is 10ms, I will try changing speeds and post results so other people know what happens.
Regards
David.
Sat Oct 24 2009, 05:41:56
(no subject) (by Frank Mc Alinden)
Hi David

I had the same issue with my moisture app , it was missing some characters if i ran @9600 baud...Ended up with a scan time of 1ms and baudrate of 2400 to get reliable reception...

HTH
Frank
Sat Oct 24 2009, 18:09:24
Post a reply to this comment:
Your Name:
Your Email:
Subject:
(no HTML tags; use plain text, and hit Enter for a line break)
Attached file (if you want, 5 MB max):