3/4/2010 1:19 PM | |
Joined: 10/7/2005 Last visit: 6/16/2024 Posts: 3008 Rating:
|
Hello ryan3 you didn't say how many pulses you expect to get in a certain timeframe soto start with I'd like to advise you that a standard Digital Input needs some 5 ms to registera 0->1 transition (and if the DI is on a Profibus remote I/O station you mayneed to take the Profibus update time into account too). You'll also need to consider the cycle time of your program(or the call frequency of your cyclic interrupt OB) to avoid "missing"pulses. Let's assume you the above is all good and you'll expect a maximum of 20 pulses per second, your logic would in principle be quite simple and do the following: Count the number of pulses that you receive in any given second (e.g. use an S5 Counter for this orInteger addition with a rising edge detection on the Input). When the second is "expired"take the countvalue, scale your 0-20 count valueto 0-27648(e.g via FC106 from the TI to S7 conversion library) write it to the Analogue output and start the next count cycle. Note that the above example means that you only update your AQ every second. Having said the above, if your input is rather fast changing, youwill be better off using a high speed counter card (e.g ET200M FM350-1 or350-2 or ET200S count module, the latter two also have inbuilt frequency measurement mode available which is exactly what you are after). Ihope this helps |
Cheers |
|
Follow us on