_CARD200_ReadIOMNum (1/3) CARD 200 Read IOM File Size _CARD200_ReadIOMNum Basic function Reads the size of a data file with the “.IOM” filename extension. Symbol FB Busy Flag FB Normal End FB Error End Data size Start Trigger Busy Flag Directory name File name _CARD200_ReadIOMNum (BOOL) EN (BOOL) ENO (LWORD) DirName (BOOL) FB_BUSY (LWORD) FileName (BOOL) FB_OK (BOOL) FB_NG (UINT) Num I/O memory file Binary data File name Lib\FBL\omronlib\PLC\Card\_CARD200_ReadIOMNum10.cxf Applicable models CPU Unit CS1*-CPU**H Unit version 3.0 or higher CJ1*-CPU**H Unit version 3.0 or higher CJ1M-CPU** Unit version 3.0 or higher CS1D-CPU**HA/SA Unit version 4.0 or higher CX-Programmer Version 5.0 or higher Conditions for usage Shared Resources Memory Card Memory Card Status The Memory Card must be recognized by the CPU Unit. The Memory Card Recognized Flag (A343.15) will be ON when CPU Unit has recognized the Memory Card. Function description When the Start Trigger turns ON, the function reads the size of the specified data file (.IOM extension) in the root directory or a specified directory of the Memory Card. If the size of the file exceeds 65,535 data elements, the output value will be 65,535. FB precautions If the Memory Card is already being accessed when the FB is started, the operation will be performed after the completion of the access. The FB is processed over multiple cycles. The FB_BUSY output variable can be used to check whether the FB is being processed. FB_OK or FB_NG will be turned ON for one cycle only after processing is completed. Use these flags to detect the end of FB processing. Timing Chart Read results When the Normal End Flag goes ON, the data size has been read. Start Trigger FB Busy Flag (FB_BUSY) FB Normal End (FB_OK) or FB Error End (FB_NG) ON OFF ON OFF ON OFF EN input condition Connect EN to an OR between an upwardly differentiated condition for the start trigger and the FB_BUSY output from the FB. Restrictions Input variables Always use an upwardly differentiated condition for EN. If the input variables are out of range, the ENO Flag will turn OFF and the FB will not be processed. Output variables This FB requires multiple cycles to process. Always connect an OR including the FB_BUSY output variable to the EN input variable to ensure that the FB is processed to completion (see Symbol). Do not turn the FB_BUSY output variable ON or OFF outside the FB. Other If the Memory Card is missing or cannot be detected, the FB_NG Flag will be turned ON. Never turn OFF the Power Supply when the CPU Unit’s BUSY indicator (Accessing Memory Card indicator) is lit. Refer to the Related Manuals for other Memory Card precautions. _CARD200_ReadIOMNum (2/3) Application example When bit A goes ON, the function reads the size of file ABCDE.IOM in the Memory Card’s root directory and copies the contents of the file to the DM Area beginning at D1000. Directory name #00 File name #4142434445000000 FB Busy Flag Bit B FB Normal End Bit C FB Error End Bit D Data size D0 Equivalent to "ABCDE" in ASCII. Directory name #00 File name #4142434445000000 Area ID for read data storage P_DM Area No. for read data storage &1000 Read data size D0 Busy Flag Bit E Normal end Bit F Error end Bit G ABCDE.IOM Binary data CPU Unit D1000 Number of data items in file (D0) 1) 2) Start Trigger Bit A FB Busy Flag Bit B _CARD200_ReadIOMNum (BOOL) EN (BOOL) ENO (LWORD) DirName (BOOL) FB_BUSY (LWORD) FileName (BOOL) FB_OK (BOOL) FB_NG (UINT) Num Start Trigger Bit C FB Busy Flag Bit E _CARD210_ReadIOM (BOOL) EN (BOOL) ENO (LWORD) DirName (BOOL) FB_BUSY (LWORD) FileName (BOOL) FB_OK (WORD) AreaID (BOOL) FB_NG (INT) AreaNo (UINT) Num FB Normal End Bit F Processing after file is read Related manuals Precautions when Using a Memory Card There are several precautions that must be observed when using Memory Cards. This manual provides just an overview of the precautions. For details, refer to 5-1 File Memory in the CS/CJ Series Programmable Controllers Programming Manual (W394-E1). 1) Format The Memory Card is already formatted when it is shipped, so it is not necessary to format a newly purchased Card. 2) Number of Files allowed in Root Directory There is a limit to the number of files that can be stored in the root directory of the Memory Card. The maximum number of files depends on the Memory Card model and format, but it ranges between 128 and 512 files. 3) Maximum Number of Overwrites A limit of 100,000 write operations has been set for warranty purposes. For example, if the Memory Card is written to every 10 minutes, over 100,000 write operations will be performed within 2 years. 4) Turning the Power OFF Never turn OFF the Power Supply when the CPU Unit’s BUSY indicator (Accessing Memory Card indicator) is lit. Reference for File Data Format For details on file formats, refer to 5-1-3 Files in the CS/CJ Series Programmable Controllers Programming Manual (W394-E1). Related FBs Use the following functions when setting the present date or time as the directory name or file name. FB Get Date in ASCII (_CPU020_MakeAsciiDate) FB Get Time in ASCII (_CPU021_MakeAsciiTime) _CARD200_ReadIOMNum (3/3) Variable Tables Input Variables Name Variable name Data type Default Range Description EN EN BOOL 1 (ON): FB started 0 (OFF): FB not started. Directory name DirName LWORD At right. Specifying the root directory: Set the directory to #00. Specifying a subdirectory: Specify the directory name (always 8 characters) in ASCII with the character codes at the beginning. If fewer than 8 characters are required, pad the extra characters with zeroes (#00). For example, to set the name ”ABCD,” input #4142434400000000. n+3 #4142 n+2 #4344 n+1 #0000 n #0000 When indirectly specifying ASCII data in data area words, input the data as shown at the right. File name FileName LWORD At right. Specify the file name (always 8 characters) in ASCII with the character codes at the beginning. If fewer than 8 characters are required, pad the extra characters with zeroes (#00). For example, to set the name “123.IOM,” input #3132330000000000. n+3 #3132 n+2 #3300 n+1 #0000 n #0000 When indirectly specifying ASCII data in data area words, input the data as shown at the right. Output Variables Name Variable name Data type Range Description ENO (May be omitted.) ENO BOOL 1 (ON): FB processed normally. 0 (OFF): FB not processed or ended in an error. FB Busy Flag FB_BUSY BOOL Automatically turns OFF when processing is completed. FB Normal end FB_OK BOOL Turns ON for one cycle when processing ends normally. FB Error end FB_NG BOOL Turns ON for one cycle when processing ends in an error. Data size Num UINT Indicates the number of data elements in the specified file. If the number exceeds 65,535, the output value will be 65,535. Reference ASCII Table Text ASCII Text ASCII Text ASCII Text ASCII Text ASCII Text ASCII 0 #30 8 #38 H #48 P #50 X #58 1 #31 9 #39 A #41 I #49 Q #51 Y #59 2 #32 B #42 J #4A R #52 Z #5A 3 #33 C #43 K #4B S #53 4 #34 D #44 L #4C T #54 ¥ #5C 5 #35 E #45 M #4D U #55 6 #36 F #46 N #4E V #56 7 #37 G #47 O #4F W #57 Examples: Character 0: ASCII #30 Character A: ASCII #41 Character X: ASCII #58 Version History Version Date Contents 1.00 2005.2. Original production Note This manual is a reference that explains the function block functions. It does not explain the operational limitations of Units, components, or combinations of Units and components. Always read and understand the Operation Manuals for the system’s Units and other components before using them.