Forum Discussion
Altera_Forum
Honored Contributor
10 years agoSynchronization on falling and rising edges
Hi, I need help . I need to synchronize to the falling and rising edge encoder signal "A" . Both these edges need to work with the signal "count". I have this error : Error (10028): Can'...
Altera_Forum
Honored Contributor
10 years agoHello Tomsik,
I had a similar problem some time ago. The trick i used is to generate the flank detections on an internal FPGA clock. This clock is normally a lot faster than the ecoder timing, so it should not be a problem. wire a; wire b; assign a = KEY[0]; assign b = KEY[1]; reg aPrev; reg bPrev; always @(posedge CLOCK_50) begin // mounting flank on A if (a > aPrev) begin if (b==0) r <= r+1; else r <= r-1; end // descending flank on a if (a < aPrev) begin if (b==1) r <= r + 1; else r <= r - 1; end aPrev<=a; bPrev<=b; end Best Regards, Johi.