Configuration bits and timing


Closed Thread
Results 1 to 7 of 7

Hybrid View

  1. #1
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,624


    Did you find this post helpful? Yes | No

    Default Re: Configuration bits and timing

    Hi,
    Open up the datasheet and take a look at the ADC section - especially the ANCON register. It says:
    The ANCONx registers are used to configure the operation of the I/O pin associated with each analog channel. Clearing an ANSELx bit configures the corresponding pin (ANx) to operate as a digital only I/O.
    Cool device that, 12bit ADC with differential input, two internal references - hadn't noticed it before.

    /Henrik.

  2. #2
    Join Date
    Jun 2011
    Posts
    37


    Did you find this post helpful? Yes | No

    Default Re: Configuration bits and timing

    I've tried;
    ANSEL = $00
    ANSEL = 0
    ANSEL0 = 0
    and get "ERROR Line 30: Syntax error.30: Syntax error 30: Syntax error"
    Any suggestions on the correct way to enter this setting in this new chip?

  3. #3
    Join Date
    Jun 2011
    Posts
    37


    Did you find this post helpful? Yes | No

    Default Re: Configuration bits and timing

    I didn't see ANSEL in the p18f26k80.h file.
    So I tried the following using the ANCON configuration registers and it seems to work;

    ADCON0 = %00000000 ;P364 A/D CONTROL REGISTER 0
    ADCON1 = %00000000 ;P365 A/D CONTROL REGISTER 1
    ADCON2 = %00000000 ;P366 A/D CONTROL REGISTER 2
    ODCON = %00000000 ;P179 PERIPHERAL OPEN-DRAIN CONTROL REGISTER
    ANCON0 = %00000000 ;P369 A/D PORT CONFIGURATION REGISTER 0***
    ANCON1 = %00000000 ;P369 A/D PORT CONFIGURATION REGISTER 1***
    CM1CON = %00000000 ;P378 COMPARATOR CONTROL x REGISTER
    CM2CON = %00000000 ;P378 COMPARATOR CONTROL x REGISTER

    Thanks for pointing me in the right direction.
    Last edited by RayL113; - 17th November 2012 at 06:07. Reason: Forgot to say Thanks

  4. #4
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,624


    Did you find this post helpful? Yes | No

    Default Re: Configuration bits and timing

    That's because there is no ANSEL register in the 26K80. The register is called ANCONx.

    /Henrik.

Similar Threads

  1. RC5 code for infrared receiver
    By Dennis in forum mel PIC BASIC Pro
    Replies: 23
    Last Post: - 11th January 2017, 13:34
  2. 12F683 serout timing
    By Hobie Cat in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 21st December 2009, 17:57
  3. Reading in Manchester code
    By brid0030 in forum Code Examples
    Replies: 0
    Last Post: - 10th March 2009, 22:55

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts