5/24/2020 10:41 AM | |
Joined: 3/16/2015 Last visit: 10/10/2021 Posts: 1250 Rating:
|
I played around with your sample program a bit and re-attched it with a few changes. Counter is now setup for A/B four fold. Unchecked the option for for Syn. Added three hardware interrupts; for examples. One interrupt is triggered when reference value is reached. One interrupt is triggered on rising edge of digital input 0.6(or0.5 I already forgot) and another with digital input .07. One interrupt retrieves the current counter value that you can use as I described earlier. The other interrupt is another idea you can use to reset the counter instead of my previous idea of letting the counter to roll over; if you prefer to reset the counter you can use a digital input rising edge to trigger an interrupt that calls HSC to reset the counter which should be fast. Theoretically speaking calling HSC instruction is slower than a simple move instruction but I will guess not by more than a few microseconds. Another thing I was thinking about and haven't tried yet is to connect the Z phase to a digital input (of course) and set it up with an interrupt as I described and use it exactly as an input device with either of the interrupts I described earlier to either capture the count value or reset the counter. AttachmentSample for forum_back.zip (121 Downloads) |
Follow us on