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

array inside interrupt function

I having trouble sending data out under interrupts from a buffer.

The buffer was declared in xdata and i have a counter that is used to index into it.

So when an interrupt occurs, the data is loaded into my SPI tx buffer, ie
SPIBUF = txbuffer[index];
index++;

All i seem to get is all zero's but if i use the index to send data i get something.
ie SPIBUF = index;

David

Parents
  • 1) Check if your external memory is working. Try:

    ..
    txbuffer[0] = 0xAB;
    ..
    SPIBUF = txbuffer[0];
    index++;
    

    2) Check if your indexing is correct.
    Verify "SPIBUF = index;" generates "0,1,2,...", not just something.

Reply
  • 1) Check if your external memory is working. Try:

    ..
    txbuffer[0] = 0xAB;
    ..
    SPIBUF = txbuffer[0];
    index++;
    

    2) Check if your indexing is correct.
    Verify "SPIBUF = index;" generates "0,1,2,...", not just something.

Children