LBdgWgt
Member level 5
Hi all,
i am using C30 compiler for dsPIC30 (i think it basically gcc right?)
i have a problem as i tried to make automatic macro value generation for UART baud rate register.
it should be that the result i want:
but what as i generate the code, the baud register is always filled with the value of 0x298 (664 decimal)?
thanks for any hints!
i am using C30 compiler for dsPIC30 (i think it basically gcc right?)
i have a problem as i tried to make automatic macro value generation for UART baud rate register.
Code:
#define XTAL 7500000U
#define PLL_MULTIPLIER 8U
#define CLOCK_POSTSCALER 1U
#define F_OSC (XTAL * PLL_MULTIPLIER)/CLOCK_POSTSCALER
#define FCY F_OSC/4U
#define UART_BAUD 9600U
#define UART1_BRG (FCY/(16U * UART_BAUD) - 1U)
it should be that the result i want:
Code:
UART1BRG = (UINT16) ((7.5M*8/4)/(16*9600)) - 1 = 97 (approximately)
but what as i generate the code, the baud register is always filled with the value of 0x298 (664 decimal)?
thanks for any hints!