
FAQ (Frequently Asked Questions)
DP Base Programming Interface for CP 5613/CP 5614
C79000-G8976-C108-01
209
What are the disadvantages of simply polling in the user program?
If your user program does not restrict itself, the entire available CPU performance
of the of the PC will be used to query the process image unnecessarily often. If the
program restricts itself too much, on the other hand, the data will no longer be up to
date. We recommend that you restrict polling using a time control suitable for your
system.
What are the advantages of hardware events ?
Your user program can react to changes quickly. Since it waits, it does not take up
unnecessary CPU time on the PC.
What are the disadvantages of hardware events?
If your user program monitors a large number of active slaves using hardware
events, the overheads for fetching events is high because semaphores must
constantly be incremented and run through. This increases PC-CPU load. If you
therefore have a lot of slaves or very active slaves, we recommend that you use
hardware events for only a few slaves and poll the others periodically.
What are the advantages of programming with multiple threads?
With multiple threads, you achieve a clearer structure in your user program. This is
particularly useful when you want to run different processes at the same time, for
example, periodic polling combined with hardware events on the one hand and
asynchronous DPC1 jobs on the other. These unrelated tasks with their different
dynamic characteristics can be implemented in two threads.
What are the disadvantages of programming with multiple threads?
The threads of an application, for example, must not interfere with each other when
accessing global variables. Overwriting data and deadlocks must be avoided. It is
particularly important to avoid multiple threads accessing the process image of the
CP 5613 or CP 5614 at the same time otherwise they will overwrite the each
other's control register for consistent reading and writing of slave data. This could,
for example, jeopardize the consistency of the slave data currently being read by a
thread.
Komentáře k této Příručce