Output DE of a Timer |
Top Previous Next |
You can connect any word-variable to this output of the timer. Into this variable the current value of the timer is transfered continously. For simple PLC programs this is not needed.
At this output the current value of the timer is displayed BCD-coded together with the time base with which the timer was started. That means that you can use it directly to start another timer.
If you want to convert the selected duration in ms you will be able to program the following STL-code, for example:
LC Tx // 0 < x < 511; LC = Load coded T #TimeW // #TimeW is declared as word-variable L W#16#0FFF // Mask for BCD-coded rough-value UW // fade out most significant nibble BTI // BCD - INT converting T #Roh // #Rough is declared as Int-variable L #ZeitW // intermediate saved value SRW 12 // shift 12 bits to the right side SPL err // Jump list SPA R0 // Time base 10 milli seconds SPA R1 // Time base 100 milli seconds SPA R2 // Time base 1 second SPA R3 // Time base 10 seconds err : NOP 0 R0 : L 10 // 10 milli seconds the value SPA Mul R1 : L 100 // 100 ms SPA Mul R2 : L 1000 // 1.000 ms = 1 s SPA Mul R3 : L 10000 // 10.000 ms = 10 s Mul : L #Roh *D // Attention! The result can be > 32767 // Now the time in milli seconds is binary-coded as 32 bit- number in accu 1.
|