This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

dose atmel micro hase buge?

I'am working with at91sam7x256 and in my program the usart interrupt dosen't work correctly ! I communicatinon with atmel but it isn't fix yet.

thise is my program...pleas help me

www.4shared.com/.../usart16__2_.html

my mail :salehi.elc@gmail.com

Parents
  • Do you honestly find that clear & easy to read?!

    When you're struggling with tricky problms like this, the last thing you need is a scruffy layout to make things harder!

    So, here's your ISR:

    void Usart0IrqHandler(void){
    
       int statuse;
    
       statuse = pUsart0->US_CSR;
       test    = pUsart0->US_RHR;
    
       pUsart0->US_THR = test;
    
       if( AT91F_US_TxReady(AT91C_BASE_US0)==0 )
          do{
            }while( AT91F_US_TxReady(AT91C_BASE_US0)==1 );
    
       AT91C_BASE_AIC->AIC_EOICR = 0;
       return ;
    }
    

    The first thing you need to do is to provide comments to describe what you're doing and - more importantly - why.

    Why is 'test' global?

    Is a 'while' loop really a good idea inside an ISR?

Reply
  • Do you honestly find that clear & easy to read?!

    When you're struggling with tricky problms like this, the last thing you need is a scruffy layout to make things harder!

    So, here's your ISR:

    void Usart0IrqHandler(void){
    
       int statuse;
    
       statuse = pUsart0->US_CSR;
       test    = pUsart0->US_RHR;
    
       pUsart0->US_THR = test;
    
       if( AT91F_US_TxReady(AT91C_BASE_US0)==0 )
          do{
            }while( AT91F_US_TxReady(AT91C_BASE_US0)==1 );
    
       AT91C_BASE_AIC->AIC_EOICR = 0;
       return ;
    }
    

    The first thing you need to do is to provide comments to describe what you're doing and - more importantly - why.

    Why is 'test' global?

    Is a 'while' loop really a good idea inside an ISR?

Children