Understanding the SR latch

pjrebordao

Senior Member
I just recently came across the SRlatch / srreset / srset instructions and I'm wondering if they can be used for the following purpose:

- based on some event, a pin is set high with the provision to be turned off automatically after X milliseconds.

Can the SRlatch instructions accomplish this ?

The manual also states that "The SR latch also contains an internal clock source. This means the SR latch can be optionally configured to act like a ‘555 timer’." How can this be done ? It wasn't clear to me...
 

AllyCat

Senior Member
Hi,

...to be turned off automatically after X milliseconds.

Can the SRlatch instructions accomplish this ?.
Sadly, no I don't think so. The problem is that the maximum (digital) delay time is only 512 clock cycles, generally less than 1 ms (except with very low clock frequencies).

It is possible to set up an analogue version of a 555 timer (i.e. with an external capacitor) using the on-chip comparator(s). But that requires relatively "advanced" programming of the Special Function Registers, at least with M2 devices.

Cheers, Alan.
 
Top