Measuring audio phase shift through a circuit with a PIC


Closed Thread
Results 1 to 40 of 50

Hybrid View

  1. #1
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by languer View Post
    This is an excellent work, and very easy to follow and read through.

    With that said, you probably could save the schmidt triggers and run the analog waveforms straight to the comparator (they would have to be conditioned / buffered before hitting the comparator). But you have the concept working, so I would not change it now.

    Again, very nice job.
    Thanks...& as it goes I'm pleased how the contributions rolled in - all had value...( and also gave me a 'second wind' so to speak) .

    In the end I do take the analogue sine waves, square them up by amplifiyng it a *lot* (my circuit will have a couple of unused opamp stages, so I figured it would save component space by using those vs Schmitts) ...then push it into the PIC comparators (so no schmitts were harmed in the making of this thread anymore).

    It works, but I'm not sure how robust the resulting comparator triggering will be under certain circumstances - early on in the thread there were defintiely some severe phase outcome errors when the analog signals into the comparators were not of the same magnitude ...obvious in retrospect, but when you're getting wrapped up with all manner of new learning experiences blah blah (I now need to spend a bit more quality time, trying different permutations)

    My last workin g code I posted (late last night)....it all works, biut I'm sure seasoned programmers wince at the way I'm using DT's stuff - not sure one little bit if that's an acceptable practise. For example, where I setup the interrupts....

    Code:
    ASM
    INT_LIST  macro    ; IntSource,        Label,  Type, ResetFlag?
            INT_Handler   CMP1_INT,  _Comp1_Int,   PBP,  yes
        endm
        INT_CREATE               ; Creates the interrupt processor
    ENDASM
    the last two columns...are they right? (Hank makes a mental note -hmm, really must get around to learning programming properly, rather than winging/kludging/pleading whenever a need arrives ...and that includes interrupts!)

    Being an onld electronics type, I too initially related a PIC's comparator inputs to being analog devices...and to tell you the truth I'm still not sure if from a PIC perspective, whether its comparator inputs are analog or digital...I just roll with what works...and deselecting ANSEL for the pins involved works! (perhaps someone can chime in what the true definition of ANSEL funtion is - ie is it purely related to the AtoD functionality or does it mean 'analogue' in general?)


    PS tks Paul for the stuff about HSerout - & whilst that 'tip' is somewhat ugly on the eye, it all makes complete sense!
    Last edited by HankMcSpank; - 30th September 2010 at 19:17.

  2. #2
    Join Date
    Jul 2003
    Location
    USA - Arizona
    Posts
    156


    Did you find this post helpful? Yes | No

    Default ANSEL controls analog/digital state of input, not to what function is routed to

    perhaps someone can chime in what the true definition of ANSEL funtion is - ie is it purely related to the AtoD functionality or does it mean 'analogue' in general?
    I thought I answered this in the previous post. In any case, ANSEL controls whether the respective PIC inputs are set to analog or digital. It does not care about the ADC. Other registers allow you to decide whether the respective analog input is used for the ADC or the Comparator, or ...

    In your case you lucked out because even though you did not set the inputs to analog, you had already squared up the inputs to make them sort of digital.

  3. #3
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by languer View Post
    I thought I answered this in the previous post. .
    Apologies, I'd picked up (misread), that there was still a degree of uncertainty!

    Quote Originally Posted by languer View Post
    In your case you lucked out because even though you did not set the inputs to analog, you had already squared up the inputs to make them sort of digital.
    That sums it up nicely - got it! (that said, what you're saying would suggest, it wouldn't be the comparator' Internal VREF deciding the 'flip/trigger point', but the PIC's internal high low digital detection circuitry? (ie when is a '1' a 1' and when is it a '0')

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