10 Replies Latest reply on Feb 17, 2018 8:13 AM by BoTa_264741

    Up/Down accumulator for a type 2 phase detector (PLL)


      Greetings all!


      I'm trying to make a type 2 phase detector for a PLL circuit (see attachment).  In this PLL, the VCO is external, and the PSOC will control it by a single control voltage through the VDAC (but it could also be a PWM).


      I'm looking for a kind of "accumulator", or up/down counter, that will control the VDAC's output voltage.  Normally, lines Qa and Qb are both low (this represents a locked phase condition, which is what we ultimately want).


      --> I want a condition, where:

           if there are pulses on the Qa line, then VDAC should increase its output.

           if there are pulses on the Qb line, then VDAC should decrease its output

           if there are no pulses, then VDAC should keep using its "last" value


      Is there such an accumulator/counter in PSOC?  I see counters, but I don't see an up/down counter.