Hi How can I determine the value of BG(ASCx_BG) and FDV? If I intend to follow the specifications: Input clock: fasc=40MHz FDE=1 BRS=0 Baudrate=115.2kbps Die Jong
The reason I ask about the value of FDV and BG because someone used the values such as ASC0_FDV = 0x00EC; ASC0_BG = 0x0004; I could not get the answer by using the forumla: baud rate = (FDV/512)*(fsys/(16*(BG+1)) I know there is a table 18-6 that tell me the value of FDV and BG should 76 and 4 respectively. Can anyone please tell how to get these below values from ? ASC0_FDV = 0x00EC; ASC0_BG = 0x0004 Die Jong
Here is my code...
/// ----------------------------------------------------------------------- /// Configuration of the ASC0 Baudrate Generator: /// ----------------------------------------------------------------------- /// - fractional divider as prescaler for baud rate timer is used ASC0_FDV = 0x00EC; // load ASC0 fractional divider register /// - required baud rate = 115.200 kbaud /// - real baud rate = 115.234 kbaud /// - deviation = 0.030 % ASC0_BG = 0x0004; // load ASC0 baud rate time reload register /// ----------------------------------------------------------------------- /// Configuration of the ASC0 Operation Mode: /// ----------------------------------------------------------------------- /// - 8-bit data asychronous operation with one stop bit /// - receiver is enabled /// - fractional divider is enabled ASC0_CON = 0x0811; // load ASC0 control register
Hi, maybe its the fact that there can be more than one solution to your formula that is confusing you ? You can use either FDV = 0x76 && BG = 0x04 or FDV = 0xEC && BG = 0x09 Depends on the Precision you need.
Thank you for pointing it out.... I found that 20MHz is used as fsys instead of 40MHz.... So that the values of ASC1_FDV and ASC1_BG are correct. By the way, Happy new year guys :) Die Jong