dilnger Posted December 17, 2004 Report Posted December 17, 2004 Hi All, I need help programming. I am using a s7-222 and a Dart Digital encoder, and I need to calculate rpm of a motor. thanks, dyLAN
Crossbow Posted December 17, 2004 Report Posted December 17, 2004 What kind of signal is the digital encoder giving you? i would simply count the pulses on a high speed input for 2 seconds and multiply by 30. Then divide that by the number of pulses per revolution from the encoder. Might not be the absolute most accurate method, you're only going to get new values after 2 seconds but it's a fairly simple answer to the problem.
DesertDog Posted December 20, 2004 Report Posted December 20, 2004 (edited) If it's pulses unless the frequency is very high I just read the time between pulses and figure the RPM from that. Pulse P One Shot ----| |---------| |-----------( ) One Shot ----| |------------(Divide 600 by Timer Value) ------------|-----|-- | TMR | One Shot | 0.1S| ----| |-----|Reset| |_____| This will find the current RPM and reset the timer with the leading edge of the pulse. Accuracy can be adjusted by moving the decimal And/Or creating multiple pulses per revolition and adjusting the math accordingly. Edited December 20, 2004 by DesertDog
dilnger Posted December 27, 2004 Author Report Posted December 27, 2004 The Output is a square wave with 10 pulses per revolution.
khekd Posted January 14, 2005 Report Posted January 14, 2005 You could do a timed interupt which is event # 21. This timed interupt happens when T32 (1ms timer) CT=PT. And then when the interupt occurs put the code for your math within that interupt routine by taking your HC### CV and doing whatever math is needed for your rate. Go to the ATCH instruction on the left tree and hit F1 for help and then looking for event priorities.
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