1.11M Members

UART communication Problem

 
0
 

ok here is the problem.
im trying to send data from UART of ATMEGA 32 to my PC on hyperterminal
following is the program im using:

#include<mega32.h>
#include<delay.h>

void usart_init (void)
    {
    UCSRB = (1<<TXEN);
    UCSRC = (1<<UCSZ1)| (1<<UCSZ0)|(1<<URSEL);
    UBRRL = 0x47;
    }

void usart_send (unsigned char ch)
    {
    while(!(UCSRA & (1<<UDRE)));
    UDR = ch;
    delay_ms(1000);
    }

void main (void)
    {
    unsigned char str[31]= "Im Ready For My First Command ";
    unsigned char strLength = 31;
    unsigned char i = 0; 
    DDRA.0 = 0;
    PORTA.0 = 1;
    usart_init();
    while(1)
        {
        usart_send(str[i++]); 
           if(i>=strLength)
            i=0;

        }
    } 

on the other hand the serial to USB interface im using is working fine when put it throught the loop test (joining the RX and TX pins and then pressing any key for display on Hyperterminal). but when i attach it to MAX 232 output pins (RX and TX)then Hyperterminal gives the message "Unable to open COM1 port"

HELP PLEASE... :(

 
0
 

oh and i using windows 7 ultimate

You
This article has been dead for over six months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article