cancel
Showing results for 
Search instead for 
Did you mean: 

Hot to get the time a input is high

spacemishka
Associate II

Hi all,

i am new to the STM32-stuff and i have little project. Actually i need a tool to test camera shutters from 30s to 1/8000s. I have desiged a kind of sensor board in Kicad. I link to use two sensor for horizontal traveling shutter and two for vertical travelling shutters. There is a switch to choose one or the other kind. In any case there are two channels, one per phototransistor. They are interfaced to a 74HC132 to convert any wave to a clear square signal.

But how can i meter the time the signal is high at a STM32? I have a STM32F401CCU6 development board at hand.

thanks

Peter

3 REPLIES 3
S.Ma
Principal

Use a timer with 4 channels going to pins for maximum flexibility.

Timer free runs and overflow say 1 MHz timer overflow at 65535. Connect first income signal to channel 1 and 2 to capture the timer timestamp of rise, and fall edge same for second incoming signal on ch 3 and 4. You will need interrupt on falling edge and you 16 bit substract fall value minus rise value to know the high duration. There are more tricky ways, better to start from the basic.

Thanks for your answer. Regarding the timer ic i only found the TI CD4541​-Family. Would this work or is there another Option?

Thanks!​

AScha.3
Chief II

die NPN Q5 .. 8 sind sinnfrei.

+

timer ??

+

on F401 use tim1 , channels on input capture mode ; then you get pulse lenght in registers , when interrupt comes.

If you feel a post has answered your question, please click "Accept as Solution".