• AVR Freaks

Hot!Accessing DIA Table - PIC16F15313

Author
LucaAg
New Member
  • Total Posts : 3
  • Reward points : 0
  • Joined: 2019/12/05 05:26:57
  • Location: 0
  • Status: offline
2019/12/05 14:46:08 (permalink)
0

Accessing DIA Table - PIC16F15313

How can I access the DIA table in C code?
Should I write an ASM routine, or is there a simpler way to access the table location?
 
Thank you in advance
 
Luca
 
#1

3 Replies Related Threads

    ric
    Super Member
    • Total Posts : 25124
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: offline
    Re: Accessing DIA Table - PIC16F15313 2019/12/06 22:03:14 (permalink)
    +1 (1)
    It has to be done via the NVMREG peripheral. You can access that from C code.
     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #2
    LucaAg
    New Member
    • Total Posts : 3
    • Reward points : 0
    • Joined: 2019/12/05 05:26:57
    • Location: 0
    • Status: offline
    Re: Accessing DIA Table - PIC16F15313 2019/12/08 04:56:21 (permalink)
    0
    It seems to work.  Thank you, Luca
     
     
    // Reading DIA table TSLR2   
        NVMCON1bits.NVMREGS = 1;
        NVMADRH = (unsigned char) ((DIA_TSLR2 & 0xFF00)>>8);
        NVMADRL = (unsigned char)(DIA_TSLR2 & 0x00FF);
        NVMCON1bits.RD = 1;
        HIBYTE (rTSLR2) = NVMDATH;
        LOBYTE (rTSLR2) = NVMDATL;
        ADCv.V.ADFVR2xDIATable =  rTSLR2;
       
    // Reading DIA table FVRA2X   
        NVMCON1bits.NVMREGS = 1;
        NVMADRH = (unsigned char) ((DIA_FVRA2X & 0xFF00)>>8);
        NVMADRL = (unsigned char) (DIA_FVRA2X & 0x00FF);
        NVMCON1bits.RD = 1;
        HIBYTE (rFVRA2X) = NVMDATH;
        LOBYTE (rFVRA2X) = NVMDATL;
        ADCv.V.ADDIATable = rFVRA2X;
    #3
    ric
    Super Member
    • Total Posts : 25124
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: offline
    Re: Accessing DIA Table - PIC16F15313 2019/12/08 05:07:21 (permalink)
    0
    This:
        NVMADRH = (unsigned char) ((DIA_TSLR2 & 0xFF00)>>8);
        NVMADRL = (unsigned char)(DIA_TSLR2 & 0x00FF);

    can be simplified to
        NVMADR = DIA_TSLR2;

    and you can also do
        ADCv.V.ADFVR2xDIATable = NVMDAT;



     

    I also post at: PicForum
    Links to useful PIC information: http://picforum.ric323.co...opic.php?f=59&t=15
    NEW USERS: Posting images, links and code - workaround for restrictions.
    To get a useful answer, always state which PIC you are using!
    #4
    Jump to:
    © 2020 APG vNext Commercial Version 4.5