16F1827 ADC Direct manipulation not working


Closed Thread
Results 1 to 6 of 6

Hybrid View

  1. #1


    Did you find this post helpful? Yes | No

    Default Re: 16F1827 ADC Direct manipulation not working

    Hi Ioannis,

    I think your while loop needs to be

    ADCON0.1=1
    WHILE ADCON0.1=1
    wend

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default Re: 16F1827 ADC Direct manipulation not working

    while adcon0.1 and while adcon0.1=1 are functionally identical.

    However, the A/D module must be turned on before it will perform a conversion.

    ADCON0.0 = 1

    PBP does that automatically.
    DT

  3. #3
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,175


    Did you find this post helpful? Yes | No

    Default Re: 16F1827 ADC Direct manipulation not working

    Hi Darrel.

    Thanks for looking at this. Well, I do have this line, just did not copy it when posting the thread.

    The strange thing is that, if I use both ways, ADCin and register manipulation, it works!

    Like this works fine:

    Code:
    high adcon0.0'=1
    
    start:
    adcon0.1=1
    while adcon0.1:wend
    hserout ["Adresh: ",#adresh,13,10]
    pause 1000
    
    adcin 0,i
    hserout ["i: ",#i,13,10]
    goto start
    But not when modified to this:

    Code:
    high adcon0.0'=1
    
    start:
    adcon0.1=1
    while adcon0.1:wend
    hserout ["Adresh: ",#adresh,13,10]
    pause 1000
    
    'adcin 0,i
    'hserout ["i: ",#i,13,10]
    goto start
    Cannot figure out why...
    Ioannis

  4. #4
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,175


    Did you find this post helpful? Yes | No

    Default Re: 16F1827 ADC Direct manipulation not working

    OK, I found something but cannot tell if it is a bug or something I don't understand.

    Setting up the ADCON0 as

    ADCON0.0=1
    PAUSEUS 100
    ADCON0.1=1

    does not work.

    But ADCON0=3 does work just fine!

    Ioannis

  5. #5
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,175


    Did you find this post helpful? Yes | No

    Default Re: 16F1827 ADC Direct manipulation not working

    Ooops,no bug!

    I got it.

    Wrong label...

    Sorry for the alarm.

    All are OK.

    Ioannis

Similar Threads

  1. ADC not working - I'm a new member
    By johnbond in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 20th June 2011, 20:13
  2. 16F1827 - Timer1 and ADC Conflict?
    By Ioannis in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 18th March 2011, 18:22
  3. Manipulation of string array
    By Benny007 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 23rd April 2008, 21:50
  4. String Manipulation
    By Darrenmac in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 8th April 2008, 15:39
  5. Port Manipulation
    By rwskinner in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 5th March 2008, 05:30

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