4 Replies Latest reply on Feb 25, 2019 4:56 AM by muhuc_4026131

    Generating Frequencies for TCD1304DG using PSoC 5LP

    muhuc_4026131

      Hello everyone,

      I have recently come across PSoC 5LP. I am working on a project where I have to generate three frequencies to run the TCD1304DG CCD. The three frequencies are Master Clock (2 Mhz), Shift Gate (SH-Pulse) and Integration Clear Gate (ICG). I am able to generate 2 MHz from the master clock and I can also use the PWM function but I am unable to the specific clocks and delays given in the figure below.

      Capture.PNG

      This translates to the following:

      1. SH must go high with a delay (t2) of 500 ns after ICG goes low.
      2. SH must stay high for (t3) a minium of 1000 ns.
      3. ICG must go high with a delay (t1) of 5000 ns after SH goes low.

       

      I have used several codes that are available online for Arduino Uno and Arduino Mega ADK but I want to use my PSoC 5LP. I would appreciate your help guys. Cheers.

      Zaryab

        • 1. Re: Generating Frequencies for TCD1304DG using PSoC 5LP
          ScottA_91

          First, I wouldn't set the IMO to 2 MHz.  I would put down a clock component, set that to 2 MHz and let the system take care of dividing the clock down for you.

           

          I can see a couple of ways of doing this:

           

          If you just want to do this on a regular basis, use a lookup table and a down counter.  (Use the lookup table to disable the down counter, use the count to change states, register the lookup table outputs, and use a control to reset the down counter to start this action.)  No code needed, meeting timing should be pretty easy and it should be very reliable.

           

          Alternatively, you can do all of this in a datapath, with the different states time slices you want.  The advantage here is less resources, but it is more difficult to do and understand.

           

          You *might* be able to make timing bit banging things via the CPU, but I think using pure hardware is a better way to go here.

          • 2. Re: Generating Frequencies for TCD1304DG using PSoC 5LP
            muhuc_4026131

            Thanks for your reply ScottA_91 . Really appreciate it. I have looked into LUT and down counter and I understand what you're suggesting. The problem is I don't know how to implement what you just said. Would you be able to elaborate your first suggestion please? I am trying to meet the time requirements for the CCD and I hoping to keep these fixed these once they work. Cheers.

            • 3. Re: Generating Frequencies for TCD1304DG using PSoC 5LP
              ScottA_91

              So here's something I mocked up, but haven't tested:

              2019-02-22_9-20-10.png

               

              Do be careful with the LUT as it normally would be backwards for a down counter (click on the input hex value twice to sort in reverse order).

              1 of 1 people found this helpful
              • 4. Re: Generating Frequencies for TCD1304DG using PSoC 5LP
                muhuc_4026131

                Thanks a lot. sorry for the late reply. This is looking promising. I will try it and report back. Cheers.