[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-gcc-list] How to get the mega8's RXD pin level?
From: |
whiteman |
Subject: |
[avr-gcc-list] How to get the mega8's RXD pin level? |
Date: |
Fri, 25 Jun 2004 15:20:59 +0800 |
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();
}
}
}
best regard!
whiteman
address@hidden
2004-06-25
- [avr-gcc-list] How to get the mega8's RXD pin level?,
whiteman <=