SCT used to measure on-time

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by jdurand on Tue Apr 01 14:48:54 MST 2014
I'm working on my first SCT project, but am experienced with LPC81x parts from other projects.

I have an input that will be pulsing and I need to measure the time it's high over a set period.  I also need to send the decisions to an output pin.

What I'm trying to simulate here is a normal UP timer that is gated by an input pin.

Here's what I'm thinking:

Counter_H and L are both clocked at 1 MHz after the prescalers.

Counter_L free runs.

Event 0 takes the device pin as an input and when the pin is high, it removes HALT from counter_H.  Sets the output pin.

Event 1 takes the same device pin as an input and when the pin is low, it sets HALT for counter_H. Clears the output pin.

Event 2 happens when Counter_L = 50,000.  STOP is set for both counters.

When the counters stop, my program reads Counter_H and has the total on-time for the device input pin.

Now to figure out how to configure this.