Latch for 2 seconds

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
jofic_334026
Level 3
Level 3
First like received
        I have a pin called "OVER_CURRENT" that goes low when an over current condition occurs. When this happens I'd like it to latch for 2 seconds. During this period I'd like the driving pin "PIEZO_DRV" to go low. After 2 seconds if the OVER_CURRENT pin is high I'd like the driving pin to go high again. I think this should be pretty simple in hardware but I'm having trouble. I figured I could use a SR Flip Flop but I can't quite make sense of it. I've attached what I have attempted so far.   
0 Likes
4 Replies
HeLi_263931
Level 8
Level 8
100 solutions authored 50 solutions authored 25 solutions authored

I think the timer component might be helpful for you.

   

When you over current condition last for lets say 3 seconds, what should happen then?

0 Likes
jofic_334026
Level 3
Level 3
First like received
        The PIEZO_DRV pin should remain low. I know the timer will be necessary but how do I use it in conjunction with my flip flop?   
0 Likes
lock attach
Attachments are accessible only for community members.
HeLi_263931
Level 8
Level 8
100 solutions authored 50 solutions authored 25 solutions authored

Use a DFF instead. It can be forced with a async reset input to a certain state, and the pule from the timer can set it back as long as the input is right:

   

   

I attach a project, but I did not test it 🙂

0 Likes
ETRO_SSN583
Level 9
Level 9
250 likes received 100 sign-ins 5 likes given

You could implement an approach based on a pin interrupt,

   

the systick timer (non UDB chip resource), and a control reg,

   

would save some chip resources.

   

 

   

0 Likes