??? 04/17/07 07:09 Read: times |
#137353 - You are putting the cart before the horse Responding to: ???'s previous message |
Mike Stegmaier said:
So it seems that the equations in the tutorial are garbage to me. No - you are just mis-applying them! ![]() ![]() There is nothing there that attempts to determine the interval between characters in terms of machine cycles. It seems now that the new equation is:
(Cs * St) / otc where Cs is the crystal speed, St is the time it takes for a character to be received in seconds and otc is the number of oscillator ticks per cycle. In my 8051, it is 12. Nothing new there! Clearly, your serial character processing (including, but not only, the serial ISR) must be able to completely process one character in less time than it takes for the next character to arrive. This is a Time limitation. This is the 'St' term in the equation. Now, you can calculate how many machine cycles you have available in that time - and you can increase the number of cycles by using a faster crystal. This accounts for the 'Cs' and 'otc' terms in the equation. Now the UART's baud rate clock is (usually) derived from the same clock as the machine cycles - so you could derive a formula that relates 'St' to 'Cs', and substitute that in your equation... But it's probably easier to just stick with the time between characters (which is known directly from the baud rate) and work out the equivalent number of machine cycles from there. |