[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [avr-gcc-list] Problems with ATMEGA8 USART
From: |
Nigel Winterbottom |
Subject: |
RE: [avr-gcc-list] Problems with ATMEGA8 USART |
Date: |
Wed, 17 Aug 2005 09:36:28 +0100 |
David Kelly wrote:
Thats not quite what I meant. I do enable the IRQ for each character.
The issue was in finding which UART needed to be enabled without
enabling one which would then serve an empty event. Here is the exact
code I wrote back in December. Today I'd probably bracket the
insertion and masking with cli()/sei().
int
uputc( int c, Uart *fp )
----------------------------
Aaah!
OK!
My Transmit function is:
//TxChar Add a Character to USART transmit buffer. Return true if error.
//---------------------------------------------------------------
bool TxChar (unsigned char uart_no, char data)
{
struct uartdesc_s *pUD; //Pointer to Uart Descriptor 0 or 1
struct uartflag_s copyUartF; //Temporary copy of UartF
unsigned char *pBuff; //Pointer to TxBuff0 or TxBuff1
unsigned char txlen;
bool retval;
if (uart_no==0)
{ pUD=&UD0; pBuff=TxBuff0; txlen=TXLEN0; }
else { pUD=&UD1; pBuff=TxBuff1; txlen=TXLEN1; }
cli(); //disable global interrupts
copyUartF=pUD->UartF; //Temporary copy of UartF
....... etc. etc.
//Restart COMMS
if (uart_no==0)
UCSRB |= 1<<UDRIE; //Enable Tx
buffer empty IRQ to Restart COMMS
else{
....... etc. etc.
pUD->UartF=copyUartF;
sei(); //Re-enable
global interrupts
return (retval);
}
I have direct knowledge of which USART I am dealing with, therefore I
couldn't see your problem.
Regards
Nigel
- Re: [avr-gcc-list] Problems with ATMEGA8 USART, (continued)
Re: [avr-gcc-list] Problems with ATMEGA8 USART, Hugo González Monteverde, 2005/08/13
RE: [avr-gcc-list] Problems with ATMEGA8 USART, Nigel Winterbottom, 2005/08/16
FW: [avr-gcc-list] Problems with ATMEGA8 USART, Larry Barello, 2005/08/16
RE: [avr-gcc-list] Problems with ATMEGA8 USART,
Nigel Winterbottom <=