Applies To: |
|
Summary: | ||||||||||||||||
Discussion on %N and %R operators as well
as the new %N+ operator. These operators are used for drivers
which require the variable.dbf record index to allow them to
retrieve the actual tag record.
%N ensures that the variable.dbf record number is placed in the address values passed to the driver. By default, Citect tries to block tags together . So the following tag definitions
are likely to result in a blocked read of 3 items, with ADDR 10 UNIT 2000 COUNT 3 For these type of drivers, this is not desirable. This is where the %R operator comes in, it adds the record number to the address field, effectively disabling compiler blocking and yielding %N%R will yield
ADDR 10 UNIT 2010 COUNT 1 ADDR 11 UNIT 2011 COUNT 1 ADDR 12 UNIT 2012 COUNT 1 However, the %N operator is prone to incorrect blocking when a general template is used, much as (in driver.DBF) %N%! INT 1000 %N%! REAL 2000 %N%! LONG 3000 In this case it is possible that tags of different data types will be blocked together . It is also possible to generate redundant requests for data based on the address value of the tag. |
Solution: | ||||||||||||||||||||||||||||||||
The %N+ operator solves both these
problems. It tells the compiler to group items together ONLY if the
TAG data type matches the data type in the template file.
Thus using %N+ is recommended, even with the %R operator. An
issue to remember when trying to block tag references together is
that it is possible to get blocking wrong for your requirements,
e.g.
%N or %N+ is likely to result in a count of 7 at ADDR 50, which is fine if these are the same, but if ABCxxx needs to be handled differently to DEFxxx, you need to ensure they have different UNIT values. To ensure all tags to be blocked are correctly, arrange tags to be contiguous in the variable tag database. In this case EXCEL can be used to insert tags into the project when new tags are required. Citect only adds tags to the end of the database. NB: Ensure you save any EXCEL DBF files in DBF III format. |
Keywords: |
Related Links
Attachments