Loading ...
Sorry, an error occurred while loading the content.

Re: [booksbybibin,www.booksbybibin.tk] Re: having problem while communication through Bray's terminial

Expand Messages
  • Saeed Ahmed
    hello, first i use 1uf electrolytic then i change it to 10uf  electrolytic then change it 10uf tantalum and i again change it to 22uf electroytic.the baud
    Message 1 of 15 , Jul 26, 2009
    • 0 Attachment
      hello,
      first i use 1uf electrolytic then i change it to 10uf  electrolytic then change it 10uf tantalum and i again change it to 22uf electroytic.the baud rate i using is 2400 i also try with 19200 using internal 1mhz oscillator and 8mhz .the data bits are 8 ,no parity and 1 stop bit.i still having problem .
      thanking u,
      dany

      --- On Fri, 7/24/09, Mihai Galos <mihaigalos@...> wrote:

      From: Mihai Galos <mihaigalos@...>
      Subject: [booksbybibin,www.booksbybibin.tk] Re: having problem while communication through Bray's terminial
      To: booksbybibin@yahoogroups.com
      Date: Friday, July 24, 2009, 10:19 PM

       
      What are the values for the capacitor you are using for the max232? What is the actual value written in the UBRR? (set it manually #define datarate_value <a number>). How many data bits are you using (7 or 8).how many stop bits(1 or 2). What is the parity?

      Regards,
      Mihai
      --- In booksbybibin@ yahoogroups. com, Saeed Ahmed <danial_1000@ ...> wrote:
      >
      > hi mihi,
      > i did the same as u saying keeping in view the precedence of arithematic operator to calcute the correct value of UBRR after that i tried but i fail again .actually i design my own development board for atmega8 & 32.i think there is two possibilities the first one in that the setting of bray's terminal is incorrect  the second one is that my hardware is faulty but i check so many times it is ok.i also change max 232 and place it on bread board with the same programme runninig on the micro but invain.i having another problem also that i destroyed qty 06 atmega32 and 01 atmega8 during this exercise while programming through pony prog serial programmer .i don,t know why the micro's r going to death.plz if u have any conclusion after reading my history of programming the micro's plz help me.
      > regards
      > dany
      >
      > --- On Wed, 7/22/09, Mihai Galos <mihaigalos@ ...> wrote:
      >
      >
      > From: Mihai Galos <mihaigalos@ ...>
      > Subject: [booksbybibin, www.booksbybibin .tk] Re: having problem while communication through Bray's terminial
      > To: booksbybibin@ yahoogroups. com
      > Date: Wednesday, July 22, 2009, 11:41 AM
      >
      >
      >  
      >
      >
      >
      > It is easier to first compute a division first and a multiplication afterwards, as the number being multiplied is lower in this case after the division, rather than first computing a multiplication (large number) and afterwards doing the division (from a instruction- wise point of view).
      >
      > Needless to say, Stefan is probably right. I didn't get the same values for MYUBRR on my calculations: FOSC = 1Mhz and BAUD = 2400 yields 26.041 from my calculations, but somehow I think I'm missing something. Stefan?
      >
      > Regards,
      > Mihai G.
      >
      > --- In booksbybibin@ yahoogroups. com, "s.holder123@ ..." <s.holder123@ ....> wrote:
      > >
      > > Change Your definition to this
      > >
      > > define MYUBRR ((FOSC)/(16* BAUD))-1
      > >
      > > This forces the arithmetic precedence to the correct value, (near as dammit).
      > > The UBRR value = 259 this works out from the reciprocal equation as
      > > 2403.8Baud with the rounding error, this error is < 0.2%.
      > >
      > > The way you have defined it gives a UBBR value of 267, much higer error rate.
      > >
      > > You might want to consider what clock freq you use in future projects, certain crystal frequencies produce no errors for a number of baudrates..
      > >
      > > Regards
      > >
      > > --- In booksbybibin@ yahoogroups. com, "Mihai Galos" <mihaigalos@ > wrote:
      > > >
      > > > I'm not really sure the preprocessor computes a good value for the data rate to be stored in the UBRR register. use value 12(4800bps, 0.2% error rate, 1Mhz default internal clock) - see the datasheet
      > > >
      > > > Regards,
      > > > Mihai G.
      > > >
      > > >
      > > > --- In booksbybibin@ yahoogroups. com, "danial_1000" <danial_1000@ > wrote:
      > > > >
      > > > > hi all fellows,
      > > > > i actually new to avr and having very little knowledge about it ,i just started to learn i succesfuly completed my io programming chapter now i want communication with atmega8 controller and pc .i am using bray's terminal programme to send and receive data from pc to atmega8,but the problem is i don,t get back the data i send to the atmega8 but i received some garbage data ,when i transmit 'a' i get some thing else back i.e 'f' or any thing else.the baud rate of terminal window programme and atmega8 agrees for example i set 2400bps for both.i having a question in my mind that what type of data Bray's terminal sending to the atmega either its ascii,decimal, binary or hex.plz some help me i myself spent a lot of time but the problem is still there.my code is as follow.plzzzzzzzzzz zzzzzzzzzz helpppppppppppppppp pppppppppp.
      > > > > #define FOSC 1000000
      > > > > #define BAUD 2400
      > > > > #define MYUBRR FOSC/16/BAUD- 1
      > > > >
      > > > > void USART_Init(unsigned int ubrr);
      > > > > void USART_Transmit( unsigned char data);
      > > > > unsigned char USART_Receive( void);
      > > > >
      > > > >
      > > > > int main ( )
      > > > > {
      > > > >
      > > > > USART_Init(MYUBRR) ;
      > > > >
      > > > >
      > > > >
      > > > > while(1)
      > > > > {
      > > > > unsigned char data=USART_Receive( );
      > > > > USART_Transmit( unsigned char data);
      > > > >
      > > > > }
      > > > > }
      > > > > return 0;
      > > > > }
      > > > >
      > > > > void USART_Init(unsigned int ubrr)
      > > > > {
      > > > >
      > > > > //set baud rate//
      > > > >
      > > > > UBRRH=(unsigned char)(ubrr>> 8);
      > > > > UBRRL=(unsigned char)ubrr;
      > > > >
      > > > > //enable receiver and transmitter/ /
      > > > > UCSRB=(1<<RXEN) |(1<<TXEN) ;
      > > > >
      > > > > //set frame format: 8 data bits, 2 stop bits//
      > > > > UCSRC = (1<<URSEL)|( 0<<USBS)| (3<<UCSZ0) ;
      > > > > //UCSRC = (0<<USBS)|(3< <UCSZ0);
      > > > > }
      > > > >
      > > > >
      > > > > void USART_Transmit( unsigned char data)
      > > > > {
      > > > > //wait for the empty transmit buffer//
      > > > >
      > > > > while(!(UCSRA & (1<<UDRE) ))
      > > > > ;
      > > > >
      > > > > //the program will come here once the buffer is empty//
      > > > > //put data into the buffer, and then send the data//
      > > > > UDR=data;
      > > > > //int a=1;
      > > > > }
      > > > >
      > > > > unsigned char USART_Receive( void)
      > > > > {
      > > > >
      > > > > //wait for data to be received
      > > > > while(! (UCSRA & (1<<RXC)))
      > > > > ;
      > > > >
      > > > >
      > > > > return UDR;
      > > > > }
      > > > >
      > > >
      > >
      >


    • Saeed Ahmed
      hi, here im attaching the circuit diagarme as well as the board lay out,it is being design in orcade 15.7 ,plz check it carefully and if u find any bug plz
      Message 2 of 15 , Jul 26, 2009
      hi,
      here im attaching the circuit diagarme as well as the board lay out,it is being design in orcade 15.7 ,plz check it carefully and if u find any bug plz tell me.
      thanks
      dany

      --- On Fri, 7/24/09, akash deep <akashdeep007us@...> wrote:

      From: akash deep <akashdeep007us@...>
      Subject: Re: [booksbybibin,www.booksbybibin.tk] Re: having problem while communication through Bray's terminial
      To: booksbybibin@yahoogroups.com
      Date: Friday, July 24, 2009, 6:58 AM

       
      i should suggest u one thing that u recheck ur connection... install proper filter capacitors.. and u could upload the circuit diagram so that we can check for any anomalies..

      --- On Thu, 23/7/09, Saeed Ahmed <danial_1000@ yahoo.com> wrote:

      From: Saeed Ahmed <danial_1000@ yahoo.com>
      Subject: Re: [booksbybibin, www.booksbybibin .tk] Re: having problem while communication through Bray's terminial
      To: booksbybibin@ yahoogroups. com
      Date: Thursday, 23 July, 2009, 3:36 PM

       
      hi mihi,
      i did the same as u saying keeping in view the precedence of arithematic operator to calcute the correct value of UBRR after that i tried but i fail again .actually i design my own development board for atmega8 & 32.i think there is two possibilities the first one in that the setting of bray's terminal is incorrect  the second one is that my hardware is faulty but i check so many times it is ok.i also change max 232 and place it on bread board with the same programme runninig on the micro but invain.i having another problem also that i destroyed qty 06 atmega32 and 01 atmega8 during this exercise while programming through pony prog serial programmer .i don,t know why the micro's r going to death.plz if u have any conclusion after reading my history of programming the micro's plz help me.
      regards
      dany

      --- On Wed, 7/22/09, Mihai Galos <mihaigalos@yahoo. com> wrote:

      From: Mihai Galos <mihaigalos@yahoo. com>
      Subject: [booksbybibin, www.booksbybibin .tk] Re: having problem while communication through Bray's terminial
      To: booksbybibin@ yahoogroups. com
      Date: Wednesday, July 22, 2009, 11:41 AM

       
      It is easier to first compute a division first and a multiplication afterwards, as the number being multiplied is lower in this case after the division, rather than first computing a multiplication (large number) and afterwards doing the division (from a instruction- wise point of view).

      Needless to say, Stefan is probably right. I didn't get the same values for MYUBRR on my calculations: FOSC = 1Mhz and BAUD = 2400 yields 26.041 from my calculations, but somehow I think I'm missing something. Stefan?

      Regards,
      Mihai G.

      --- In booksbybibin@ yahoogroups. com, "s.holder123@ ..." <s.holder123@ ...> wrote:
      >
      > Change Your definition to this
      >
      > define MYUBRR ((FOSC)/(16* BAUD))-1
      >
      > This forces the arithmetic precedence to the correct value, (near as dammit).
      > The UBRR value = 259 this works out from the reciprocal equation as
      > 2403.8Baud with the rounding error, this error is < 0.2%.
      >
      > The way you have defined it gives a UBBR value of 267, much higer error rate.
      >
      > You might want to consider what clock freq you use in future projects, certain crystal frequencies produce no errors for a number of baudrates.
      >
      > Regards
      >
      > --- In booksbybibin@ yahoogroups. com, "Mihai Galos" <mihaigalos@ > wrote:
      > >
      > > I'm not really sure the preprocessor computes a good value for the data rate to be stored in the UBRR register. use value 12(4800bps, 0.2% error rate, 1Mhz default internal clock) - see the datasheet
      > >
      > > Regards,
      > > Mihai G.
      > >
      > >
      > > --- In booksbybibin@ yahoogroups. com, "danial_1000" <danial_1000@ > wrote:
      > > >
      > > > hi all fellows,
      > > > i actually new to avr and having very little knowledge about it ,i just started to learn i succesfuly completed my io programming chapter now i want communication with atmega8 controller and pc .i am using bray's terminal programme to send and receive data from pc to atmega8,but the problem is i don,t get back the data i send to the atmega8 but i received some garbage data ,when i transmit 'a' i get some thing else back i.e 'f' or any thing else.the baud rate of terminal window programme and atmega8 agrees for example i set 2400bps for both.i having a question in my mind that what type of data Bray's terminal sending to the atmega either its ascii,decimal, binary or hex.plz some help me i myself spent a lot of time but the problem is still there.my code is as follow.plzzzzzzzzzz zzzzzzzzzz helpppppppppppppppp pppppppppp.
      > > > #define FOSC 1000000
      > > > #define BAUD 2400
      > > > #define MYUBRR FOSC/16/BAUD- 1
      > > >
      > > > void USART_Init(unsigned int ubrr);
      > > > void USART_Transmit( unsigned char data);
      > > > unsigned char USART_Receive( void);
      > > >
      > > >
      > > > int main ( )
      > > > {
      > > >
      > > > USART_Init(MYUBRR) ;
      > > >
      > > >
      > > >
      > > > while(1)
      > > > {
      > > > unsigned char data=USART_Receive( );
      > > > USART_Transmit( unsigned char data);
      > > >
      > > > }
      > > > }
      > > > return 0;
      > > > }
      > > >
      > > > void USART_Init(unsigned int ubrr)
      > > > {
      > > >
      > > > //set baud rate//
      > > >
      > > > UBRRH=(unsigned char)(ubrr>> 8);
      > > > UBRRL=(unsigned char)ubrr;
      > > >
      > > > //enable receiver and transmitter/ /
      > > > UCSRB=(1<<RXEN) |(1<<TXEN) ;
      > > >
      > > > //set frame format: 8 data bits, 2 stop bits//
      > > > UCSRC = (1<<URSEL)|( 0<<USBS)| (3<<UCSZ0) ;
      > > > //UCSRC = (0<<USBS)|(3< <UCSZ0);
      > > > }
      > > >
      > > >
      > > > void USART_Transmit( unsigned char data)
      > > > {
      > > > //wait for the empty transmit buffer//
      > > >
      > > > while(!(UCSRA & (1<<UDRE) ))
      > > > ;
      > > >
      > > > //the program will come here once the buffer is empty//
      > > > //put data into the buffer, and then send the data//
      > > > UDR=data;
      > > > //int a=1;
      > > > }
      > > >
      > > > unsigned char USART_Receive( void)
      > > > {
      > > >
      > > > //wait for data to be received
      > > > while(! (UCSRA & (1<<RXC)))
      > > > ;
      > > >
      > > >
      > > > return UDR;
      > > > }
      > > >
      > >
      >




      Yahoo! recommends that you upgrade to the new and safer Internet Explorer 8.

    • Mihai Galos
      First of all, check your typing. My name is not mihi , not event mihai . It s Mihai. Learn it before you post. Go to my webpage:
      Message 3 of 15 , Jul 26, 2009
      • 0 Attachment
        First of all, check your typing. My name is not "mihi", not event "mihai". It's Mihai. Learn it before you post.

        Go to my webpage: http://www.mihaigalos.ro/work/Embedded/Simple/UART/readOn.html

        for a proper UART Library.

        Make sure the capacitors are of the same value and above 56nF. Cange them if necesary.


        --- In booksbybibin@yahoogroups.com, Saeed Ahmed <danial_1000@...> wrote:
        >
        > hi mihi,
        > i did the same as u saying keeping in view the precedence of arithematic operator to calcute the correct value of UBRR after that i tried but i fail again .actually i design my own development board for atmega8 & 32.i think there is two possibilities the first one in that the setting of bray's terminal is incorrect  the second one is that my hardware is faulty but i check so many times it is ok.i also change max 232 and place it on bread board with the same programme runninig on the micro but invain.i having another problem also that i destroyed qty 06 atmega32 and 01 atmega8 during this exercise while programming through pony prog serial programmer .i don,t know why the micro's r going to death.plz if u have any conclusion after reading my history of programming the micro's plz help me.
        > regards
        > dany
        >
        > --- On Wed, 7/22/09, Mihai Galos <mihaigalos@...> wrote:
        >
        >
        > From: Mihai Galos <mihaigalos@...>
        > Subject: [booksbybibin,www.booksbybibin.tk] Re: having problem while communication through Bray's terminial
        > To: booksbybibin@yahoogroups.com
        > Date: Wednesday, July 22, 2009, 11:41 AM
        >
        >
        >  
        >
        >
        >
        > It is easier to first compute a division first and a multiplication afterwards, as the number being multiplied is lower in this case after the division, rather than first computing a multiplication (large number) and afterwards doing the division (from a instruction- wise point of view).
        >
        > Needless to say, Stefan is probably right. I didn't get the same values for MYUBRR on my calculations: FOSC = 1Mhz and BAUD = 2400 yields 26.041 from my calculations, but somehow I think I'm missing something. Stefan?
        >
        > Regards,
        > Mihai G.
        >
        > --- In booksbybibin@ yahoogroups. com, "s.holder123@ ..." <s.holder123@ ...> wrote:
        > >
        > > Change Your definition to this
        > >
        > > define MYUBRR ((FOSC)/(16* BAUD))-1
        > >
        > > This forces the arithmetic precedence to the correct value, (near as dammit).
        > > The UBRR value = 259 this works out from the reciprocal equation as
        > > 2403.8Baud with the rounding error, this error is < 0.2%.
        > >
        > > The way you have defined it gives a UBBR value of 267, much higer error rate.
        > >
        > > You might want to consider what clock freq you use in future projects, certain crystal frequencies produce no errors for a number of baudrates.
        > >
        > > Regards
        > >
        > > --- In booksbybibin@ yahoogroups. com, "Mihai Galos" <mihaigalos@ > wrote:
        > > >
        > > > I'm not really sure the preprocessor computes a good value for the data rate to be stored in the UBRR register. use value 12(4800bps, 0.2% error rate, 1Mhz default internal clock) - see the datasheet
        > > >
        > > > Regards,
        > > > Mihai G.
        > > >
        > > >
        > > > --- In booksbybibin@ yahoogroups. com, "danial_1000" <danial_1000@ > wrote:
        > > > >
        > > > > hi all fellows,
        > > > > i actually new to avr and having very little knowledge about it ,i just started to learn i succesfuly completed my io programming chapter now i want communication with atmega8 controller and pc .i am using bray's terminal programme to send and receive data from pc to atmega8,but the problem is i don,t get back the data i send to the atmega8 but i received some garbage data ,when i transmit 'a' i get some thing else back i.e 'f' or any thing else.the baud rate of terminal window programme and atmega8 agrees for example i set 2400bps for both.i having a question in my mind that what type of data Bray's terminal sending to the atmega either its ascii,decimal, binary or hex.plz some help me i myself spent a lot of time but the problem is still there.my code is as follow.plzzzzzzzzzz zzzzzzzzzz helpppppppppppppppp pppppppppp.
        > > > > #define FOSC 1000000
        > > > > #define BAUD 2400
        > > > > #define MYUBRR FOSC/16/BAUD- 1
        > > > >
        > > > > void USART_Init(unsigned int ubrr);
        > > > > void USART_Transmit( unsigned char data);
        > > > > unsigned char USART_Receive( void);
        > > > >
        > > > >
        > > > > int main ( )
        > > > > {
        > > > >
        > > > > USART_Init(MYUBRR) ;
        > > > >
        > > > >
        > > > >
        > > > > while(1)
        > > > > {
        > > > > unsigned char data=USART_Receive( );
        > > > > USART_Transmit( unsigned char data);
        > > > >
        > > > > }
        > > > > }
        > > > > return 0;
        > > > > }
        > > > >
        > > > > void USART_Init(unsigned int ubrr)
        > > > > {
        > > > >
        > > > > //set baud rate//
        > > > >
        > > > > UBRRH=(unsigned char)(ubrr>> 8);
        > > > > UBRRL=(unsigned char)ubrr;
        > > > >
        > > > > //enable receiver and transmitter/ /
        > > > > UCSRB=(1<<RXEN) |(1<<TXEN) ;
        > > > >
        > > > > //set frame format: 8 data bits, 2 stop bits//
        > > > > UCSRC = (1<<URSEL)|( 0<<USBS)| (3<<UCSZ0) ;
        > > > > //UCSRC = (0<<USBS)|(3< <UCSZ0);
        > > > > }
        > > > >
        > > > >
        > > > > void USART_Transmit( unsigned char data)
        > > > > {
        > > > > //wait for the empty transmit buffer//
        > > > >
        > > > > while(!(UCSRA & (1<<UDRE) ))
        > > > > ;
        > > > >
        > > > > //the program will come here once the buffer is empty//
        > > > > //put data into the buffer, and then send the data//
        > > > > UDR=data;
        > > > > //int a=1;
        > > > > }
        > > > >
        > > > > unsigned char USART_Receive( void)
        > > > > {
        > > > >
        > > > > //wait for data to be received
        > > > > while(! (UCSRA & (1<<RXC)))
        > > > > ;
        > > > >
        > > > >
        > > > > return UDR;
        > > > > }
        > > > >
        > > >
        > >
        >
      • s.holder123@btinternet.com
        Me thinks a fuse problem may be the culprit, probably in the clock fuse bits, or the cystal circuit you have is not functioning properly, try setting the clock
        Message 4 of 15 , Jul 27, 2009
        • 0 Attachment
          Me thinks a fuse problem may be the culprit, probably in the clock fuse bits, or the cystal circuit you have is not functioning properly, try setting the clock fuse bits to the largest sart up time value.

          As far the calculation in the define for baud rate, the calculation is done at compile time not run time, so that the value is calculated as a constant in the program, the division - multiplication problem doesn't really occur.

          Any chance of posting you circuit ?

          Regards

          --- In booksbybibin@yahoogroups.com, "Mihai Galos" <mihaigalos@...> wrote:
          >
          > What are the values for the capacitor you are using for the max232? What is the actual value written in the UBRR? (set it manually #define datarate_value <a number>). How many data bits are you using (7 or 8).how many stop bits(1 or 2). What is the parity?
          >
          >
          > Regards,
          > Mihai
          > --- In booksbybibin@yahoogroups.com, Saeed Ahmed <danial_1000@> wrote:
          > >
          > > hi mihi,
          > > i did the same as u saying keeping in view the precedence of arithematic operator to calcute the correct value of UBRR after that i tried but i fail again .actually i design my own development board for atmega8 & 32.i think there is two possibilities the first one in that the setting of bray's terminal is incorrect  the second one is that my hardware is faulty but i check so many times it is ok.i also change max 232 and place it on bread board with the same programme runninig on the micro but invain.i having another problem also that i destroyed qty 06 atmega32 and 01 atmega8 during this exercise while programming through pony prog serial programmer .i don,t know why the micro's r going to death.plz if u have any conclusion after reading my history of programming the micro's plz help me.
          > > regards
          > > dany
          > >
          > > --- On Wed, 7/22/09, Mihai Galos <mihaigalos@> wrote:
          > >
          > >
          > > From: Mihai Galos <mihaigalos@>
          > > Subject: [booksbybibin,www.booksbybibin.tk] Re: having problem while communication through Bray's terminial
          > > To: booksbybibin@yahoogroups.com
          > > Date: Wednesday, July 22, 2009, 11:41 AM
          > >
          > >
          > >  
          > >
          > >
          > >
          > > It is easier to first compute a division first and a multiplication afterwards, as the number being multiplied is lower in this case after the division, rather than first computing a multiplication (large number) and afterwards doing the division (from a instruction- wise point of view).
          > >
          > > Needless to say, Stefan is probably right. I didn't get the same values for MYUBRR on my calculations: FOSC = 1Mhz and BAUD = 2400 yields 26.041 from my calculations, but somehow I think I'm missing something. Stefan?
          > >
          > > Regards,
          > > Mihai G.
          > >
          > > --- In booksbybibin@ yahoogroups. com, "s.holder123@ ..." <s.holder123@ ...> wrote:
          > > >
          > > > Change Your definition to this
          > > >
          > > > define MYUBRR ((FOSC)/(16* BAUD))-1
          > > >
          > > > This forces the arithmetic precedence to the correct value, (near as dammit).
          > > > The UBRR value = 259 this works out from the reciprocal equation as
          > > > 2403.8Baud with the rounding error, this error is < 0.2%.
          > > >
          > > > The way you have defined it gives a UBBR value of 267, much higer error rate.
          > > >
          > > > You might want to consider what clock freq you use in future projects, certain crystal frequencies produce no errors for a number of baudrates.
          > > >
          > > > Regards
          > > >
          > > > --- In booksbybibin@ yahoogroups. com, "Mihai Galos" <mihaigalos@ > wrote:
          > > > >
          > > > > I'm not really sure the preprocessor computes a good value for the data rate to be stored in the UBRR register. use value 12(4800bps, 0.2% error rate, 1Mhz default internal clock) - see the datasheet
          > > > >
          > > > > Regards,
          > > > > Mihai G.
          > > > >
          > > > >
          > > > > --- In booksbybibin@ yahoogroups. com, "danial_1000" <danial_1000@ > wrote:
          > > > > >
          > > > > > hi all fellows,
          > > > > > i actually new to avr and having very little knowledge about it ,i just started to learn i succesfuly completed my io programming chapter now i want communication with atmega8 controller and pc .i am using bray's terminal programme to send and receive data from pc to atmega8,but the problem is i don,t get back the data i send to the atmega8 but i received some garbage data ,when i transmit 'a' i get some thing else back i.e 'f' or any thing else.the baud rate of terminal window programme and atmega8 agrees for example i set 2400bps for both.i having a question in my mind that what type of data Bray's terminal sending to the atmega either its ascii,decimal, binary or hex.plz some help me i myself spent a lot of time but the problem is still there.my code is as follow.plzzzzzzzzzz zzzzzzzzzz helpppppppppppppppp pppppppppp.
          > > > > > #define FOSC 1000000
          > > > > > #define BAUD 2400
          > > > > > #define MYUBRR FOSC/16/BAUD- 1
          > > > > >
          > > > > > void USART_Init(unsigned int ubrr);
          > > > > > void USART_Transmit( unsigned char data);
          > > > > > unsigned char USART_Receive( void);
          > > > > >
          > > > > >
          > > > > > int main ( )
          > > > > > {
          > > > > >
          > > > > > USART_Init(MYUBRR) ;
          > > > > >
          > > > > >
          > > > > >
          > > > > > while(1)
          > > > > > {
          > > > > > unsigned char data=USART_Receive( );
          > > > > > USART_Transmit( unsigned char data);
          > > > > >
          > > > > > }
          > > > > > }
          > > > > > return 0;
          > > > > > }
          > > > > >
          > > > > > void USART_Init(unsigned int ubrr)
          > > > > > {
          > > > > >
          > > > > > //set baud rate//
          > > > > >
          > > > > > UBRRH=(unsigned char)(ubrr>> 8);
          > > > > > UBRRL=(unsigned char)ubrr;
          > > > > >
          > > > > > //enable receiver and transmitter/ /
          > > > > > UCSRB=(1<<RXEN) |(1<<TXEN) ;
          > > > > >
          > > > > > //set frame format: 8 data bits, 2 stop bits//
          > > > > > UCSRC = (1<<URSEL)|( 0<<USBS)| (3<<UCSZ0) ;
          > > > > > //UCSRC = (0<<USBS)|(3< <UCSZ0);
          > > > > > }
          > > > > >
          > > > > >
          > > > > > void USART_Transmit( unsigned char data)
          > > > > > {
          > > > > > //wait for the empty transmit buffer//
          > > > > >
          > > > > > while(!(UCSRA & (1<<UDRE) ))
          > > > > > ;
          > > > > >
          > > > > > //the program will come here once the buffer is empty//
          > > > > > //put data into the buffer, and then send the data//
          > > > > > UDR=data;
          > > > > > //int a=1;
          > > > > > }
          > > > > >
          > > > > > unsigned char USART_Receive( void)
          > > > > > {
          > > > > >
          > > > > > //wait for data to be received
          > > > > > while(! (UCSRA & (1<<RXC)))
          > > > > > ;
          > > > > >
          > > > > >
          > > > > > return UDR;
          > > > > > }
          > > > > >
          > > > >
          > > >
          > >
          >
        • Mihai Galos
          ARE THE CAPACITORS ALL OF THE SAME VALUE ?!?!?!?! - I use 56nF. Remember, this can and will corrupt data over UART ! Regards.
          Message 5 of 15 , Jul 27, 2009
          • 0 Attachment
            ARE THE CAPACITORS ALL OF THE SAME VALUE ?!?!?!?! - I use 56nF.

            Remember, this can and will corrupt data over UART !

            Regards.

            --- In booksbybibin@yahoogroups.com, Saeed Ahmed <danial_1000@...> wrote:
            >
            > hello,
            > first i use 1uf electrolytic then i change it to 10uf  electrolytic then change it 10uf tantalum and i again change it to 22uf electroytic.the baud rate i using is 2400 i also try with 19200 using internal 1mhz oscillator and 8mhz .the data bits are 8 ,no parity and 1 stop bit.i still having problem .
            > thanking u,
            > dany
            >
            > --- On Fri, 7/24/09, Mihai Galos <mihaigalos@...> wrote:
            >
            >
            > From: Mihai Galos <mihaigalos@...>
            > Subject: [booksbybibin,www.booksbybibin.tk] Re: having problem while communication through Bray's terminial
            > To: booksbybibin@yahoogroups.com
            > Date: Friday, July 24, 2009, 10:19 PM
            >
            >
            >  
            >
            >
            >
            > What are the values for the capacitor you are using for the max232? What is the actual value written in the UBRR? (set it manually #define datarate_value <a number>). How many data bits are you using (7 or 8).how many stop bits(1 or 2). What is the parity?
            >
            > Regards,
            > Mihai
            > --- In booksbybibin@ yahoogroups. com, Saeed Ahmed <danial_1000@ ...> wrote:
            > >
            > > hi mihi,
            > > i did the same as u saying keeping in view the precedence of arithematic operator to calcute the correct value of UBRR after that i tried but i fail again .actually i design my own development board for atmega8 & 32.i think there is two possibilities the first one in that the setting of bray's terminal is incorrect  the second one is that my hardware is faulty but i check so many times it is ok.i also change max 232 and place it on bread board with the same programme runninig on the micro but invain.i having another problem also that i destroyed qty 06 atmega32 and 01 atmega8 during this exercise while programming through pony prog serial programmer .i don,t know why the micro's r going to death.plz if u have any conclusion after reading my history of programming the micro's plz help me.
            > > regards
            > > dany
            > >
            > > --- On Wed, 7/22/09, Mihai Galos <mihaigalos@ ...> wrote:
            > >
            > >
            > > From: Mihai Galos <mihaigalos@ ...>
            > > Subject: [booksbybibin, www.booksbybibin .tk] Re: having problem while communication through Bray's terminial
            > > To: booksbybibin@ yahoogroups. com
            > > Date: Wednesday, July 22, 2009, 11:41 AM
            > >
            > >
            > >  
            > >
            > >
            > >
            > > It is easier to first compute a division first and a multiplication afterwards, as the number being multiplied is lower in this case after the division, rather than first computing a multiplication (large number) and afterwards doing the division (from a instruction- wise point of view).
            > >
            > > Needless to say, Stefan is probably right. I didn't get the same values for MYUBRR on my calculations: FOSC = 1Mhz and BAUD = 2400 yields 26.041 from my calculations, but somehow I think I'm missing something. Stefan?
            > >
            > > Regards,
            > > Mihai G.
            > >
            > > --- In booksbybibin@ yahoogroups. com, "s.holder123@ ..." <s.holder123@ ....> wrote:
            > > >
            > > > Change Your definition to this
            > > >
            > > > define MYUBRR ((FOSC)/(16* BAUD))-1
            > > >
            > > > This forces the arithmetic precedence to the correct value, (near as dammit).
            > > > The UBRR value = 259 this works out from the reciprocal equation as
            > > > 2403.8Baud with the rounding error, this error is < 0.2%.
            > > >
            > > > The way you have defined it gives a UBBR value of 267, much higer error rate.
            > > >
            > > > You might want to consider what clock freq you use in future projects, certain crystal frequencies produce no errors for a number of baudrates.
            > > >
            > > > Regards
            > > >
            > > > --- In booksbybibin@ yahoogroups. com, "Mihai Galos" <mihaigalos@ > wrote:
            > > > >
            > > > > I'm not really sure the preprocessor computes a good value for the data rate to be stored in the UBRR register. use value 12(4800bps, 0.2% error rate, 1Mhz default internal clock) - see the datasheet
            > > > >
            > > > > Regards,
            > > > > Mihai G.
            > > > >
            > > > >
            > > > > --- In booksbybibin@ yahoogroups. com, "danial_1000" <danial_1000@ > wrote:
            > > > > >
            > > > > > hi all fellows,
            > > > > > i actually new to avr and having very little knowledge about it ,i just started to learn i succesfuly completed my io programming chapter now i want communication with atmega8 controller and pc .i am using bray's terminal programme to send and receive data from pc to atmega8,but the problem is i don,t get back the data i send to the atmega8 but i received some garbage data ,when i transmit 'a' i get some thing else back i.e 'f' or any thing else.the baud rate of terminal window programme and atmega8 agrees for example i set 2400bps for both.i having a question in my mind that what type of data Bray's terminal sending to the atmega either its ascii,decimal, binary or hex.plz some help me i myself spent a lot of time but the problem is still there.my code is as follow.plzzzzzzzzzz zzzzzzzzzz helpppppppppppppppp pppppppppp.
            > > > > > #define FOSC 1000000
            > > > > > #define BAUD 2400
            > > > > > #define MYUBRR FOSC/16/BAUD- 1
            > > > > >
            > > > > > void USART_Init(unsigned int ubrr);
            > > > > > void USART_Transmit( unsigned char data);
            > > > > > unsigned char USART_Receive( void);
            > > > > >
            > > > > >
            > > > > > int main ( )
            > > > > > {
            > > > > >
            > > > > > USART_Init(MYUBRR) ;
            > > > > >
            > > > > >
            > > > > >
            > > > > > while(1)
            > > > > > {
            > > > > > unsigned char data=USART_Receive( );
            > > > > > USART_Transmit( unsigned char data);
            > > > > >
            > > > > > }
            > > > > > }
            > > > > > return 0;
            > > > > > }
            > > > > >
            > > > > > void USART_Init(unsigned int ubrr)
            > > > > > {
            > > > > >
            > > > > > //set baud rate//
            > > > > >
            > > > > > UBRRH=(unsigned char)(ubrr>> 8);
            > > > > > UBRRL=(unsigned char)ubrr;
            > > > > >
            > > > > > //enable receiver and transmitter/ /
            > > > > > UCSRB=(1<<RXEN) |(1<<TXEN) ;
            > > > > >
            > > > > > //set frame format: 8 data bits, 2 stop bits//
            > > > > > UCSRC = (1<<URSEL)|( 0<<USBS)| (3<<UCSZ0) ;
            > > > > > //UCSRC = (0<<USBS)|(3< <UCSZ0);
            > > > > > }
            > > > > >
            > > > > >
            > > > > > void USART_Transmit( unsigned char data)
            > > > > > {
            > > > > > //wait for the empty transmit buffer//
            > > > > >
            > > > > > while(!(UCSRA & (1<<UDRE) ))
            > > > > > ;
            > > > > >
            > > > > > //the program will come here once the buffer is empty//
            > > > > > //put data into the buffer, and then send the data//
            > > > > > UDR=data;
            > > > > > //int a=1;
            > > > > > }
            > > > > >
            > > > > > unsigned char USART_Receive( void)
            > > > > > {
            > > > > >
            > > > > > //wait for data to be received
            > > > > > while(! (UCSRA & (1<<RXC)))
            > > > > > ;
            > > > > >
            > > > > >
            > > > > > return UDR;
            > > > > > }
            > > > > >
            > > > >
            > > >
            > >
            >
          • Saeed Ahmed
            hi, last time i put directly the ubrr value in the USART_init ();funfction argument and it is ok.i select the value from the datasheet for baud rate 2400 and 1
            Message 6 of 15 , Jul 27, 2009
            • 0 Attachment
              hi,
              last time i put directly the ubrr value in the USART_init ();funfction argument and it is ok.i select the value from the datasheet for baud rate 2400 and 1 mhz fosc.i upload my complete design including schematic as well as board layout including gerber . 
              regards
              dany

              --- On Mon, 7/27/09, s.holder123@... <s.holder123@...> wrote:

              From: s.holder123@... <s.holder123@...>
              Subject: [booksbybibin,www.booksbybibin.tk] Re: having problem while communication through Bray's terminial
              To: booksbybibin@yahoogroups.com
              Date: Monday, July 27, 2009, 8:32 AM

               
              Me thinks a fuse problem may be the culprit, probably in the clock fuse bits, or the cystal circuit you have is not functioning properly, try setting the clock fuse bits to the largest sart up time value.

              As far the calculation in the define for baud rate, the calculation is done at compile time not run time, so that the value is calculated as a constant in the program, the division - multiplication problem doesn't really occur.

              Any chance of posting you circuit ?

              Regards

              --- In booksbybibin@ yahoogroups. com, "Mihai Galos" <mihaigalos@ ...> wrote:
              >
              > What are the values for the capacitor you are using for the max232? What is the actual value written in the UBRR? (set it manually #define datarate_value <a number>). How many data bits are you using (7 or 8).how many stop bits(1 or 2). What is the parity?
              >
              >
              > Regards,
              > Mihai
              > --- In booksbybibin@ yahoogroups. com, Saeed Ahmed <danial_1000@ > wrote:
              > >
              > > hi mihi,
              > > i did the same as u saying keeping in view the precedence of arithematic operator to calcute the correct value of UBRR after that i tried but i fail again .actually i design my own development board for atmega8 & 32.i think there is two possibilities the first one in that the setting of bray's terminal is incorrect  the second one is that my hardware is faulty but i check so many times it is ok.i also change max 232 and place it on bread board with the same programme runninig on the micro but invain.i having another problem also that i destroyed qty 06 atmega32 and 01 atmega8 during this exercise while programming through pony prog serial programmer .i don,t know why the micro's r going to death.plz if u have any conclusion after reading my history of programming the micro's plz help me.
              > > regards
              > > dany
              > >
              > > --- On Wed, 7/22/09, Mihai Galos <mihaigalos@ > wrote:
              > >
              > >
              > > From: Mihai Galos <mihaigalos@ >
              > > Subject: [booksbybibin, www.booksbybibin .tk] Re: having problem while communication through Bray's terminial
              > > To: booksbybibin@ yahoogroups. com
              > > Date: Wednesday, July 22, 2009, 11:41 AM
              > >
              > >
              > >  
              > >
              > >
              > >
              > > It is easier to first compute a division first and a multiplication afterwards, as the number being multiplied is lower in this case after the division, rather than first computing a multiplication (large number) and afterwards doing the division (from a instruction- wise point of view).
              > >
              > > Needless to say, Stefan is probably right. I didn't get the same values for MYUBRR on my calculations: FOSC = 1Mhz and BAUD = 2400 yields 26.041 from my calculations, but somehow I think I'm missing something. Stefan?
              > >
              > > Regards,
              > > Mihai G.
              > >
              > > --- In booksbybibin@ yahoogroups. com, "s.holder123@ ..." <s.holder123@ ...> wrote:
              > > >
              > > > Change Your definition to this
              > > >
              > > > define MYUBRR ((FOSC)/(16* BAUD))-1
              > > >
              > > > This forces the arithmetic precedence to the correct value, (near as dammit).
              > > > The UBRR value = 259 this works out from the reciprocal equation as
              > > > 2403.8Baud with the rounding error, this error is < 0.2%.
              > > >
              > > > The way you have defined it gives a UBBR value of 267, much higer error rate.
              > > >
              > > > You might want to consider what clock freq you use in future projects, certain crystal frequencies produce no errors for a number of baudrates.
              > > >
              > > > Regards
              > > >
              > > > --- In booksbybibin@ yahoogroups. com, "Mihai Galos" <mihaigalos@ > wrote:
              > > > >
              > > > > I'm not really sure the preprocessor computes a good value for the data rate to be stored in the UBRR register. use value 12(4800bps, 0.2% error rate, 1Mhz default internal clock) - see the datasheet
              > > > >
              > > > > Regards,
              > > > > Mihai G.
              > > > >
              > > > >
              > > > > --- In booksbybibin@ yahoogroups. com, "danial_1000" <danial_1000@ > wrote:
              > > > > >
              > > > > > hi all fellows,
              > > > > > i actually new to avr and having very little knowledge about it ,i just started to learn i succesfuly completed my io programming chapter now i want communication with atmega8 controller and pc .i am using bray's terminal programme to send and receive data from pc to atmega8,but the problem is i don,t get back the data i send to the atmega8 but i received some garbage data ,when i transmit 'a' i get some thing else back i.e 'f' or any thing else.the baud rate of terminal window programme and atmega8 agrees for example i set 2400bps for both.i having a question in my mind that what type of data Bray's terminal sending to the atmega either its ascii,decimal, binary or hex.plz some help me i myself spent a lot of time but the problem is still there.my code is as follow.plzzzzzzzzzz zzzzzzzzzz helpppppppppppppppp pppppppppp.
              > > > > > #define FOSC 1000000
              > > > > > #define BAUD 2400
              > > > > > #define MYUBRR FOSC/16/BAUD- 1
              > > > > >
              > > > > > void USART_Init(unsigned int ubrr);
              > > > > > void USART_Transmit( unsigned char data);
              > > > > > unsigned char USART_Receive( void);
              > > > > >
              > > > > >
              > > > > > int main ( )
              > > > > > {
              > > > > >
              > > > > > USART_Init(MYUBRR) ;
              > > > > >
              > > > > >
              > > > > >
              > > > > > while(1)
              > > > > > {
              > > > > > unsigned char data=USART_Receive( );
              > > > > > USART_Transmit( unsigned char data);
              > > > > >
              > > > > > }
              > > > > > }
              > > > > > return 0;
              > > > > > }
              > > > > >
              > > > > > void USART_Init(unsigned int ubrr)
              > > > > > {
              > > > > >
              > > > > > //set baud rate//
              > > > > >
              > > > > > UBRRH=(unsigned char)(ubrr>> 8);
              > > > > > UBRRL=(unsigned char)ubrr;
              > > > > >
              > > > > > //enable receiver and transmitter/ /
              > > > > > UCSRB=(1<<RXEN) |(1<<TXEN) ;
              > > > > >
              > > > > > //set frame format: 8 data bits, 2 stop bits//
              > > > > > UCSRC = (1<<URSEL)|( 0<<USBS)| (3<<UCSZ0) ;
              > > > > > //UCSRC = (0<<USBS)|(3< <UCSZ0);
              > > > > > }
              > > > > >
              > > > > >
              > > > > > void USART_Transmit( unsigned char data)
              > > > > > {
              > > > > > //wait for the empty transmit buffer//
              > > > > >
              > > > > > while(!(UCSRA & (1<<UDRE) ))
              > > > > > ;
              > > > > >
              > > > > > //the program will come here once the buffer is empty//
              > > > > > //put data into the buffer, and then send the data//
              > > > > > UDR=data;
              > > > > > //int a=1;
              > > > > > }
              > > > > >
              > > > > > unsigned char USART_Receive( void)
              > > > > > {
              > > > > >
              > > > > > //wait for data to be received
              > > > > > while(! (UCSRA & (1<<RXC)))
              > > > > > ;
              > > > > >
              > > > > >
              > > > > > return UDR;
              > > > > > }
              > > > > >
              > > > >
              > > >
              > >
              >


            Your message has been successfully submitted and would be delivered to recipients shortly.