Struggling with a P18f2550


Closed Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2008
    Posts
    51

    Default Struggling with a P18f2550

    Hi all, I have been struggling since converting from a 16f876A chip over to the 18f2550.

    My problems start as soon as i go to program with PICKIT2 i get the error: "Warning: Some configuration words not in hex file".
    I have googled this and came back to an ansrew using older software and i dont think there has been a post since PB3?

    Secondly even after programming though this and ignoring the error i can not get the ADCIN to operate. I believe i have enabelled this correctly for using pins 0,1 and 2:

    DEFINE ADC_BITS 8 'SETS NUMBER OF BITS IN RESULTS
    DEFINE ADC_CLOCK 3 'SET CLOCK SOURCE
    DEFINE ADC_SAMPLUS 50 'SET SAMPLING TIME IN US


    ADCON0 = %00000001
    ADCON1 = %00001100 'SETS THE ANALOGUE/DIGITAL INPUTS TO BANK A
    ADCON2 = %10111110 'right justified, AD=20AD, A/D clock=fosc/64


    Am i missing something obvious here?

    Thanks Chris

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


    Did you find this post helpful? Yes | No

    Default Re: Struggling with a P18f2550

    "Warning: Some configuration words not in hex file".
    Is just a warning, not an error. This is telling you that there are more things that can be configured. Not a problem to get this warning.

    You have things set for 10 bit
    ADCON2 = 111110 'right justified
    but you are also calling for 8 bit
    DEFINE ADC_BITS 8
    Decide on one.

    To read Channel 0, "PORTA.0", 8 bit, all you need is
    Code:
    DEFINE ADC_BITS 8	
    DEFINE ADC_CLOCK 3	
    DEFINE ADC_SAMPLEUS 50
    ADCON1 = %00001110 'Sets PORTA.0 to analog
    Then when you want to read the pin
    Code:
    ADCIN 0, MY_VAR
    Dave
    Always wear safety glasses while programming.

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