1. Classification System of Data Transfer Instructions
1. Single Word Transfer Instructions
MOV 16-bit Data Transfer Sensor Value Reading
DMOV 32-bit Data Transfer Counter Value Storage
CML Data Inversion Transfer Signal Logic Inversion
2. Block Transfer Instructions
BMOV Continuous Register Batch Transfer Recipe Parameter Loading
FMOV Fixed Value Filling Register Device Parameter Initialization
3. Data Exchange Instructions
XCH Register Data Exchange Temperature Upper and Lower Limit Value Swap
SWAP Register High and Low Byte Exchange Communication Data Format Conversion
2. Core Instruction Practical Cases
Case 1: Sensor Data Acquisition System
Read the pressure sensor value (0-10V corresponds to 0-1000kPa) every 5 seconds, and store it in register D100
// Timed reading of pressure value
LD M8013 // 5-second pulse
FROM K0 K0 D100 K1 // Read analog module CH0 to D100
MOV D100 D200 // Backup original data
CML D200 D300 // Invert and store in D300 (for reverse control)
Key Parameters:
FROM K0 K0 : Read the first analog module CH0
K1 : Read 1 data (16-bit)
Case 2: Equipment Recipe Management System
The device supports 3 types of production recipes
Automatically load parameters by selecting the recipe number via the touchscreen
// Recipe selection and loading
LD X0 // Recipe 1 selection
BMOV D100 D200 K5 // Load 5 parameters to D200-D204
LD X1 // Recipe 2 selection
BMOV D150 D200 K5
LD X2 // Recipe 3 selection
BMOV D200 D200 K5 // Self-holding (current recipe)
Optimization Points:
Use BMOV to achieve batch data transfer, reducing code volume
Recipe parameters stored in D100-D199 for easy expansion
Case 3: Register Initialization System
Initialize all parameter registers when the device is powered on
Set all D100-D199 to zero
// Power-on initialization
LD M8002
FMOV K0 D100 K100 // Fill 100 registers with 0
Notes:
– K100 indicates filling 100 consecutive registers (D100-D199)
– Avoid overlapping with other data areas
Case 4: Communication Data Format Conversion
Receive 16-bit data from the frequency converter (high and low byte order reversed)
Convert to the correct format and store in D100
// Data format conversion
RS D0 D10 K2 K2 // Receive 2-byte data to D10-D11
SWAP D10 // Swap high and low bytes of D10
MOV D10 D100 // Store in D100
Key Steps:
1. Receive raw data via RS instruction
2. Adjust byte order using SWAP instruction
3. Store result using MOV instruction
3. Advanced Application Techniques
1. Dynamic Address Transfer
// Select target register based on the value of D0
MOV K100 D[D0] // D0=0→D0=100, D0=1→D1=100
2. Data Block Copy
// Copy data from D100-D109 to D200-D209
BMOV D100 D200 K10
3. Data Encryption Transfer
// XOR encryption for transmitted data
XOR D100 K123 D200 // Key is 123
4. Common Issues and Solutions
Issue 1: Abnormal values after data transfer
Reason: Register address exceeds range (FX3U data register maximum D9999)
Solution: Use extended registers (D1000-D7999 require battery backup)
Issue 2: Data loss after BMOV transfer
Reason: Source register and target register addresses overlap
Solution: Ensure source address < target address for correct transfer direction
Issue 3: SWAP instruction ineffective
Reason: Used 32-bit registers (e.g., DD10 composed of D10 and D11)
Solution: Use DSWAP instruction for 32-bit data
5. Pitfall Guide
⚠️ Prohibited Actions:
1. Cannot use MOV instruction on bit elements (X/Y/M/S)
2. When BMOV transfer quantity exceeds 256, use D-BMOV
3. SWAP cannot be used with 32-bit instructions simultaneously
💡 Optimization Tips:
1. Add checks (e.g., XOR check) for important data transfers
2. Use D-MOV to transfer 32-bit data (e.g., timestamps)
3. Monitor register values (e.g., D100) in real-time on the touchscreen
Next Issue Preview:
“Practical Arithmetic Operation Instructions for Mitsubishi PLC” – From simple addition and subtraction to complex PID algorithms, teaching you how to make PLC learn “mathematical thinking”! Follow me to unlock new industrial computing skills~