I am using the XBYTE macro to access a memory mapped device. The chip select is being handled via another port (P1) to allow the full 64K of addresses to be axcessed. When I read data from the memory device I read 0x00 from addresses 0x00 - 0xFF. Above 0xFF the data reads correctly. I have verified that the memory device contains valid data in 0x00 - 0xFF address range. I also have scoped the RD line and it does appear that it is activated to read the data. Please let me know any thoughts. Thanks.
Here is the code requested. I left out the include files and ISRs. The serial port and timers are functioning as desired. I have tried both incrementing the address variable directly(code below) and using a #define statment to define it and adding an offset to it(shown in one of the app. notes). Both methods have the same result. The memory I refer to is the external memory mapped devices which is a UVPROM. unsigned int counter = 0; unsigned int address = 0x00; // 16 Bit Address where data is stored in the unsigned int temp_data = 0x00; // Data Byte Read unsigned char i = 0x00; P1 = 0x70; // Chip Select the UVPROM, High 8 Bits of 24 Bit Address for(i = 0; i<=8; i++) { printf("\n\rUVPROM Block 0x%bx",i); for(address = (i*0x0400); address <= (0x03FF+(i*0x0400)); address++) { temp_data = (XBYTE[address]); // Read data byte in from external UVPROM printf("\n\rAddress:0x%x, Data: 0x%bx",address,temp_data); } } P1 = 0x00; // Clear Port 1 after all the data is read while(1) { P1_0 = ~P1_0; // Toggle port pin } }
Are you sure that this meets the timing requirements of your memory-mapped thingy?
"unsigned int temp_data = 0x00;" Change that to unsigned char and it'll probably start working as you expect.