Bring Values and Sucesses To Our Customers

Home / Support and services / Technical Support

Technical support

Technical Support

Motion Control Quick Start (12) | How To Use U Disk Interface For Zmotion Motion Controller?


Motion Control Quick Start Knowledge keeps moving.
Before, we had learned: 
quick start (1) -- firmware update
quick start (2) -- ZBasic program development
quick start (3) -- ZPLC program development
quick start (4) -- Communicate with HMI
quick start (5) -- IO Input & Output 
quick start (6) -- Data Storage
quick start (7) -- ZCAN Expansion Module
quick start (8) -- EtherCAT Expansion Module
quick start (9) -- Oscilloscope
quick start (10)--Multiple Task Operation
quick start (11)--Interrupt Application on Zmotion motion controller

Hi, everyone, nice to meet you.

As we all know, U disk is usually used to help us process data in PC. Also, for our Zmotion motion controller, some U disk operations need to be applied, importantly, it can rapidly complete some operations in actual applications. Therefore, today let's learn knowledge about some basic U disk operations of Zmotion motion controller, here includes word description, example description and vedio description. Let's begin.

1. Material Preparation

--Materials--

(1) One computer with ZDevelop3.01 or above installed.

(2) One controller.

(3) One 24V DC power supply

(4) Several bus drive + motor (or stepper drive + motor).

(5) A number of controller wiring terminals.

(6) Several network cables.

(7) A number of connecting wires.

(8)  Several expansion modules of different types.

--Wiring Reference--

1.png





2.  U Disk Introduction

(1) U Disk Main Applications

There are two main applications for our Zmotion motion controller U disk.

And generally, usage methods of U disk interfaces on different controller models are the same.

That is, insert U disk into UDISK terminal of controller, then power on the controller. When U disk indication led lights, which means it is successful.

Then, let me show what are the main applications for the U disk?

--upgrade program--

Through this U disk interface on controller, users can update system program conveniently.

Before upgrading, download ZAR program package into U disk. Then, when succeeds in loading U disk file through the command, ZAR program will automatically run.

--interact data between U disk and register--

U disk can read and write variables and arrays.

Flash can copy the data, then in multiple controllers, data saved in FLASH can be transferred by U disk.

The same, data in VR register, in TABLE register and data in U disk all can be interacted.

For files that can be read and written are SD(filenum).BIN or SD(filenum).CSV, but different file types are with different commands.

Next, let's see details about commands.

 

(2) U Disk Read & Write Commands

U_STATE: judge the U disk state, when detects there is the U disk inserted, return to "TRUE", otherwise return to "FALSE".

--U disk reads and write variables, arrays--

U_READ: read data from U disk into variables or arrays.

U_READ2: read data from U disk into variables or arrays, and reading initial position can be selected.

U_WRITE: save variables or arrays, one single element or some elements in array are saved into external storage.

--U disk interacts with data in registers--

Note: data reading and writing through U disk is same format with TABLE and VR.

STICK_READ: read data from U disk into table.

STICK_WRITE: copy data from TABLE into U disk.

STICK_READVR: read data from U disk into VR.

--U disk reading and writing examples--

Firstly confirm U disk has been inserted, then use U_STATE command to judge U disk status, next operate reading and writing.

Instructions: U_READ, U_WRITE.

Examples:

DIM a,ARRAY1(2)   'define variables, arrays

a=123

ARRAY1(0)=10

ARRAY1(1)=20  

IF  U_STATE = TRUE THEN   'judge whether U disk is inserted

      U_WRITE 0,a,ARRAY1     'write variables and arrays into U disk

      a=456

      ARRAY1(0)=11

   U_READ  0,a,ARRAY1     'read U disk file SD0 data

 

      IF a <> 123 THEN       'judge whether U disk reads and write successfully

             PRINT "U Disk Fails to Read"

      ELSE

             PRINT "U Disk Succeeds to Read"

      ENDIF      

ELSE

      PRINT "U Disk Uninserted"

ENDIF

 

Attention: the order of storing and reading data in the U disk must be consistent.

And when there is no controller, the simulator can be used to create a new udisk file in the root directory of the programming software to simulate a U disk. Put the files to be used in the command operation of the U disk into this folder.

2.png




3.  Interrupt Routine

(1) FILE instructions of U disk corresponding operations.

--U disk zar file operation--

FILE "LOAD_ZAR", "main"        'download main.zar package of U disk.

FILE "FIND_FIRST", ".zar", 0     'find zar package from U disk, return to vrstring(0).

FILE "FIND_NEXT", 10              'find next zar file, the result is saved into vrstring(10).

FILE "FIND_NEXT", 20              'find next zar file, the result is saved into vrstring(20).

 

--U disk and FLASH data operation--

FILE "COPY_FROM", "sd0.bin"  'copy flash 0 data of controller into U disk.

FILE "COPY_TO", "sd0.bin"       'copy sd0.bin data of U disk to controller flash.

And FLASH block No. and SD file No. are corresponding, no need to specify.

 

--delete U disk files, bin file and z3p file can be deleted--

FILE  "DELETE" , "sd0.bin"         'delete the file in U disk whose name is sd0.bin

 

--load U disk files through byte method, and support reading multiple types of files--

FILE "LOAD_BYTE", "00.txt", 200, 10, 0

'read the file named 00.txt on the U disk, convert the read result into ASCII code, and store it in the 10 spaces starting from TABLE (200).

The last parameter offset is the byte offset at which the file starts to be read. Set it to 0 to start reading from the first character, set it to 1 to start reading from the second character and skip the first character. For details, see following program demo.

txt file content: ZMOTION

Read Result:

3.png

TABLE(200): total bytes

TABLE(201): the first byte read

TABLE(202): the second byte read

TABLE(200+n): the Nth byte read

 

(2) U disk routine

This routine uses HMI configuration to transfer MODBUS_BIT bit register values to control U disk instructions. Below shows the routine, if you need to know more, or need the full version, please contact us.

4.png

5.png

6.png

 

(3) HMI Interface:

7.png

When there is no touch screen, open ZDevelop programming software, find the "screen" folder in root directory, and open xplcterm application program, connect to controller, in this way, it can do touch screen simulation.

The last but not least,  there is the video description for you, please enjoy and hope you "like" it. Thank you.




ABOUT ZMOTION

That's all, thank you for your reading -- Motion Control Quick Start (12) | How To Use U Disk Interfce For Zmotion Motion Controller

For more information, please pay close attention to "Support"  and   "Download" , and there are other platforms about Zmotion - Youtube   &   LinkedIn   &   Twitter    &   Tiktok    &   Facebook including technical information (development environment, routine code), product showing, company development, etc.

Hope to meet you, talk with you and be friends with you.  Welcome!

This article is edited by ZMOTION, here, share with you, let's learn together.

ZMOTION: DO THE BEST TO USE MOTION CONTROL.

Note: Copyright belongs to Zmotion Technology, if there is reproduction, please indicate article source. Thank you.

Zmotion Technology focuses on development of motion control technology and general motion control products, it is a national high and new technology enterprise. Due to its concentration and hard work in motion control technology, ZMOTION already become one of the fastest growing industrial motion control companies in China, and is also the rare company who has managed core technologies of motion control and real time industrial control software completely. Here, Zmotion provides motion controller, motion control card, vision motion controller, expansion module and HMI. In addition, there is one program software developed by Zmotion -- ZDevelop. It is a good choice for you to program and compile. And program through upper computer, there is PC manual.

Zmotion Technology  provides motion control card, motion controller, vision motion controller, expansion module and HMI. ( more keywords  for Zmotion: EtherCAT motion control card, EtherCAT motion controller, motion control system, vision controller, motion control PLC, robot controller, vision positioning...)

Have a good day, best wishes, see you next time.


2013-2023 版权所有 Zmotion Corp. Copyright Reserved 粤ICP备13037187号-1