avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] How to get the mega8's RXD pin level?


From: whiteman
Subject: Re: [avr-gcc-list] How to get the mega8's RXD pin level?
Date: Sat, 26 Jun 2004 15:53:18 +0800

hi!
   Of course, I am sure that I use PIND register to read the pin value. I also 
make the pull-up resistor available. But the Atmega8 is hang. So how can I do ??
        

======= 2004-06-25 22:51:00 :=======

>On 2004/06/25 at 03:20 whiteman wrote:
>
>>hi,all!
>>
>>I have a project about DMX512. I have put the PORTD0(RXD)&PORTD1(TXD) to
>>the USART function. In my code, I want to check the
>>
>>RXD pin LEVEL without change the RXD pin to NORMAL I/O function. I
>>download my code and run, but the ATmega8 is hang.  Later,
>>
>>I connet the another I/O pin(i.e. PORTC5) to RXD pin, and check the
>>PORTC5. But I get the same result, the ATmega8 is hang. How can I do?
>>thanks.
>>Here is my partion of code:
>>
>>
>>void USART_Init(uint16_t baud)
>>{
>>      cli();  
>>      UBRRH = baud >> 8;
>>      UBRRL = baud;   //
>>      UCSRA  = 1 << U2X;      //
>>      UCSRB = (1 << RXCIE)|(1 << TXCIE)|(1 << RXEN)|(1 << TXEN);//
>>      UCSRC = (1 << URSEL)|(1 << USBS)|(0 << UCSZ0);//
>>      sei();  
>>}
>>
>>int main(void)
>>{
>>      PORTD |= 0x01;  //Enable the RXD pull-up resistor
>>      USART_Init(4);
>>      while(1)
>>      {
>>              if(P_RXD)
>>              {
>>                      Task1();
>>              }
>>              else
>>              {
>>                      Task2();
>>              }
>>
>>      }
>>}
>>
>
>Hi,
>
>Remember to use the PIND port to read the pin value. If you use PORTD for this
>you only read whether the pull-up is inabled or not.
>
>Regards
>   Anton Erasmus
>
>
>
>.

= = = = = = = = = = = = = = = = = = = =
                        
Best Regard
                                
        whiteman
address@hidden
          2004-06-26







reply via email to

[Prev in Thread] Current Thread [Next in Thread]