News:

PROTON pic BASIC Compilers for PIC, PIC24, dsPIC33

Main Menu

SerIn - Baudmode calculation - Step1 question

Started by trastikata, May 22, 2021, 11:26 PM

Previous topic - Next topic

trastikata

Hello,

could someone please clarify how is the Baudmode calculated. In Step 1 the manual states "(1,000,000 / Baud rate) – 20" - my question is if that 1 000 000 is a fixed value or it is oscillator's frequency dependent?

Thank you.

keytapper

Software produced or hardware one, definitely the timing is based on the MCU clock. But the internal clock is mostly divided by 4.
Ignorance comes with a cost

trastikata

Quote from: keytapper on May 23, 2021, 09:12 AMSoftware produced or hardware one, definitely the timing is based on the MCU clock. But the internal clock is mostly divided by 4.

The confusing part is that I have a code working with an USB clock of 48 MHz - 20MHz crystal with PLL enabled and no CPUDIV. In this code I am using SerIn command with Baudmode calculated using 1,000,000 and it works - serial strings are correctly received!

That's why I am confused how actually the Baudmode is calculated?