• AVR Freaks

PIC18F46K80

Author
irmak
New Member
  • Total Posts : 7
  • Reward points : 0
  • Joined: 2019/07/05 23:50:12
  • Location: 0
  • Status: offline
2019/07/12 07:47:37 (permalink)
0

PIC18F46K80

The only PIC I found with 12 bit A/D converter module is 18F46k80.
 
I have developed a two channel sensor application with PIC16F877a and it works fine.
 
I want to improve its resolution, but I could not succed to make proper settings with 18f46K80.
/*************************/
1) I prefer 20Mhz cyrstal
 
2) I need two analog input channels;
ANCON0: ANSEL0=1; ANSEL1=1;
 
3) Left Justfy
ADCON2:ADFM=0; ACQT=8TAD;ADSC=FOSC/16;
 
4)  Vdac= (ADRESH*256)+ ADRESL ;
 
5)ADCON1:TRIGSEL==>I did not assign any value
 
6) ADCON1:VCFG:AVDD (I am not sure if this is true, I need +5V VDD)
 
7)ADCON1:VNCFG:AVDD (I am not sure if this is true, I need 0V VSS)
 
8)ADON1: CHSN (I do not perform a differential operation what should be true; 111 Reserved or 000 AVSS)
 
9)ADCON0: CHS:00000 for AN0; CHS:00001
 
10) ADCON0: ADON:1 
/*************************/
 
what are your suggestions for automatic aqusition time, A/D conversation clock and settings I have described below ?
 

 
post edited by irmak - 2019/07/12 13:12:42

Attached Image(s)

#1

6 Replies Related Threads

    AMAK
    Super Member
    • Total Posts : 52
    • Reward points : 0
    • Joined: 2014/08/05 10:45:57
    • Location: 0
    • Status: offline
    Re: PIC18F46K80 2019/07/12 15:45:56 (permalink)
    +1 (1)
    The K80 is a comparatively older device and it has a dedicated CAN module. It is meant to be used for automotive applications. Unless you are trying to develop an automotive application, this device will be an overkill.
     
    I would recommend trying the PIC18F46K42 or the PIC16F18446. These are newer devices with a 12-bit ADC on them. These newer ADCs have built-in hardware to perform basic math functions like averaging.
     
    Also take a look at the MPLAB Code Configurator (MCC). This is a graphical tool that will help you setup these newer devices easily. 
     
    P.S. If you are trying to develop an automotive application I would recommend the PIC18F26K83. It is a new device with a 12-bit ADC on it.
    #2
    ric
    Super Member
    • Total Posts : 22652
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: PIC18F46K80 2019/07/12 18:23:52 (permalink)
    +2 (2)
    There's nine PIC16F191xx devices all with 12 bit ADCs.
    Have a look around at https://www.microchip.com.aps/microcontroller.aspx

    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!
    #3
    mpgmike
    Super Member
    • Total Posts : 175
    • Reward points : 0
    • Joined: 2014/01/23 17:27:06
    • Location: NJ
    • Status: offline
    Re: PIC18F46K80 2019/07/12 20:54:53 (permalink)
    0
    On a separate note, you want better ADC resolution but you Left Justify?!?

    I don't need the world to know my name, but I want to live a life so all my great-grandchildren proudly remember me.
    #4
    irmak
    New Member
    • Total Posts : 7
    • Reward points : 0
    • Joined: 2019/07/05 23:50:12
    • Location: 0
    • Status: offline
    Re: PIC18F46K80 2019/07/12 22:55:49 (permalink)
    0
    Thank you all
     
    1) What is the effect of left justification on A/D resolution ?
     
    2) Can you give information about configuration bits of PIC18F46K42 or the PIC16F18446.
    #5
    ric
    Super Member
    • Total Posts : 22652
    • Reward points : 0
    • Joined: 2003/11/07 12:41:26
    • Location: Australia, Melbourne
    • Status: online
    Re: PIC18F46K80 2019/07/12 22:59:33 (permalink)
    +1 (1)
    irmak
    1) What is the effect of left justification on A/D resolution ?

    None, you still get all the bits, but aligned to the left rather than the right. This is unusual when you want more than 8 bits.
     

     2) Can you give information about configuration bits of PIC18F46K42 or the PIC16F18446.

    Like what? It is all spelled out in great detail in their respective datasheets.
     

    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!
    #6
    mpgmike
    Super Member
    • Total Posts : 175
    • Reward points : 0
    • Joined: 2014/01/23 17:27:06
    • Location: NJ
    • Status: offline
    Re: PIC18F46K80 2019/07/13 07:47:29 (permalink)
    +1 (1)
    12-bit resolution means your analog value will be 4095 increments between your VREF+ (probably VDD) and VREF- (probably VSS).  If the result is 4095, a Left Align will be:
    ADRESH = 0b11111111
    ADRESL = 0b11110000
    For Right Align the result will be:
    ADRESH = 0b00001111
    ADRESL - 0b11111111
     
    The difference means your 16-bit variable used to store your 12-bit result will be more inline with the ADC result value if Right Aligned.
    [edit]
    Left Aligned your result = 0xFFF0
    Right Aligned your result = 0x0FFF
    post edited by mpgmike - 2019/07/13 07:49:47

    I don't need the world to know my name, but I want to live a life so all my great-grandchildren proudly remember me.
    #7
    Jump to:
    © 2019 APG vNext Commercial Version 4.5