Hello everyone,
I am working on a project in LTspice where I am using the .machine
directive to create a state machine. My goal is to detect the rising (leading) or falling edge of a signal within the .rule
conditions to trigger state transitions.
For example, I want to have a rule like this:
.machine
.state X
.state Y
.rule X Y {edge detection condition}
.endmachine
Where {edge detection condition}
would allow me to detect a rising or falling edge of a certain signal (e.g., V(SAMPLE)
).
I understand how to use basic voltage comparisons for state transitions, but I am not sure how to implement edge detection directly within the .rule
conditions. Is there a way to detect edges in LTspice using the .rule
command, or is there a workaround that could be used to achieve this functionality?
Any advice or examples from your experience would be greatly appreciated!
Thanks in advance!