Hi, I was wondering if anyone could provide help with the following: Basically I am trying to acces a memory mapped device at location 0x8000H. (I have other devices at other locations also such as 0x8100H and so forth). When A15 is high, this enables my 74LV138 Address decoder which then gives me an active low output depending on my combination of the address inputs (a8, a9, a10). So for this instance when they are all low, my latch is enabled. The target I'm using is the Analog Devices 831 MicroCOnverter. I've tried accessing the device using the recommended app. note C51: USING MEMORY-MAPPED DEVICES but none of the methods have seemed to work for me. However I feel i have not correctly understood it. WOuld the following be accurate: volatile unsigned char xdata *p = (char xdata *) 0x8000; (Location of my latch) ............... ..... p[0] = 0xAA; With the above statements should i not see the value 10101010 being output on Port 0???? So that my data inputs to the latch are this value???? I am not using any external memory, so I have tied EA pin high, therefore code executes from internal memory on the chip, but i still need my port 0 to generate my data bus for my memory mapped devices. I would greatly appreciate any help on the topic Thanking you in advance David
hi, When A15 is high, this enables my 74LV138 Address decoder One note here: default state of ports' pins is Z at reset and high-level after reset. So by default the decoder is enabled, isn't it? Do you make P2 port's pins low by P2=0x00; after reset? volatile unsigned char xdata *p = (char xdata *) 0x8000; I have some doubt that this line makes volatile access. You should ask Keil for more details - for me it looks like you define a pointer named "p" as the volatile variable. By other words, optimizer is said that pointer "p" may change its content at any time and so optimizer must not rely on its value loaded. I preffer next notation:
volatile unsigned char xdata p _at_ 0x8000;
volatile unsigned char xdata p[100] _at_ 0x8000;