[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-gcc-list] USART Tx Interrupts problem.
From: |
Yuri Vignoli |
Subject: |
[avr-gcc-list] USART Tx Interrupts problem. |
Date: |
Mon, 24 Jan 2005 13:25:50 +0100 |
User-agent: |
Mozilla Thunderbird 0.9 (Windows/20041103) |
I'm using an ATMEGA8L
I write a interrupt routine for managing Data Register Empty interrupt,
but it's not called after i wrote the first char in UDR, it sends only
this char.
This is the send function
BOOL com_send(u8_t* pBuf, u8_t nChar)
{
/* control if the buffer is full */
if .....
{
return FALSE;
}
/*--- copy characters in buffer ---*/
for( ..... )
{
/*--- set correct index for circular buffer ---*/
......
}
/*--- disable interrupts for managing shared data which modify on
interrupt ---*/
ios_di();
/* buffer not empty */
if ....
{
/* enable interrupts */
UCSRB |= (COM_UDRIE | COM_TXCIE);
/* write buffer char on UDR */
UDR = .....
/*--- set correct index for circular buffer and increments number
of char to send strored in buffer ---*/
.....
}
else
{
/* incrementes number of char to send strored in buffer*/
}
/* reenable interrupts */
ios_ei();
return TRUE;
}
The interrupt routine is so declared.
void DataRegHandler() __attribute__ ((interrupt));
void DataRegHandler()
{
/* turn a led on */
.....
/* get the next char on shared buffer */
/* control if i have other chars to send, if no clear UDRIE */
if ....
{
.........
}
}
The routine address is on the right position of inerrupt vector and
interrputs on TXCIE and UDRIE are set in send function.
Regards,
Yuri Vignoli.
- [avr-gcc-list] USART Tx Interrupts problem.,
Yuri Vignoli <=