Industrial Automation
Industrial Automation | Europe

myKnowledge

Main > Product Type > Automation Systems > HMI
Minimize Text   Default    Enlarge Text
 

Print
E-mail

NB Data Log With USB Memory Removal Detection


Objectives

This article demonstrates detection of USB memory stick removal while logging data with the Data History component in the NB HMI.

Introduction

The NB HMI provides a powerful tool to log data to a mounted USB memory device. Abrupt or inadvertent removal of a USB memory device is not automatically detected and can be problematic. This article provides a simple solution to detect such a condition.

The NB-series HMI can log data read from the connected PLC(s) directly to a .CSV file on a USB stick inserted into the NB. By default, NB system bit LB9154 goes ON a few seconds after a USB stick is inserted, and this bit should be turned OFF (eg. via touch switch) prior to the USB stick being removed. But, if the stick is removed then LB9154 is not automatically switch OFF by the NB. This means that the NB cannot detect if a USB stick is removed inadvertently. However, by using a combination of a Data Transfer and 2 xTimer components, this functionality can be created in the user application.

 
The example provided was created with the following hardware and software.
  • - NB3Q-TW01B
  • - NB-Designer V1.45, project “NB Datalog with stick removal detection V1_01.nbp”
  • - CP1L-M30xxx with CP1W-CIF41
  • - CX-Programmer project “CP1L-M for NB datalogging demo V1_01.cxp”
Content
To achieve USB memory stick removal detection while logging data with the Data History component, an attached project created for the NB HMI operates as follows.
  1. A macro “macro_init” simply sets a value of 1 into LW0 on initialization of the NB.
  2. Screen/frame “1:Common Window” defines the following objects:

a. A Data History component to log 14 x REAL values from PLC address W0 – W27 and 2 x INT values from PLC address W28 & W29 to \trend\History Data\History Data.csv on a USB stick inserted into the NB every 5 seconds. These values are changed by the PLC program.
b. Data Transfer component DT0 that writes the value in LW0 to ERW0 when the NB has detected a USB stick (i.e. on the leading edge of LB9154, write 1 into ERW0 on the USB stick). Note that the Data Transfer component cannot write a constant value, only a variable hence the need of the initialization macro to set a variable LW0 to 1.
c. Timer component TM0 that triggers every second and copies ERW0 to LW9154 (if no USB stick is inserted, then no value is read and a value of 0 is written into LW9154)
d. Timer component TM1 that triggers every 2 seconds and copies bit 0 of LW9154 to LB9154 (hence, if no stick inserted then ERW0 cannot be read so LW9154 will be 0 so LB9154 will be forced OFF).
 

In addition (although not necessary), 2 x Event Settings are defined that detect a change in LB9154 to change Event Display scrolling text, and set/reset W201.00 in the PLC (The PLC then uses the state of W201.00 to change output 100.00 to indicate if data-logging is active or not). In this manner, the NB can indicate to the PLC that data-logging is active, or not.
 
Summary
The NB data logging function is a convenient method for storing data to an inserted USB stick. Detecting abrupt or inadvertent removal of the USB stick is important for the correct operation of this function. This article provides a simple solution with attached project example files.
 
Additional information can be found in the NB-Designer Operation Manual (Cat. No. V106). 
 
The details and references for this article were made at the time of NB-Designer Version 1.45. Newer versions may operate and function differently. Contact your local Omron representative for more information.

 

 



Attachments



Comments (View All Comments / Add Comment)

Related Articles
No related articles found.
Created 2014-01-21
Modified 2017-11-08
Views 18525

 

You are not logged in.