Beijer ELECTRONICS SER0056 iX Detect USB Stick and SD Card User Guide

June 8, 2024
Beijer ELECTRONICS

Quick start guide
iX Detect USB stick and SD card
SER0056 – iX example project

Beijer ELECTRONICS SER0056 iX Detect USB Stick and SD
Card

Function and area of use

This document shows how to check whether USB or SD media are inserted into the X2 panel.
The time for the cyclic check is adjustable inside the script module.

About this document

This quick start document should not be considered as a complete manual. It is an aid to be able to startup a normal application quickly and easily.

Copyright © Beijer Electronics, 2021
This documentation (below referred to as ‘the material’) is the property of Beijer Electronics. The holder or user has a non-exclusive right to use the material. The holder is not allowed to distribute the material to anyone outside his/her organization except in cases where the material is part of a system that is supplied by the holder to his/her customer. The material may only be used with products or software supplied by Beijer Electronics. Beijer Electronics assumes no responsibility for any defects in the material, or for any consequences that might arise from the use of the material. It is the responsibility of the holder to ensure that any systems, for whatever applications, which is  based on or includes the material (whether in its entirety or in parts), meets the expected properties or functional requirements. Beijer Electronics has no obligation to supply the holder with updated versions.

Use the following items in order to obtain a stable application:

In this document we have used following software and hardware

  • iX Developer 2.40 SP5 / SP6
  • X2 base/pro/marine/control/extreme series

For further information refer to

  • iX Developer Reference Manual (MAxx831)
  • iX Developer User’s Guide (MAxx832)
  • Beijer Electronics knowledge database, HelpOnline

This document and other Startup documents can be obtained from our homepage.
Please use the address support.europe@beijerelectronics.com for feedback about our Startup documents.

The iX example project

The cyclic check for USB and SD media is done inside the script module SCM_USB_SD_Check.

4.1 The Script Module
Inside the script module the following Namespace is inserted additionally to enable access to the file system.
using System.IO;
Every iX script module brings a “Created” method with it, which is perfect to initialize stuff as it is worked on exactly once at the start of the iX project.

// The method is invoked when the script module object is created.
void SCM_USB_SD_Check_Created(System.Object sender, System.EventArgs e)
{
m_Timer= new Timer();
m_Timer.Enabled = true;
m_Timer.Interval = 1000;
//ms – adjust time for cyclic check here.
m_Timer.Tick += OnTimerTick;
}

// The method is invoked when the script module object is created.
void SCM_USB_SD_Check_Created(System.Object sender, System.EventArgs e)
{
m_Timer= new Timer();
m_Timer.Enabled = true;
m_Timer.Interval = 1000;
//ms – adjust time for cyclic check here.
m_Timer.Tick += OnTimerTick;
}

// Cycle
private void OnTimerTick(System.Object sender, System.EventArgs e)
{
if(Directory.Exists(“\\Hard Disk”))
// Check if USB key is connected
Globals.Tags.USB_plugged_In.SetTag();
// Set tag if connected
else
Globals.Tags.USB_plugged_In.ResetTag();
// Reset tag if disconnected
if(Directory.Exists(“\\Storage Card”))
// Check if USB key is connected
Globals.Tags.SD_plugged_In.SetTag();
// Set tag if connected
else
Globals.Tags.SD_plugged_In.ResetTag();
// Reset tag if disconnected
}

Adding the USB SD media Detection

Implementation

  1. Import the script module “SCM_USB_SD_Check” , see example project (iX_Detect_USB_SD_V1_0_0).

  2. Create the Tags “USB_plugged_in” and “SD_plugged_in” with Datatyp BOOL.
    Beijer ELECTRONICS SER0056 iX Detect USB Stick and SD Card - Fg
1

  3. Optionally import Screen1 of the example project (iX_Detect_USB_SD_V1_0_0).

  4. Adapt the screen to your needs.

  5. Transfer the application.

  6. Run the application.

5.1 Import the project parts

Follow the steps to add the enclosed screen and the script module to your iX project:

  1. Unpack the enclosed example ZIP-file to a temporary folder.
  2. Start iX Developer and load your project.
  3. In the Project Explorer, right-click in the lower left corner (1. in the picture)
  4. In the list, select Import… (2. in the picture)
  5. Navigate to the temporary folder, where you unpacked the ZIP-file and select SCM_USB_SD_Check.neo, click [Open].
  6. Select Screen1.neoxaml, click [Open].
  7. Done!

About Beijer Electronics

Beijer Electronics is a multinational, cross-industry innovator that connects people and technologies to optimize processes for business-critical applications. Our offer includes operator communication, automation solutions, digitalization, display solutions and support. As experts in user-friendly software, hardware and services for the Industrial Internet of Things, we empower you to meet your challenges through leading-edge solutions. Beijer Electronics is a Beijer Group company.
Beijer Group has a sale over 1.6 billion SEK in 2019 and is listed on the NASDAQ OMX Nordic Stockholm Small Cap list under the ticker BELE. www.beijergroup.com

Beijer ELECTRONICS SER0056 iX Detect USB Stick and SD Card - Fg
3

6.1 Contact us
Global offices and distributors

References

Read User Manual Online (PDF format)

Read User Manual Online (PDF format)  >>

Download This Manual (PDF format)

Download this manual  >>

Beijer ELECTRONICS User Manuals

Related Manuals