Solution when data collection or alarm sampling addresses are not continuous

Question: When we create sampling addresses in data acquisition, how to solve the problem when the addresses are not continuous?

  • Create a new project
  • Right-click the data acquisition in the software system parameters and create a new data acquisition
  • 3. Set the data acquisition name to shuju, the sampling length to 5, the total number of samples to 2000, the sampling address to D0, and the sampling method to timing 1 second.
    The sampling length is 5, which means there are 5 sampling addresses, namely D0–D4 (the sampling addresses are continuous by default) and a total of 2000 data are sampled, and data is collected from D0–D4 addresses once per second.
  • If the sampling length is still 5, and the sampling addresses are D0, D3, D7, D9, and D13, how to set the sampling address? (The solution through macro instructions is as follows)

(1) Turn on data acquisition and first set the sampling address to the internal address of the touch screen. For example, for LW100, the sampling length is set to 5 and the total number of samples is set to 2000 (as shown in the figure below). This means that the sampling address is LW100–LW104

(2) Use macro instructions to transfer the data of D0, D3, D7, D9, and D13 to LW100–LW104 respectively. The data collected in this way is the data of PLC.
(3) Click Add on the software menu bar and select Open Macro Instruction Compiler

(4) Create a new macro command and name it shuju
(5) Create a variable name D0 address, as shown in the figure below. Double-click to create a new macro command.

(6) Write the following macro instructions
LocalWord[100]=D0;
LocalWord[101]=D3;
LocalWord[102]=D7;
LocalWord[103]=D9;
LocalWord[104]=D13;

(7) After the macro is written, click Compile. After the compilation is successful, close the macro.

(8) Click Global Macro in System Parameters, then click Add, select shuju as the macro name, and click OK

Leave a Comment