Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

send informations via serial port, program

Status
Not open for further replies.

khatarat

Member level 1
Joined
Mar 2, 2009
Messages
41
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
1,545
hi
i want to send informations via serial port
this is my proram in winccr
i want to send 0 to 255. but this program send 0 to 14
and another problem is speed of sending .
this program with _delay_ms(1) send 800 chars in one second and without it nothing will send i thing speed should be more where is the problem?


#ifndef F_CPU
#define F_CPU 11059200
#endif
#define BAUD 115200
#include <avr/io.h>
#include <util/delay.h>
#include <util/setbaud.h>
void adc_init(void)
{
ADCSRA|=(1<<ADEN)|3;
}
void USART_Init()
{
UBRRH = UBRRH_VALUE;
UBRRL = UBRRL_VALUE;
#if USE_2X
UCSRA |= (1 << U2X);
#else
UCSRA &= ~(1 << U2X);
#endif
UCSRC =(1<<URSEL)|(0<<USBS)|(1<<UCSZ1)|(1<<UCSZ0);
UCSRB=(1<<RXEN)|(1<<TXEN);
}

void write(uint8_t Temp)
{
while(!(UCSRA&(1<<UDRE)));
UDR=Temp;
}

int main(void)
{
register uint8_t i;
i=0;
while(1)
{
write(i++);
_delay_ms(1);
}
return 0;
}
 

Re: usart program

Hi
Download project of this link, I think this project can help you about registers of UART Module :
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top