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

How I can call a SPI function from Interrupt service Routine

Hi
I am using 89C51ED2 for my projects.From SPI I am receiving datas from peripherial.I using inbuilt registers like SPDAT,SPCON.But I can't call my SPI function
from interrupt service routine

My CODE is

void readspi(void){

Enablecs();
SPDAT = addr;
while((SPSTA & 0x80) == 0);
spivalue = SPDAT;
while((SPSTA & 0x80) == 0);
Disablecs();
}

void Ext0_ISR(void) interrupt 0 using 1{
readspi();
}
void main(void){
static unsigned int spivalue;
while(1){
}

}

Please help me to over come this problem

Parents
  • I am using Non interrupt SPI function only.
    That, most likely is your problem. SPI is REAL time NOT the friggin "real enough" but REAL. Non-interrupt SPI is likely not to be timely, even when presumed to be real enough"

    That interrupt code is more difficult than non-interrupt code is nothing but an urban legend

    Again, if you grab CodeArchitect, you will be amazed.

    Erik

Reply
  • I am using Non interrupt SPI function only.
    That, most likely is your problem. SPI is REAL time NOT the friggin "real enough" but REAL. Non-interrupt SPI is likely not to be timely, even when presumed to be real enough"

    That interrupt code is more difficult than non-interrupt code is nothing but an urban legend

    Again, if you grab CodeArchitect, you will be amazed.

    Erik

Children