Serial communication of ATMega128
- From: "sindhu" <scinthia_245@xxxxxxxxxxxxxx>
- Date: 30 Jan 2007 22:49:14 -0800
Hi all,
Iam working on Atmega128 and STK500.Iam new to this.
I need to transmit a character from controller.I have given the code
below.
#include"iom128v.h"
#include "io.h"
unsigned char data;
unsigned int baud;
unsigned int i;
int transmit(unsigned char);
void USART0_Init( unsigned int baud)
{
UBRR0H=0x96;
UBRR0L=0x00;
UCSR0B=0x08;
UCSR0C=0x06;
}
int transmit(unsigned char data)
{
PORTA=0x41;
DDRA=0xFF;
loop_until_bit_is_set(UCSR0A,UDRE);
UDR0=data;
return 0;
}
int main(void)
{
SREG=0x80;
SPL=0x61;
SPH=0x00;
USART0_Init(9600);
transmit('A');
return 0;
}
This code is working.PORTA outputs 41.Hyperterminal is not showing
character A.
Can anyone point out the mistake?
Bye.
.
- Follow-Ups:
- Re: Serial communication of ATMega128
- From: Arlet
- Re: Serial communication of ATMega128
- From: Rene Tschaggelar
- Re: Serial communication of ATMega128
- From: Tom Lucas
- Re: Serial communication of ATMega128
- Prev by Date: Re: Interview preparation
- Next by Date: Re: Interview preparation
- Previous by thread: Re: OTP Secure Digital ?
- Next by thread: Re: Serial communication of ATMega128
- Index(es):
Relevant Pages
|