It is unbelievably easy to perform frequency measurement using the T100MD pulse measurement capabiliy
. All you need to do is to execute the PMON 1 function once to enable input #3 as a frequency measurement input. Once enabled, you then simply use the PULSEFREQUENCY(1) function to read the frequency of the pulses appearing at the input #3. E.g.
F = PULSEFREQUENCY(1)
SETDAC 1,F ' direct output without scaling.
You can measure from 1 Hz to 10000 Hz. You can either execute the above function every scan or use a clock pulse to periodically read the pulse frequency.
The value read into F can then be scaled to whatever value you want or output directly to the analog output using the SETDAC command as shown in the example above.
However, IMHO, using the analog I/O as interface between the PLC and the microcontroller is not exactly the best method. You could actually design your own communication protocol in the microcontroller so that the frequency value read by the T!00MD+ PLC can be transfered to the microcontroller using the RS485 port without incurring any potential inaccuracy introduced by the analog interface.