SCI recieve interrupt

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

SCI recieve interrupt

2,803 Views
ODUIEEECarTeam
Contributor I
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;
  }
 
 
Labels (1)
0 Kudos
Reply
3 Replies

528 Views
Stephen
Contributor III
Just comparing your interrupt call with mine - try putting the following line just before your interrupt function:
 
#pragma TRAP_PROC
interrupt void RCVIR_ISR()
Good Luck
 
0 Kudos
Reply

528 Views
JimDon
Senior Contributor III
Stephen,

What does the pragma to that the interrupt key word does not?
I have never had to use that pragma for an interrupt handler.

0 Kudos
Reply

528 Views
Lundin
Senior Contributor IV
#pragma TRAP_PROC is there as an ISO C alternative to the interrupt keyword. Both of them have the same meaning. If you use the pragma you don't need to use the keyword.

The correct syntax with the pragma would be:

#pragma TRAP_PROC
void RCVIR_ISR()
{}


This is to prefer before the interrupt keyword since it makes the code ISO C compatible.
0 Kudos
Reply