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

XDATA variables

I have the following variable declaration:

float xdata voltage _at_ 0x08E2;

When I assign a value and try to print if I always get 0.0:

voltage = 25.5;
printf( "Volatage: %#5.2f", voltage );

Ouptut

Voltage: 0.0

Is there a reason for this?

Thanks.

Parents
  • You haven't mentioned what chip you use.

    What do you mean by "data flash memory"? The application is normally stored in flash - a special version of PROM that allows quick erase of sectors (or full chip).

    But flash memory is not for variables since you can't modify data in flash memory. You have to erase a full sector to be able to write a new value to a variable.

    Another thing: The C51 procesors normally separate data and program memory spaces, so a data access instruction can not access program memory, and a code access instruction can not access variable memory. Some C51 processors can have flash memory accessible both ways, to allow storage of either application code or configuration data. But your XDATA variables are expected to be variables, i.e. to bestored in RAM, not in flash.

    Have you spent time reading up on the C51 architecture?

Reply
  • You haven't mentioned what chip you use.

    What do you mean by "data flash memory"? The application is normally stored in flash - a special version of PROM that allows quick erase of sectors (or full chip).

    But flash memory is not for variables since you can't modify data in flash memory. You have to erase a full sector to be able to write a new value to a variable.

    Another thing: The C51 procesors normally separate data and program memory spaces, so a data access instruction can not access program memory, and a code access instruction can not access variable memory. Some C51 processors can have flash memory accessible both ways, to allow storage of either application code or configuration data. But your XDATA variables are expected to be variables, i.e. to bestored in RAM, not in flash.

    Have you spent time reading up on the C51 architecture?

Children