We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
hi all! i'd like to locate a variable (e.g. version number) at a fixed location in ROM, so the firmware can check the userware's version @ startup! userware: int version = 1; // locate this @ 0x1000 - but how ?! firmware: if (*((int*)0x1000) != 1) { DisplayErrorMessage(); } how can I achieve this using C166/L166 ?! thanks in advance for any help... Matthias
Hi Matthias, I always use the following way to achieve what you want to do: 1. I create a single file named version.c In this file I only have the following definitions unsigned char const far FirmwareVersion[] = {030731}; 2. Then I locate this file to a specific memory location, using the locater directive ?FC?VERSION%FCONST (0x57FE0) in the user section of the L166 locate tab of the options window. (in this example this is a far memory location, but this depends from your memory layout). 3. I fetch this date in a c-function as follows: fmemcpy(TempBuf,0x57FE0,6); TempBuf is then filled with the string "030731". Maybe this works for you. regards Uwe