I have just started using the keil compiler and had a simple question about getting data to and from an xdata buffer. Say I have declared a buffer and two global integer variables as follows; xdata volatile BYTE TEMPBUF[64]; int nTemperature, nTemperature2; How do I get data from the TEMPBUF to the integer variables? nTemperature = (int)TEMPBUF; nTemperature2 = (int)TEMPBUF [2]; And how do I get integer data to the TEMPBUF? (int)TEMPBUF = nTemperature; (int)TEMPBUF[2] = nTemperature2; Any help would be greatly appreciated, JD
Yes already familiar with 'C', it's just I tried the following code
if (SETUPDAT[0] == VR_UPLOAD) { // to host *((WORD*)(EP0BUF+0)) = nShutter; *((WORD*)(EP0BUF+2)) = nShutterSpeed; } else { // from host nShutter = *((WORD*)(EP0BUF+0)); nShutterSpeed = *((WORD*)(EP0BUF+2)); }