shahbaz.ele
Advanced Member level 1
- Joined
- Aug 12, 2008
- Messages
- 454
- Helped
- 72
- Reputation
- 146
- Reaction score
- 73
- Trophy points
- 1,308
- Location
- Islamabad, Pakistan
- Activity points
- 3,669
Dear all
I am using ATmega32 controller. serial port is interfaced here is code
this code is working well.
baud rate 4800 at 1MHz
The problem is that now I want to set baud rate 9600 at 1Mhz how can I do this.
Is there any calculator of baud rate value for microcontroller speed?
I am using ATmega32 controller. serial port is interfaced here is code
Code:
baud = 12;
void rs_init(unsigned char baud)
{
UBRRL = baud;
UCSRC = (1<<URSEL)|(3<<UCSZ0);
UCSRB = (1<<RXEN) | (1<<TXEN);
}
void rs_send(unsigned char data)
{
while( !( UCSRA & (1<<UDRE)) );
UDR = data;
}
this code is working well.
baud rate 4800 at 1MHz
The problem is that now I want to set baud rate 9600 at 1Mhz how can I do this.
Is there any calculator of baud rate value for microcontroller speed?