#include <avr/io.h>
//Receives Data via USART module and resends data
//Echoes received data
//PORTD0 = Rx pin
//PORTD1 = Tx pin
//9600bps, 8 bit, no parity, 1 stop bit, asynchronous
//System Clock: 8MHz
//Clock Source: Int RC
//Programmed by: Tahmid
//February 01, 2010
unsigned char Received;
void main(void){
DDRD = 0xFE; //PD0 = Rx, PD1 = Tx
UBRRL = 51; //9600bps
UCSRB = (1<<RXEN)|(1<<TXEN); //Enable Receiver and Transmitter
UCSRC = 6; //8-bit, no parity, 1 stop bit, asynchronous
do{
while ((UCSRA & 0x80) == 0); //Wait for data to be received
Received = UDR;
while ((UCSRA & 0x20) == 0); //Wait for buffer to receive new data
UDR = Received;
while ((UCSRA & 0x40) == 0); //Wait for transmission to complete
}while (1);
}
Tahmid said:Hi,
Which language and compiler?
If you use UART, it won't be very difficult. I can help you with sample code if you can use mikroBASIC.
Tahmid.
Hi,
O. I can help you with mikroC or mikroBASIC. I haven't used AVR Studio.
Tahmid.
hi all
i also wanted to build rs 485 but in my case i want to send data from slave uC in this case a clock data to master uC and display it on 7 seg
is there anyone could help me with the code
iam familiar with bascom-avr compiler
thanks in advance
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?