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.

Serial data receiving format error

Status
Not open for further replies.

Deepesh Khaneja

Newbie level 6
Joined
Nov 10, 2013
Messages
12
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
123
hey all
i am trying to send following data serially to pc from atmega16 but at the receiving terminal i am not getting hex data(there is unexpected data) which i am transmitting Please help
Below is my code
Code:
#include<avr/io.h>
#include<util/delay.h>

unsigned char str[8]={0x00,0x00,0x01,0x03,0xff,0xee,0xff};

void usart_init(void)
{
UCSRB|=(1<<TXEN)|(1<<RXEN);
UCSRC|=(1<<URSEL)|(1<<UCSZ1)|(1<<UCSZ0);
UBRRL=(8000000/(16*9600))-1;
}
void SEND_BYTE(unsigned char ch)
{ 
while(!(UCSRA&(1<<UDRE)));
UDR=ch;
}

void main(void)
{
unsigned char length=8;
unsigned char i=0;
usart_init();
while(length>0)
{
SEND_BYTE(str[i]);
i++;
length--;
_delay_ms(500);
}
}

suppose i send a single hex value like 0x42 i receive D3 OR D2 something on pc
 
Last edited by a moderator:

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top