THIS IS THE LAST TIP I GIVE YOU ,IF YOU WANT MORE I AM GONNA CHARGE YOU OK? if you cannot do it let jaime do it he knows how.guys overhere dont know much about it but I know it you want it I want $$$$ here it goes:In the CPU cycle, it is not possible to measure speeds with sufficient accuracy in ranges that are usual in engineering.
Here you select a method that uses high-speed counters and a time interrupt (e.g. HSC3). The requirement here is that when the CPU is switched to "RUN" with the first cycle, the counter is initialized, the interrupt defined and assigned to the counter.
For this with the first cycle bit (S M0.1) you switch to a subroutine (e.g. subroutine 0), in which the time interrupt cycle is defined. Since the first cycle bit is only set in the first cycle after switching to the RUN mode, this interrupt setting is done only once.
Select, for example, Interrupt 0. The cycle time for the interrupt event 10 is written in SMB34.
In the example, Interrupt 0 is selected. You may only assign one specific interrupt to each process. You can of course increase the time interval of 10 milliseconds to any length you wish. When calculating the speed from the number of pulses you must take this interrupt time into account accordingly. The counter always stores the number of pulses per interrupt time interval in the variable double-word VD0. If your rotary pulse encoder delivers, for example, 50 pulses per revolution and your interrupt time interval is 10ms, then the rpm is calculated as follows:
(VD0 = number of pulses every 10ms) *6000 / 50.
For the pulses of your rotary pulse encoder to be transferred to the counter, you simply have to connect the signal output of your encoder to input E0.1 of the counter HC3. (If you want to use a different counter to the one in the example, it will of course have to be the input of the counter you choose).
just email me with a dollar bill in it and you will have the rite answer