A/D IO pins changing function while running?


Results 1 to 12 of 12

Threaded View

  1. #6
    Join Date
    Aug 2003
    Posts
    985


    Did you find this post helpful? Yes | No

    Default Re: A/D IO pins changing function while running?

    I found this interesting so looked a bit more...
    I've done a couple of projects with analogue in that worked great

    I think your program is resetting bits in ADCON1 register and resetting ports back digital
    depending on the value read from the port that starts out analogue.

    For an 8 bit result, setting ADCON1:7 to zero sets the 10 bit result left justified so you
    only see the high 8 bits in the word which are most significant because you access the
    high byte of a word with the 10 bit result shifted into place.
    How much of this is handled by PBP I don't remember, but that's what's happening.
    Otherwise the 10 bit result is right justified, and you see a 16 bit word who's leading
    6 bits are always zero, and that's the 10 bit result.

    I'll bet that you're making PBP access a 16 bit word comprised of the ADCON1 register,
    and the lower end result register, and that's somehow enough to wreck the contents
    of ADCON1, and leave your program running with a digital port.

    I was thinking asm when doing this,
    it would be nice if someone else has any thoughts on what PBP is doing.
    I suspect the DEFINE would set the ADCON1 bit 7 without touching the other bits,
    and setting it again directly might only override it.
    Last edited by Art; - 6th June 2013 at 16:45.

Similar Threads

  1. 18F4550 not running
    By comwarrior in forum General
    Replies: 6
    Last Post: - 1st January 2011, 01:07
  2. Cant get my PIC running
    By Viberer in forum Off Topic
    Replies: 13
    Last Post: - 29th August 2008, 20:07
  3. Changing several o/p pins at the same time
    By AndrewC in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 1st August 2008, 21:14
  4. PIC - 8 Pins - 6 Output Pins ?
    By DanPBP in forum Off Topic
    Replies: 0
    Last Post: - 22nd October 2007, 00:23

Members who have read this thread : 0

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

Tags for this Thread

Posting Permissions

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