??? 12/30/04 18:25 Read: times |
#84135 - Use oversampling Responding to: ???'s previous message |
If your timer is interrupting 4800-times per second, then you take samples from a random part of the serial stream's pulses - once too close to the leading edges, then too close to the trailing edges. A small asymmetry in pulses' shape, and/or edge jitter and you have your 50% error rate... You need somehow start your sampling around the middle of the edges. Traditionally, sw uarts' RxD are connected to p3.2/p3.3, and exteral interrupr is used to detect the start bit's (1->0) edge, then disabling the external interrupt, start timer, sample the start bit after a half-bit's time (in the middle of bit), then take the databits' and stopbit samples in a bit's time. If you insist on p1.0, you need to take your samples more often, at least 4-8x faster to detect the start bit edge more reliably. Then proceed as described above. On a 52, maybe some trick with timer2 can be found, but I am not sure... Jn Waclawek Jan |
Topic | Author | Date |
Polling/Interrupt For Serial Input | 01/01/70 00:00 | |
bible time | 01/01/70 00:00 | |
Soft UART | 01/01/70 00:00 | |
Hardware? | 01/01/70 00:00 | |
SW UART is not a taboo! | 01/01/70 00:00 | |
yes... | 01/01/70 00:00 | |
think before you do | 01/01/70 00:00 | |
Use oversampling | 01/01/70 00:00 | |
soft UART | 01/01/70 00:00 | |
Half bits | 01/01/70 00:00 | |
Oversampling | 01/01/70 00:00 | |
It's not so bad | 01/01/70 00:00 | |
Oh yes it is! | 01/01/70 00:00 | |
Haven't read it completely? | 01/01/70 00:00 | |
neither have I | 01/01/70 00:00 | |
Sure you did not! | 01/01/70 00:00 | |
did I miss it | 01/01/70 00:00 | |
Problem displaying posts? | 01/01/70 00:00 | |
sure that will work | 01/01/70 00:00 | |
NOT A PIC | 01/01/70 00:00 | |
Just forget 89c51 then. | 01/01/70 00:00 | |
@Erik | 01/01/70 00:00 | |
...all said already. | 01/01/70 00:00 | |
OS? Threads?! | 01/01/70 00:00 | |
Appnote to read | 01/01/70 00:00 | |
threads | 01/01/70 00:00 | |
Problem Solved![]() | 01/01/70 00:00 |