18f26k22 - setting fuse in program


Closed Thread
Results 1 to 8 of 8
  1. #1
    Join Date
    Oct 2011
    Posts
    6

    Default 18f26k22 - setting fuse in program

    I'm working to a project with 18f26k22 using PBP3.0.

    I need internal osc 64mhz , analogic input 1-2-3-4-5-10-12, 3 output c3-c2-c1, 4 digital iput c7-c6-c5-c4.

    I'm not able to configure pic, can anyone help me?

    (Better in program than in .inc file)

    Many Thanks
    Steve
    Last edited by smsteves; - 3rd October 2011 at 08:32.

  2. #2
    Join Date
    Nov 2003
    Location
    Wellton, U.S.A.
    Posts
    5,924


    Did you find this post helpful? Yes | No

    Default Re: 18f26k22 - setting fuse in program

    In your PBP 3.0 directory open the directory "DEVICE_REFERENCE" and find the PIC18F26K22.INFO file, open with notepad.

    Here you will find an example for setting the configs.
    Code:
    #CONFIG
        CONFIG  OSC = HS
        CONFIG  WDTE = ON
     #ENDCONFIG
    Then you will see a list of all the possible config options.
    Dave
    Always wear safety glasses while programming.

  3. #3
    Join Date
    Oct 2011
    Posts
    6


    Did you find this post helpful? Yes | No

    Default Re: 18f26k22 - setting fuse in program

    [QUOTE=mackrackit;108426]In your PBP 3.0 directory open the directory "DEVICE_REFERENCE" and find the PIC18F26K22.INFO file, open with notepad.
    ...

    Many Thanks mackrackit, First problem solved

    Now 2° Problem input/output/adc settings

    My code :


    TRISA = %00101111 ' Set PORTA to all input
    TRISB = %00000011 ' Set PORTB to all input + 6 output
    TRISC = %11110000 ' Set PORTC to all input + 4 output
    ANSELA= %11101111
    ANSELB= %00000011


    ADCON1 = %10001000
    ADCON2 = %10000000 ' ...and right justify result
    ADCON0 = %10001001


    It seems ok, But..

    ADCIN report always 0..

    Any Idea?

    Steve

  4. #4
    Join Date
    Aug 2010
    Location
    Maryland, USA
    Posts
    869


    Did you find this post helpful? Yes | No

    Default Re: 18f26k22 - setting fuse in program

    Maybe if we could see your entire code, or if this is all of it, you only have the settings set up.
    -Bert

    The glass is not half full or half empty, Its twice as big as needed for the job!

    http://foamcasualty.com/ - Warbird R/C scratch building with foam!

  5. #5
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default Re: 18f26k22 - setting fuse in program

    Steve, You forgot the PMD2: PERIPHERAL MODULE DISABLE REGISTER 2. It enables or disables the A/D module for the 18F26k22.
    The new 18 F series use these new registers to enable and disable most all of the module functions. It's in the data sheet.....

    Dave Purola,
    N8NTA
    EN82fn

  6. #6
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default Re: 18f26k22 - setting fuse in program

    Steve, also read this...

    17.2.10 A/D CONVERSION PROCEDURE
    This is an example procedure for using the ADC toperform an Analog-to-Digital conversion:1. Configure Port:• Disable pin output driver (See TRIS register)• Configure pin as analog2. Configure the ADC module:• Select ADC conversion clock• Configure voltage reference• Select ADC input channel• Select result format• Select acquisition delay• Turn on ADC module3. Configure ADC interrupt (optional):• Clear ADC interrupt flag• Enable ADC interrupt• Enable peripheral interrupt• Enable global interrupt
    (1)
    4. Wait the required acquisition time
    (2).5. Start conversion by setting the GO/DONE bit.6. Wait for ADC conversion to complete by one ofthe following:• Polling the GO/DONE bit• Waiting for the ADC interrupt (interruptsenabled)7. Read ADC Result8. Clear the ADC interrupt flag (required if interruptis enabled).

    Dave Purola,
    N8NTA
    EN82fn

  7. #7
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default Re: 18f26k22 - setting fuse in program

    Steve, I also don't see where you are setting the A/D reference voltage source...
    Dave Purola,
    N8NTA
    EN82fn

  8. #8
    Join Date
    Oct 2011
    Posts
    6


    Did you find this post helpful? Yes | No

    Default Re: 18f26k22 - setting fuse in program

    Hi Dave,


    I'll test as soon as possible following your advices



    Many thanks for your help...
    Steves

Members who have read this thread : 1

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