On Thu, 19 Oct 2006, slippyr4 wrote: > well forgive me if i'm wrong, but the very array i posted before > compiled but was not initialized, until i added the pragma. I would guess you had some other problem then. > All rom says is to put the variable in rom. The MCC18 docs say that > idata signifies a section of initialized data. Yes; initialized data in RAM, not in ROM. > Are you therefore saying that the following will work:- > > #pragma udata uninitdatasection > rom int test=0x55; > #pragma udata Yes. Try it. "#pragma udata uninitdatasection" changes the name of the active udata section to "uninitdatasection". It does not mean "put the variable on the next line in udata." "rom" variables go into the active "romdata" section. You can't change that. > ? > > On 19/10/06, John Temples wrote: >> No, you do not need a #pragma idata or any other #pragma for this >> array in C18. The "rom" keyword is sufficient. >> >> On Thu, 19 Oct 2006, slippyr4 wrote: >> >>> #pragma idata initdata >>> >>> rom char menuitems[4][10] = >>> { >>> {"Set Audio"}, >>> {"Set Radar"}, >>> {"Backlight"}, >>> {"Exit Menu"} >>> }; >>> >>> #pragma idata >>> >>> That'll see you right. You need to #pragma idata ("i" meaning >>> initialized data, i think), as well as rom -prefix your definition. >>> >>> On 19/10/06, Tom Sefranek wrote: >>>> Well, it compiles, with no errors, but I get no program data either. >>>> >>>> Kenneth Lumia wrote: >>>> >>>>>> I am trying to implement a "C" based lookup table installed in program >>>>>> memory. I envision it as a one dimensional array, address in, data out. >>>>>> >>>>>> >>>>>> >>>>> for C18, try >>>>> >>>>> rom INT_8 secondsunday[] = {9,8,14,13,12,11,10}; >>>>> >>>>> Which would be accessed somewhat like the following: >>>>> >>>>> //need to determine the day that the 2nd Sunday of March falls on >>>>> DST_temp.tm_mday = 1; //force to 1st day of month >>>>> day = dayofweek(&DST_temp); //determine what day the 1st of the month >>>>> falls on >>>>> day = secondsunday[day]; //lookup the day the second sunday >>>>> falls on >>>>> DST_temp.tm_mday = day; //save the second sunday into the >>>>> structure >>>>> >>>>> Also, for text, you could use: >>>>> rom char dayofweektext[] = "SunMonTueWedThuFriSat"; >>>>> >>>>> Ken >>>>> ________________________________________ >>>>> "Well that never happened in any of the simulations" >>>>> klumia@adelphia.net >>>>> >>>>> >>>>> ----- Original Message ----- >>>>> From: "Thomas C. Sefranek" >>>>> To: "'Microcontroller discussion list - Public.'" >>>>> Sent: Wednesday, October 18, 2006 4:11 PM >>>>> Subject: [PIC] C18 rom lookup table >>>>> >>>>> >>>>> >>>>> >>>>>> I am trying to implement a "C" based lookup table installed in program >>>>>> memory. I envision it as a one dimensional array, address in, data out. >>>>>> >>>>>> I am lost in the # pragma romdata .... stuff. >>>>>> And I believe there is a way to initialize it too? >>>>>> >>>>>> ADVthanksANCE >>>>>> >>>>>> Tom >>>>>> >>>>>> * >>>>>> | __O Thomas C. Sefranek WA1RHP@ARRL.NET >>>>>> |_-\<,_ Amateur Radio Operator: WA1RHP >>>>>> (*)/ (*) Bicycle mobile on 145.41MHz PL74.4 >>>>>> >>>>>> ARRL Instructor, Technical Specialist, VE Contact. >>>>>> http://hamradio.cmcorp.com/inventory/Inventory.html >>>>>> http://www.harvardrepeater.org >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> -- >>>>>> http://www.piclist.com PIC/SX FAQ & list archive >>>>>> View/change your membership options at >>>>>> http://mailman.mit.edu/mailman/listinfo/piclist >>>>>> >>>>>> >>>>>> >>>>> >>>>> >>>>> >>>>> >>>> >>>> -- >>>> * >>>> | __O Thomas C. Sefranek WA1RHP@ARRL.net >>>> |_-\<,_ Amateur Radio Operator: WA1RHP >>>> (*)/ (*) Bicycle mobile on 145.41, 448.625 MHz >>>> >>>> http://hamradio.cmcorp.com/inventory/Inventory.html >>>> http://www.harvardrepeater.org >>>> >>>> -- >>>> http://www.piclist.com PIC/SX FAQ & list archive >>>> View/change your membership options at >>>> http://mailman.mit.edu/mailman/listinfo/piclist >>>> >>> -- >>> http://www.piclist.com PIC/SX FAQ & list archive >>> View/change your membership options at >>> http://mailman.mit.edu/mailman/listinfo/piclist >>> >> >> -- >> John W. Temples, III >> -- >> http://www.piclist.com PIC/SX FAQ & list archive >> View/change your membership options at >> http://mailman.mit.edu/mailman/listinfo/piclist >> > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > -- John W. Temples, III -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist