Please help configure 16F616


Closed Thread
Results 1 to 16 of 16

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default Re: Please help configure 16F616

    Haven't checked anything in detail but I see you're using ADCIN to read the pot but you're not telling the compiler anything about how you want it read.

    I suspect you're either sample time is way to low or you have mismatch between the expected number of bits and the left/right justification. I don't know what PBP defaults to when you don't tell it anything with the DEFINEs.

    Check the manual for the DEFINEs belonging to ADCIN.

    You have x decalred as a WORD which makes me Think you WANT 10 bits from the ADC but the digipot you're using expects 8bits only. From memory I don't know how SHIFTOUT handles WORD variables like in this case. Is it actually shifting out 16 bits or is it only shifting out 8 of the 16bits and if that's the case is it the lower or higher byte.

    /Henrik.

  2. #2


    Did you find this post helpful? Yes | No

    Default Re: Please help configure 16F616

    Quote Originally Posted by HenrikOlsson View Post
    Haven't checked anything in detail but I see you're using ADCIN to read the pot but you're not telling the compiler anything about how you want it read.

    I suspect you're either sample time is way to low or you have mismatch between the expected number of bits and the left/right justification. I don't know what PBP defaults to when you don't tell it anything with the DEFINEs.

    Check the manual for the DEFINEs belonging to ADCIN.

    You have x decalred as a WORD which makes me Think you WANT 10 bits from the ADC but the digipot you're using expects 8bits only. From memory I don't know how SHIFTOUT handles WORD variables like in this case. Is it actually shifting out 16 bits or is it only shifting out 8 of the 16bits and if that's the case is it the lower or higher byte.

    /Henrik.
    Thanks, Henrik. I added "define ADC_SAMPLEUS 100" and "define ADC_BITS 8". That didn't seem to help any.

    How do my ADCONx and CMxCON0 registers look?

  3. #3
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,621


    Did you find this post helpful? Yes | No

    Default Re: Please help configure 16F616

    Hi,
    CMxCON looks fine to me, bit 7 = 0 which means the comparator is disabled (which it is by default on this device so no real need to add that but can't hurt).
    ANSEL sets RA1 and RA2 to analog, I suppose that's what you want.
    ADCON0 looks fine except possibly for bit 7 (I can NEVER remember when to use which setting). It should be in one state when using 8 bits and the other when usign 10 bits.
    ADCON1 sets the ADC clock to FOsc/64 which makes it run REALLY slow if the oscillator is 4MHz, try the RC mode instead.

    I checked the manual, if not told otherwise SHIFTOUT sends 8 bits even if the variable is of another size. You have mode 1 selected (MSB first) so my question then is if it shifts out the high byte of your word, MSB first or the low byte of your word, MSB first?

    I don't know, perhaps you've already done this, but I would make sure I had full control over that pot-chip first and THEN focus on the ADC.

    /Henrik.

Similar Threads

  1. Replies: 11
    Last Post: - 5th March 2012, 21:40
  2. CONFIGURE & OSCCON & meProg configure
    By SUNFLOWER in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 19th February 2011, 22:25
  3. PIC 16F616 Interrupt Enable/Disable?
    By Tobias in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 17th May 2009, 09:17
  4. 16F616 A to D
    By Tobias in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 1st May 2009, 17:37
  5. Configuring 16F616
    By Tobias in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 16th February 2009, 17:28

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