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
1) Check if your external memory is working. Try:
.. txbuffer[0] = 0xAB; .. SPIBUF = txbuffer[0]; index++;
The external memory is inside an ASIC. I actually found something interesting. txbuffer[0] = 0xaa; txbuffer[1] = 0x11; txbuffer[2] = 0x22; // Try transmitting data; // NB 1 - txbuffer[0] = 0xaa; P1 = txbuffer[0]; // P1 has 7 segment displays connected to it. If i don't include NB 1 just before writing it to P1 then it displays 0x00 but if i put NB 1 in and hence initial location 0 again it displays the correct value. Is this something funny with the compiler or the ASIC? David
So you're saying this works (ie, 0xAA appears on the 7 segment displays):
txbuffer[0] = 0xaa; txbuffer[1] = 0x11; txbuffer[2] = 0x22; txbuffer[0] = 0xaa; P1 = txbuffer[0];
txbuffer[0] = 0xaa; txbuffer[1] = 0x11; txbuffer[2] = 0x22; P1 = txbuffer[0];
Better yet, what's the assembler code generated for the "example" code you posted? Jon
View all questions in Keil forum