The text of a manual · part 5 of 15
SYSMAC C200H-IDS01-V1/IDS21 ID Sensor Operation Manual: SECTION 2 Operation, pages 26 to 35
Pages 26 to 35 of 114, from SYSMAC C200H-IDS01-V1/IDS21 ID Sensor Operation Manual
The original document is the PDF (1.1 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.
For the Omron C200H-IDS01-V1
Page 26
SECTION 2 Operation This section describes operation of the ID Sensor Units, and covers switch settings, bit allocation, and communication commands, and introduces the user program. 2-1
Switch Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12
2-2
Word Settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13
2-3
The User Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
17
2-3-1
Communication Commands . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
19
2-3-2
Data Carrier Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
29
2-3-3
Write Protection Function. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
30
2-3-4
Write Protection Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
32
2-3-5
The Data Carrier’s Production Date . . . . . . . . . . . . . . . . . . . . . . . . .
36
2-3-6
Detection of Data Carrier’s Life . . . . . . . . . . . . . . . . . . . . . . . . . . . .
37
11
Page 27
Switch Settings
Section 2-1
Section Overview
2-1
This section contains information on switch settings, bit allocation, and setup of both ID Sensor systems, as well as explanations of the user program, communication commands, and the write-protect function.
Switch Settings
Unit Number Switch
Before beginning operation, use the unit number switch on the front panel to set the unit number (0 through 9) of the ID Sensor Unit. Each Special I/O Unit must be assigned its own number; if the same number is assigned to more than one Unit, an I/O Unit Over error will occur, preventing system operation. To set the unit number: 1,2,3...
1. Determine the appropriate unit number (refer to 1-5 System Connections for information on Special I/O Units). 2. Turn OFF the power to the PC. 3. Using a small standard screwdriver, turn the dial to the desired number. The dial clicks into position at each number setting; do not leave the dial between settings. IDS01-V1
Indicators Unit number switch (MACHINE No.)
MACHINE No
MONITOR
ANTENNA
Back Panel DIP Switch
12
(Refer to the diagram of the back panel on page 5.) Pin 1 is used to select the language of the Programming Console display; leave this pin at the ON (left) position for English message display. Pins 2 through 4 are for reserved for expansion; leave these pins at the OFF (right) position.
Page 28
Word Settings
2-2
Section 2-2
Word Settings Words 100 through 199 in the IR area of the PC are reserved for Special I/O Units. Each Special I/O Unit is assigned ten words, of which five are needed. These five words, used by the ID Sensor or other Special I/O Units for data communication, are referred to as I/O refresh data (stored in the I/O refresh data area). The five words that are not used can be used as work bits. PC (C200H)
ID Sensor Unit
IR area
I/O refresh words 100 through 104
Unit 0 words 110 through 114
Unit 1 words 120 through 124
Unit 2 words 130 through 134
Unit 3 words 140 through 144
Unit 4 words 150 through 154
Unit 5 words 160 through 164
Unit 6 words 170 through 174
Unit 7 words 180 through 184
Unit 8 words 190 through 194
Unit 9
I/O refresh data is transferred to each Unit.
words n through n+3
OUT refresh word n+4
IN refresh
5 words are used. (n = 100 + 10 x unit number)
Note Each Unit must be assigned a different unit number. If two or more Special I/O Units are assigned the same unit number, the system is unable to determine which Unit is to be accessed and an I/O Unit Over error occurs, halting the system.
13
Page 29
Word Settings
Section 2-2
IR Bit Allocation Word n n+1 (see note 2)
n+2 (see note 2)
00
Bit number
Bit name Command execution flag
Function At the leading edge of the signal, the ID Sensor Unit reads and executes the command.
01
Error reset flag
02 through 15
–
While the ID Sensor Unit is waiting for a command, the error reset flag is turned ON and the error flags in word n+4, bits 08 through 15 are turned OFF. Not used (see note 3).
00 through 11
No. of command data words
Indicates, in Binary Coded Decimal (BCD), the number of words in the command to be executed. The maximum number of words is 516 (see note 1).
12 through 15 00 through 11
– Command data storage area beginning word number
Not used (see note 3). Indicates, in BCD, the beginning word of the command to be executed (stored in the CPU). When the DM area exceeds DM 1000, turn ON bit 12.
12 through 15
Command data storage area
Indicates the area where the command to be executed is stored. Bit number
Area name
15
14
13
12
0
0
0
***
DM area
0
0
1
0
IR area
0
1
0
0
HR area
0
1
1
0
AR area
1
0
0
0
LR area
1
0
1
0
TIM/CNT
***When the DM area exceeds DM 1000, turn ON bit 12. n+3 (see note 2)
00 through 11
Read data receiving The CPU reads the data from the Data Carrier using Read or area beginning word Auto Read. Specifies the beginning word of the area (in the number CPU) where the data is stored. The data is ignored when Write, Auto Write, Clear-all, or Auto Read/Write Abort is executed.
12 through 15
Read data receiving Specifies the area in the CPU in which the data read from the area Data Carrier (using Read or Auto Read) is stored. Refer to word n+2, bits 12 through 15, to determine data areas. The data is ignored when Write, Auto Write, Clear-all or Auto Read or Auto Read/Write Abort is executed.
Note
1. Only 512 words of data can be read or written, 4 words are used for command data. 2. At the leading edge of a command signal, the data of word n+1 through word n+3 is valid. 3. The unused bits are provided for expansion. Do not use as work bits.
14
Page 30
Word Settings
Section 2-2
Word n+4
Bit number
Bit name ID busy
Function This flag turns ON while the ID Sensor Unit is executing a command.
01
Waiting for Data Carrier
02
Auto Read/Write Abort end
During the execution of Auto Read or Auto Write, this flag is ON while it is waiting for the Data Carrier to approach the Read/Write Head (or Antenna). This flag turns ON when the ID Sensor Unit has received (from the CPU) and completed Auto Read/Write Abort.
03
Programming Console MONITOR mode –
00
04 through 06 07
08
This flag turns ON when the Programming Console (connected to the ID Sensor Unit) is in MONITOR mode. Not used
Data Carrier warning This flag turns ON when the Data Carrier’s battery is almost dead. This flag also turns ON when the MD-C command detects a data check error or when the MD-L/MD-S command detects that the number of overwriting operations reaches the specified number. Read format error During the execution of Read or Auto Read, this flag is ON when the data in the Data Carrier exceeds the capacity of the receiving area. (Refer to Read/Write Bit Areas page 16.)
09
Command error
This flag is ON when the ID Sensor Unit cannot process the command sent from the CPU. The command may be undefined or may not have a terminator.
10
No Data Carrier error
This flag turns ON when the Data Carrier is undetected by the ID Sensor after the ID Sensor has received Read, Write, or Clear-all from the CPU.
11
Write protect error
This flag turns ON when an attempt is made to write data to a write-protected area of the ID Sensor Unit’s memory.
12
Data Carrier communication error Data Carrier address over
This flag turns ON if an error has occurred during data communication between the ID Sensor Unit and Data Carrier.
13
This flag turns ON when the ID Sensor Unit attempts to access an address of the Data Carrier which is beyond the Data Carrier’s memory capacity. As the ID Sensor Unit reads data from or writes data to the Data Carrier, the ID Sensor Unit compares the current data with previously read or written data. If the data is not identical, an error occurs and this flag turns ON.
14
Data verification error
15
Read/Write Head (or This flag turns ON when the Read/Write Head is improperly Antenna) connected to the ID Sensor Unit. disconnect error
15
Page 31
Word Settings Read/Write Bit Areas
Section 2-2 The following table shows the memory areas (bits) that the ID Sensor Unit uses when reading data from or writing data to the Data Carrier. Area
Bits
DM area
DM 0000 through 1999
IR area
000 through 246
HR area
HR 00 through 99
AR area
AR 07 through 22
LR area
LR 00 through 63
TC area
TC 000 through 511
If, during execution of Read or Auto Read, the data read from the Data Carrier exceeds the capacity of the receiving area, a Read Format error occurs and word n+4, bit 08 turns ON. Example: Data Carrier Read data: 40 bytes = 20 words Beginning word number (receiving data): DM 1990 As the above table shows, the words specified in the DM area are DM 0000 through DM 1999. If the beginning word number is DM 1990, only 10 words (DM 1990 through 1999) are available for receiving data. In this example, the quantity of data to be read is too large for the available space in the DM area. A Read Format error will occur and the data will not be written to the DM area. To correct the error, change the beginning word number (receiving data) to a word number less than DM 1980, or reduce the quantity of data in the Data Carrier to fewer than 10 words. Error Storage Area
The error information storage area of the ID Sensor Unit is undefined at shipment. Before using the ID Sensor Unit, clear the newest error information and statistical error information. (Refer to 3-2-9 Error Log Display (ERR) for details).
Error Messages and Reset Flags
The ID Sensor Unit’s error messages and reset flags are located in the AR area as “Special I/O Unit Error Message” and “Special I/O Unit Reset Flag”. Refer to the C200H Programmable Controller Operation Manual for details. Special I/O Unit Error Message
AR 0000 through AR 0009
Special I/O Unit Reset Flag
AR 0100 through AR 0109
When the error message flag for a particular unit number is ON, the RUN LED of the corresponding Special I/O Unit turns OFF.
16
Page 32
The User Program
2-3
Section 2-3
The User Program The ID Sensor Unit will not function unless the PC is programmed to control the operation of the Unit. The Unit communicates with the Data Carrier through the Read/Write Head by means of the commands provided by the user program of the PC. Program examples with detailed explanations are provided in Section 3-1 Program Examples. The following figure shows the basic operation outline of the program.
Operation Outline PC
ID Sensor Unit
Word data
Internal program
Dedicated command Common memory
Analyzes the command and transfers the data between PC and Data Carrier
R/W Head
Data Carrier
Read data
User program
MOV, OUT etc.
I/O word
(Command execution flag) MOV, LD instruction etc.
words n through n+4
Executes handshaking and processes error information
(Error information)
Effect of CPU Status on ID Sensor Unit
The ID Sensor Unit is controlled by the program contained in the CPU; if an error occurs in the CPU, an error will also occur in the ID Sensor Unit. The ID Sensor Unit will continue to execute commands when the PC is in PROGRAM mode.
Communication with the CPU
The ID Sensor Unit reads data from and writes data to the Data Carrier in accordance with the commands sent from the CPU.
17
Page 33
The User Program
Section 2-3
Writing Data to the Data Carrier from the CPU
The CPU, via the Write, Auto Write, and Clear-all commands, directs the ID Sensor Unit to write data to the Data Carrier. The following diagram shows how the program writes data to the Data Carrier.
1
2 3a
CPU
3b
R/W Head
ID Sensor Unit
Data Carrier
4
1.
The CPU sends the command data (the number of words in the command to be sent, the beginning word number of the command, and the command execution start) to the ID Sensor Unit by using MOV or OUT.
2.
The ID Sensor Unit analyzes the command received from the CPU.
3a.
If the command is legal, the ID Sensor Unit writes the required data to the Data Carrier.
3b.
If the command is illegal, the ID Sensor Unit sets the Command Error flag (word n+4 bit 09) to ON and returns the data to the CPU. At this time, the ID Busy flag (word n+4 bit 00) is turned OFF.
4.
When the ID Sensor Unit has completed communication with the Data Carrier, the Unit turns OFF the ID Busy flag as the command is completed, and returns the data to the CPU.
If communication with the Data Carrier fails, or if an error occurs during communication, the ID Sensor Unit stops data communication with the Data Carrier, turns ON the Data Carrier communication error flags, returns the data to the PC, and turns OFF the ID Busy flag. Steps 1 to 4 compose one write operation. Reading Data from the Data Carrier to the CPU
The CPU, via the Read and Auto Read commands, directs the ID Sensor Unit to read data from the Data Carrier to the CPU. The following diagram shows how the program reads data from the Data Carrier.
1
2 3a
CPU
3b
ID Sensor Unit
R/W Head
Data Carrier
4
18
1.
The CPU sends command data (the number of words in the command, the beginning word number of the command, and the beginning word number of the data to be received) to the ID Sensor Unit by using MOV or OUT.
2.
The ID Sensor Unit analyzes the command received from the CPU.
3a.
If the command is legal, the ID Sensor Unit reads the required data to the Data Carrier.
Page 34
The User Program
Section 2-3 3b.
If the command is illegal, or the Read format is illegal, the ID Sensor Unit turns ON both the Command Error flag (word n+4 bit 09) and the Read Format Error flag (word n+4 bit 08), and returns the data to the PC. At this time, the ID Busy flag (word n+4 bit 00) is turned OFF.
4.
When the ID Sensor Unit has completed communication with the Data Carrier (step 4), the ID Sensor Unit forwards the read data to the CPU; the Unit turns OFF the ID Busy flag as the command is completed.
If communication with the Data Carrier fails, or if an error occurs during communication, the ID Sensor Unit stops data communication with the Data Carrier, turns ON the Data Carrier communication error flags, returns the data to the CPU, and turns OFF the ID Busy flag. Steps 1 to 4 compose one read operation.
2-3-1
Communication Commands The ID Sensor Unit is provided with seven dedicated commands for communicating with the Data Carrier through the Read/Write Head. The following table outlines these commands.
Command name
Mnemonic
ASCII code
Function
Write
WT
57 54
Writes data to the internal memory of the Data Carrier; up to1024 bytes (512 words) of data can be written at a time.
Read
RD
52 44
Reads data from the internal memory of the Data Carrier; up to 1024 bytes (512 words) of data can be read at a time.
Auto Write
AW
41 57
Auto Read
AR
41 52
Waits until the Data Carrier approaches the Read/Write Head and then writes data to the internal memory of the Data Carrier as it comes within detection range of the Read/Write Head. Up to 1024 bytes (512 words) of data can be written at a time. Waits until the Data Carrier approaches the Read/Write Head and then reads data from the internal memory of the Data Carrier as it comes within detection range of the Read/Write Head. Up to 1024 bytes (512 words) of data can be read at a time.
Clear-all CA (see note) Auto Read/Write Abort AA
43 41
Clears the contents of the Data Carrier’s internal memory.
41 41
Data management (C200H-IDS01-V1 only)
4D 44
Aborts Auto Read and Auto Write. When this command is executed, the ID Sensor Unit is initialized and waits for the next command. Checks the Data Carrier’s internal memory. The reliability of data is checked using the MD-K and MD-C commands and the number of overwriting operations is checked using the MD-L and MD-S commands.
MD
Note The Clearall command clears the Data Carrier’s internal memory, regardless of write protection. When transferring data between the Data Carrier and the ID Sensor Unit, up to 1024 bytes (512 words) of data per scan can be written to or read from the Data Carrier. However, when transferring data between the PC and the ID Sensor Unit, only 20 words can be transferred per scan. Data is transferred between the PC and the ID Sensor Unit at a rate of 0.2 ms per word. If data is to be read and written simultaneously, the read data can be up to 20 words (40 bytes) in length and the write data can be up to 16 words (32 bytes) in length. (Because the write data is transferred with the command data, which requires 4 of the 20 words, only 16 words are available to carry the write data.) If the data exceeds 20 words, more than one scan is required to transfer the data between the CPU and the ID Sensor Unit, making simultaneous processing impossible. For details refer to 3-3 Timing Considerations.
19
Page 35
The User Program Write Command
Section 2-3 This command writes data to the internal memory of the Data Carrier. Up to 1024 bytes (512 words) of data can be written per scan. Specify the first address in hexadecimal. 15
00 W
T
5 Specifies the type of data to be written, which can be ASCII characters or hexadecimal numbers. Code A (41) specifies ASCII characters, while H (48) specifies hexadecimal numbers.
7
5
A/H 41/48
This is OP (operation) code indicating that the command is Write. 4
1 3
This is OP code represented in ASCII code. This code selects a Read/Write Head and is always fixed to 1.
1
ASCII code Specifies the first address of the Data Carrier memory to which data is to be written. Addresses $0000 through $FFFF can be specified in hexadecimal.
Write data
• 1024 bytes max. = 512 words
Terminator
* 2
20
A
0
D
ASCII code