r brooks

SCI recieve interrupt

Discussion created by r brooks on Mar 12, 2008
Latest reply on Apr 1, 2008 by Daniel Lundin
We are working with the Adapt9s12XD512.  The interrupt for the SCI receive never happens when we send data to it. The input is a start byte, then 10 hex numbers(we only need one of them) and an end byte. the data is definitely being sent, but our interrupt never seems to occur.  we seem to be able to pull random data from the SCI1DRL register after the fact.  here is our code(isr_vector.c is attatched):
 
 
char _buffer[12] = {                                       // Creating a buffer
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
#pragma CODE_SEG __NEAR_SEG NON_BANKED
void storeByte( char _byte ) {
  _buffer[ g_idx ] = _byte;
  g_idx++;
}

#pragma CODE_SEG __NEAR_SEG NON_BANKED
interrupt void RCVIR_ISR()
{
  g_tmp = SCI1SR1; 
  _irmsg = SCI1DRL;
  storeByte( _irmsg );tr
}
unsigned char g_temp = 0x00;
void main(void) {  
DDRH = 0x0F;    // set PORTH Data Direction Output as PORTH[3:0]
  SCI1BD = 0x0682;        // set baud rate to 9600bps     0x0682      0x0A2C      0x0068
  SCI1CR1 = 0xA0;
  SCI1CR2 = 0x2C;
EnableInterrupts;
  }
 
 

Outcomes