Calculate time between received bytes
-
- Posts: 130
- Joined: Sat Feb 26, 2011 4:26 am
- Location: South Africa
- Has thanked: 25 times
- Been thanked: 11 times
- Contact:
Calculate time between received bytes
How do you calculate the time you have between received bytes to execute other commands when a pic is running with 19.606 MHz crystal and a baud rate of 9600?
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: Calculate time between received bytes
Hello,
A 8-bit PIC runs at 1/4th of the clock frequency so at 19.6608MHz the chip is running at 4.9152MHz.
4.9152MHz / (9600 / 10) = 20480 instructions between byte receptions.
I divided the baud rate by 10 because each 8-bit byte requires a start bit and a stop bit, eg 960 bytes per second @ 9600 baud.
A 8-bit PIC runs at 1/4th of the clock frequency so at 19.6608MHz the chip is running at 4.9152MHz.
4.9152MHz / (9600 / 10) = 20480 instructions between byte receptions.
I divided the baud rate by 10 because each 8-bit byte requires a start bit and a stop bit, eg 960 bytes per second @ 9600 baud.
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 130
- Joined: Sat Feb 26, 2011 4:26 am
- Location: South Africa
- Has thanked: 25 times
- Been thanked: 11 times
- Contact:
Re: Calculate time between received bytes
Hi Ben
Thanks for the reply.
![Confused :?](./images/smilies/icon_confused.gif)
Thanks for the reply.
19660800 /960 = 204804.9152MHz / (9600 / 10) = 20480 instructions between byte receptions.
![Confused :?](./images/smilies/icon_confused.gif)