SCI recieve interrupt

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

SCI recieve interrupt

3,003件の閲覧回数
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;
  }
 
 
ラベル(1)
0 件の賞賛
返信
3 返答(返信)

728件の閲覧回数
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 件の賞賛
返信

728件の閲覧回数
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 件の賞賛
返信

728件の閲覧回数
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 件の賞賛
返信