1/11/2011 7:26 AM  
Joined: 4/30/2010 Last visit: 10/6/2023 Posts: 43 Rating: (0) 
Hi, 2 pulses are getting in 1 revolution/minute. i need to convert pulse into 010000 rpm in s71200 
1/11/2011 10:32 AM  
Joined: 9/23/2005 Last visit: 5/28/2024 Posts: 4338 Rating: (1428)

Hi, there is two ways: 1  if you use HSC, you can configure the CPU to read directly frequency (type of counting). Multiply the read value (frequency) per 60, and you will be rpm. 2  Counting pulses by OB1 or also by HSC: Read the pulses in a cycle OB (e.g.OB200). Calcule the difference between actual counting and the last OB call counting. Then divide these "delta counting" per the cycle OB time (e.g. 100ms) and multiply it per 60. 
Denilson Pegaia 

This contribution was helpful to4 thankful Users 
1/12/2011 11:35 AM  
Posts: 79 Rating: (0) 
hi, thanks your reply, please send us sample program 
1/12/2011 11:36 AM  
Posts: 79 Rating: (0) 
hi, 10 rpm = 2 pulse 2 pulse input available 
1/18/2011 10:42 AM  
Joined: 9/23/2005 Last visit: 5/28/2024 Posts: 4338 Rating: (1428)

Hi, take a look also at: /tf/WW/en/Posts/22906#top 
Denilson Pegaia 

2/3/2012 11:32 PM  
Posts: 5 Rating: (0) 
Hello, I have configured a HSC to measure frequency. However i am not entirely happy with the resolution of the counter i.e it jumps from 15Hz to 16Hz even when the actual speed is 15.3....15.4.....15.7Hz etc. Could you elaborate on the method you mentioned above "2  Counting pulses by OB1 or also by HSC: Read the pulses in a cycle OB (e.g.OB200). Calcule the difference between actual counting and the last OB call counting. Then divide these "delta counting" per the cycle OB time (e.g. 100ms) and multiply it per 60." I would like to count a totalised pulse count and then time it over for example 10sec and then convert the number of pulse in ten sec to pulses per sec

2/6/2012 4:37 PM  
Joined: 9/23/2005 Last visit: 5/28/2024 Posts: 4338 Rating: (1428)

Hi, when you calculate frequency by "time window" method (i.e. counting a number of pulses and dividing it by a time interval), you will have always a max error = 1 / time window. You can get more or less error, changing the time windows. If you need more as it, you will need to calculate the frequency by the "inverse of period" method. In this method, the maxerror will be = 1 / time precision.However the S71200 HSC doesn't have this function... 
Last edited by: Pegaia at: 2/6/2012 4:38 PMDenilson Pegaia 

2/6/2012 9:51 PM  
Posts: 5 Rating: (0) 
Today i have set up a cyclic interrupt that moves the calue after 20 sec to a memory location and also sets the CV on the HSC Ctrl Block to zero. As i am both MOVE a value and setting the CV to zero in the one OB will this case me a problem. i.e will the HSC value go to zero before the value is moved to the memory location? is it necessary to used an interrupt after each pulse as eazh individual pulse is counted by the HSC? one last question, I have a Value that is a MD1000 i.e Dint. I want to divide this value by 2. the MD1000 value may be any integer between 1 and 600. However when i divide a random value by 2 e.g 245/2 = 112.5. however i dont get the decimal of 0.5 i only get a whole number of 112 or 113. it there any way of including the decimal point in the division calculation?

2/7/2012 10:43 AM  
Joined: 9/23/2005 Last visit: 5/28/2024 Posts: 4338 Rating: (1428)

Hi, about round problem: convert both numbers to real (float point) before to divide. Make a real division. So, you doesn't loose the decimal cases. About interruptions: You don't need to reset the value. You can alternativaly make the follow logic in cyclic OB, for example: atual:= ID1000:P delta:= atuallast if delta<0 then delta =delta + 2147483647 ' (2^311) frequecy = delta/ delta time'delta time is a constant last:= atual 
Denilson Pegaia 

4/25/2012 1:35 PM  
Joined: 8/22/2011 Last visit: 5/8/2024 Posts: 47 Rating: (1) 
Hi, I have a very similar task to solve. I need to calculate mm per cycle. I'm using HSC to count pulses. 1 pulse = 1mm. HSC counts to 10 and then resets to get cm (I would count mm but reseting HSC every 1 count didn't work on great speeds). I've set cycle interrupt to occur every 10ms and now I would like to try implement something like Pegaia explained above:
But I'm concerned about negative delta. Why adding 2147483647? For example if last value is 8 and current value is 2, delta is 6. If I add 2147483647 delta is too high. 
Follow us on