32-Bit Forward Counter of Module DC541-CMΒΆ

The 32-bit forward counter functionality is provided by the block DC541_FWD_CNT: DC541_FWD_CNT

The function block DC541_FWD_CNT provides a 32 bit count-up counter which is able to count a maximum frequency of 50 kHz at the inputs C0 and C1 or 5 kHz at the inputs C2-C7. In the DC541, the counter is implemented as a 16 bit counter. The actual counter value ACT_CNT is bulit inside the function block by adding the counter differences that occur within the individual cycles. In order not to loose any counting pulses, the function block has to be called cyclically.

  • Channel 0-1: 50 kHz max. -> 32767 / 50 = 655 ms
  • Channel 2-7: 5 kHz max. -> 32767 / 5 = 6550 ms

Using the counter e.g. in a 100 ms task will prevent any loss of counting pulses.

Operating modes

  • Infinite counter (endless mode)
  • Limiting counter (limit mode)

The operating mode is selected at input EN_LIM.

If EN_LIM = FALSE, the counter operates as an infinite counter (endless mode). An overflow occurs corresponding to the 32 bit value at 16#FFFFFFFF = 4 294 967 295. In this mode, any exceeding of the limit value LIM_MAX or falling below the limit value LIM_MIN is displayed at the outputs MAX_LIM or MIN_LIM.

If EN_LIM = TRUE (limit mode), the counting range is between the limit values LIM_MIN and LIM_MAX. In case of an overflow,  i.e. if LIM_MAX is reached, the counter restarts again at LIM_MIN.

The upper limit value LIM_MAX has to be higher than the lower limit value LIM_MIN. If LIM_MIN is higher than LIM_MAX, an error is displayed.

The device DC541 must be configured as counting device (counter mode).

The function block has an integrated visualization which can be used to control all function block functions in parallel to the user program, if input EN_VISU = TRUE.

Function blocks for the most module functions of DC541-CM are contained in the library DC541_AC500_V11.lib. The library is automatically included into the project and is described in detail in the library documentation DC541_Library: DC541 Library