CobryWZL Posted May 28, 2020 Report Posted May 28, 2020 Hi guys, I am using a HSC to count pulses of a square wave signal, thats comes to my SAMBA (43 J-T20 ) through I0. Therefore I configured the I0 in HWConfigutatione as HSC and it counts very well. Now I want the HSC counter value to reset , if a vertain event happens. For example if i hit a RESET button on the touchscreen, I want the HSC value to reset to 0. I tried numeric reset and immidiate Reset HSC but both didnt work so far. I think the HSC with Reload is a possibility to use the reload as a reset, but i dont have a fix value when the HSC counter should reset. So this reload ability doesnt work for me neither. Do you have any suggestions? Thanks!
MVP 2023 Joe Tauser Posted May 28, 2020 MVP 2023 Report Posted May 28, 2020 You should be able to just use a Store block when you press RESET to put a 0 in the counter register. If this doesn't work upload your program. Joe T. 1
Mirko Posted May 28, 2020 Report Posted May 28, 2020 5 hours ago, CobryWZL said: Hi guys, I am using a HSC to count pulses of a square wave signal, thats comes to my SAMBA (43 J-T20 ) through I0. Therefore I configured the I0 in HWConfigutatione as HSC and it counts very well. Now I want the HSC counter value to reset , if a vertain event happens. For example if i hit a RESET button on the touchscreen, I want the HSC value to reset to 0. I tried numeric reset and immidiate Reset HSC but both didnt work so far. I think the HSC with Reload is a possibility to use the reload as a reset, but i dont have a fix value when the HSC counter should reset. So this reload ability doesnt work for me neither. Do you have any suggestions? Thanks!
Pavel M Posted May 29, 2020 Report Posted May 29, 2020 Depends on what you read with a high-speed counter. If this is an encoder that rotates with the engine, in your program you can stop the engine at the same time and write 0 to the encoder variable, but the inertia remains and the variable of the high-speed counter changes by a certain number of units even if you set EndSub right after this event So, probably, if you need 0 in your counter, you need to wait some time after you stop some output, which changes your counter and only after this task store 0 in hsc variable
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now