3-5 Programming and Transfer
This section describes how to program the DB Connection Service, DB Connection Instruction
set, and system-defined variables.
Refer to Sample Programming of each DB Connection Instruction given in Appendix for
programming examples.
3-5-1 Programming the DB Connection Service
Use the following procedure to program the DB Connection Service.
1. Select a DB Connection Instruction from the DB Connect instruction category of the Toolbox
to the right of the program editor of Sysmac Studio.
Write the DB Connection Instructions in the following order.
1. Initial Processing
1-1. Write a DB_ControlService (Control DB Connection Service) instruction when you
start the DB Connection Service using the instruction*.
* This instruction is not required if the DB Connection Service is automatically started when the
operating mode of the CPU Unit is changed to RUN mode.
1-2. Write a DB_Connect (Establish DB Connection) instruction.
1-3. Write a DB_CreateMapping (Create DB Map) instruction.
2. Processing during Operation
*1
2-1. Write a DB_Insert (Insert DB Record), DB_Update (Update DB Record), DB_Select
(Retrieve DB Record), or other instruction.
3. End Processing
3-1. Write a DB_Close (Close DB Connection) instruction.
4. Power OFF Processing
*2
4-1. Write a DB_Shutdown (Shutdown DB Connection Service) instruction.
*1 When you continuously execute DB_Insert (Insert DB Record), DB_Update (Update DB
Record), DB_Select (Retrieve DB Record), and other instructions, repeat the 2. Processing
during Operation.
*2 Be sure to execute a DB_Shutdown (Shutdown DB Connection Service) instruction before
you turn OFF the power supply to the system. If the power supply is turned OFF without
executing a DB_Shutdown (Shutdown DB Connection Service) instruction, the Operation Log
file may be corrupted or its contents may be lost.
2. Check the status of the DB Connection Service with a system-defined variable.
The status can be Running in Operation Mode, Running in Test Mode, Idle, Error, or
Shutdown.
3. Transfer the DB Connection settings and user program.
Transfer the DB Connection settings and user program to an NJ/NX-series CPU Unit.
4. Cycle the power supply to the Controller.
When you have changed the database type to connect, cycle the power supply to the
Controller.