background image

Publication LOGIX-AP007B-EN-P - January 2007

CompactFlash Commands        

19

Delete Command

Use the Delete command when a file needs to be deleted from the 
CompactFlash card. A file must exist on the CompactFlash card before you 
can use the Delete command.

The delete command consists of two commands:

Delete the file.

Error Handling is performed, if needed.

Set Up the Delete Command

To set up the Delete command:

define a filename including a file extension, for example, testfile1.dat.

set the bit execute_CF_Delete_File. The application code handles 
resetting this bit.

Refer to Chapter 4, Example Application for complete instructions.

Determine the Number of 
Bytes to Read or Write

Tags of any data type, including arrays, user-defined types (UDT), and arrays 
of UDT tags can be read and written to the CompactFlash card.

When reading and writing data to the CompactFlash card, you need to know 
how many bytes are actually being read or written. The following chart 
indicates the type and size of the atomic data types. The minimum memory 
allocation for a tag is 4 bytes. When you create a tag that stores data that 
requires less than four bytes, the controller allocates four bytes, but the data 
only fills the part it needs.

For example, if one DINT type tag value is being written to the CompactFlash 
card, 4 bytes is the amount of data that will be written. If an array of DINT 
tags is being written, the number of bytes being written will be 4 times the size 
of the array.

Data Type

Bits

31

16 15

8 7

1

0

BOOL

Not used

0 or 1

SINT

Not used

-128

+127

INT

Not used

-32,768

+32767

DINT

-2,147,483,648

+2,147,483,647

REAL

-3.40282347E

38

-1.17549435E

-38

 (negative values)

0

1.17549435E

-38

3.40282347E

38

 (positive values)

Содержание controllogix 1756-L61

Страница 1: ...CompactFlash File System on Logix5000 Controllers 1756 L61 1756 L62 1756 L63 1756 L64 1756 L60M03SE Application Solution...

Страница 2: ...kwell Automation Inc with respect to use of information circuits equipment or software described in this manual Reproduction of the contents of this manual in whole or in part without written permissi...

Страница 3: ...Data Per Message 11 Removal and Insertion of CompactFlash Card 11 Minimum File Size Resolution 12 Memory Resources and Performance 12 Controllers Supported 12 Limited Life 12 Read or Write Portions o...

Страница 4: ...ompactFlash Support 37 Appendix B Performance Data Introduction 43 Performance Data Tables 43 Access 450 Bytes 43 Access 4500 Bytes 44 Access 4500 Bytes with an HMI Load 44 Access 4500 Bytes with 16 M...

Страница 5: ...ional Resources This table lists Logix products and documentation that may be valuable as you program your application Related Documentation To view or download these publications go to http www liter...

Страница 6: ...Publication LOGIX AP007B EN P January 2007 6 Notes...

Страница 7: ...a file system that can be used for storing tag values recipes log data and other user data The CompactFlash file system as described in this document is available on the following Logix5000 controller...

Страница 8: ...operations Create a file Write to a file Read from a file Delete a file There is an additional command verification if a CompactFlash card is present but as a user you will not access this this runs a...

Страница 9: ...sh card for later use CompactFlash cards can also be read and written to with a personal computer using a CompactFlash card reader However using the methods described in this document tag values will...

Страница 10: ...Publication LOGIX AP007B EN P January 2007 10 CompactFlash Card Enhancements Overview Notes...

Страница 11: ...Generic Messages Attempts to read or write more than this amount at one time is not permitted by the application code If the code is modified to access more than 450 bytes the data will not be read o...

Страница 12: ...alog the task structure of the program Motion periodic tasks or event tasks slow performance when accessing the CompactFlash card Refer to Appendix B Performance Data for more information Controllers...

Страница 13: ...a variety of operations to read or write data to the CompactFlash card There are four basic commands that you can access Create a file Write to a file Read from a file Delete a file There is an additi...

Страница 14: ...ication The CF_Data_Working tag a user defined data type tag UDT is at the program scope This is an example of a user defined data type tag or UDT When a command is executed the routines use this tag...

Страница 15: ...a that you want to write or where data read will be put The baseline application supports up to 4500 bytes of data but can easily be expanded Refer to Appendix D Expand the Code to Support More than 4...

Страница 16: ...ing Only 450 bytes can be written at one time to the file Therefore writing to the file is broken down into 450 byte chunks This moves the data into the data_to_write array from the data array in the...

Страница 17: ...xtension for example testfile1 dat 2 Enter the number of bytes you want to write to the file 3 Move the data to be written in the CF_Data_Working UDT into the Data array We recommended that you clear...

Страница 18: ...mmand you need to set the bit execute_CF_Read_Data The application code handles resetting this bit 1 Define a file name including a file extension for example testfile1 dat 2 Enter the number of bytes...

Страница 19: ...of UDT tags can be read and written to the CompactFlash card When reading and writing data to the CompactFlash card you need to know how many bytes are actually being read or written The following ch...

Страница 20: ...a UDT that is the recipe for making waffles As you can see the total size of the recipe is 72 bytes This means that you would want to read or write 72 bytes of data to the CompactFlash card This would...

Страница 21: ...talled The application detects if one is present Configure Message Instructions The majority of this configuration has already been performed for you in the ACD file The only configuration you need to...

Страница 22: ...2007 22 Example Application 2 Open the MainPrograms tags 3 Expand the MainPrograms tags 4 Double click Program Tags Make sure the Monitor Tags tab is selected in the tag editor 5 Sort the tags by Name...

Страница 23: ...into Run mode Create a File on the CompactFlash Card Before you can perform any read or write commands to a file you must create the file on the CompactFlash card first 1 Open the MainPrograms tags M...

Страница 24: ...7B EN P January 2007 24 Example Application 6 Click Browse and the string browser window displays 7 Enter testfile1 dat and click OK 8 Switch the Scope to CF_Read_Write in the tag monitor to view the...

Страница 25: ...attempted to create your file 12 Find the tag CF_Create_Seq_Status 13 Click to expand the tag This is a user defined data type UDT As the tag name indicates this will give you status on the create fi...

Страница 26: ...rking This is a user defined data type UDT 4 Click to expand the tag Leave the filename the same as the previous section testfile1 dat There is an element in the UDT called CF_Data_Working Bytes_to_RW...

Страница 27: ...ss Enter The tag will go back to a 0 This indicates that the application has attempted to write to your file 12 Find the tag CF_Write_Seq_Status and click to expand the tag This is a user defined data...

Страница 28: ...the tag CF_Data_Working This is a user defined data type UDT 4 Click to expand the tag 5 Use the file name from the previous section testfile1 dat The UDT element Bytes_to_RW remains set at 450 The UD...

Страница 29: ...tor 13 Find the tag CF_Data_Working This is a user defined data type UDT 14 Click to expand the tag 15 Expand the SINT array Data in the UDT Earlier in this section you entered a value of 127 The valu...

Страница 30: ...le You will build an example application with the waffle recipe from the last chapter 1 Open the file CF_Read_Write_V3_2_Example ACD This code will handle four recipes In the controller organizer unde...

Страница 31: ...rm commands to the CompactFlash Card First you need to set up recipe data to store to the card 1 Open the Controller Tags from the controller organizer 2 Click Monitor Tags Branch Description 1 Handle...

Страница 32: ...to get all information such as file name data number of bytes to read or write In the CompactFlash Commands chapter we manipulated data directly in this tag but since we are now interested in handlin...

Страница 33: ...read and write your recipe data to the CompactFlash card 12 Open the Controller tags and go to the Monitor tab 13 Look for the tags Recipe_Commmand and Recipe_Number You will use the first recipe as...

Страница 34: ...the tag Recipe1 and clear out the values you entered earlier 2 Enter a value of 1 in the Recipe_Number tag This tells the Recipe_Manager to work with Recipe1 3 Enter a value of 3 in the Recipe_Comman...

Страница 35: ...a Logix5000 controller with CompactFlash support Format with a Personal Computer and a CompactFlash Card Reader The card can be formatted using a Windows based operating system on a personal computer...

Страница 36: ...rom the File system pull down menu 5 Enter a volume label if desired 6 Click Start The card will now be formatted and once complete the card is ready for use The second method formats the card only if...

Страница 37: ...rd can also be formatted using RSLogix 5000 software and a Logix5000 controller with CompactFlash Support 1 Open RSLogix 5000 software click Start Programs Rockwell Software RSLogix 5000 Enterprise Se...

Страница 38: ...e click the file to open it The following window appears Be sure that the controller is Online Instructions for bringing a controller online can be found in the RSLogix 5000 software help files 5 Righ...

Страница 39: ...Publication LOGIX AP007B EN P January 2007 Format a CompactFlash Card 39 The following screen appears 6 Click the Nonvolatile Memory tab...

Страница 40: ...tion LOGIX AP007B EN P January 2007 40 Format a CompactFlash Card The computer screen should look similar to the following 7 Click Load Store 8 Make sure that the controller is in Program mode 9 Click...

Страница 41: ...ctFlash Card 41 The following message box appears 10 Click Yes 11 Click OK in any dialogs that my appear The CompactFlash card formats to a FAT16 file system and the current project image file is stor...

Страница 42: ...Publication LOGIX AP007B EN P January 2007 42 Format a CompactFlash Card Notes...

Страница 43: ...is in ms Each command was performed 32 000 times and the highest value is shown Topic Page Performance Data Tables 43 Access 450 Bytes 43 Access 4500 Bytes 44 Access 4500 Bytes with an HMI Load 44 Acc...

Страница 44: ...is shipped was used to access 4500 bytes Also 16 message instructions were added into the application code each accessing 100 DINT tags from a remote controller All data shown is in ms Each command w...

Страница 45: ...pports there is a status user defined data type created These are found in the Controller Scoped tags The formats of these are generally the same it depends on the number of steps in each command This...

Страница 46: ...l sequence and check its Status element 3 A checksum error has been found This will only occur for the read and write commands This means that a read or write was attempted four times and failed the c...

Страница 47: ...ntrollers General Instructions publication 1756 RM003 Error Extended Extended Error Description 0C 0 File does not exist Invalid handle State conflict 05 00 Card removed while command was active 02 0...

Страница 48: ...Publication LOGIX AP007B EN P January 2007 48 Troubleshoot the CompactFlash File System Notes...

Страница 49: ...3000 bytes and the last will be 10 000 bytes The first two will not warrant any changes to the baseline application but the last will You will need to expand three tag s array sizes Before writing to...

Страница 50: ...es Step 1 Actual_Bytes_to_RW 10 000 TRN 10 000 442 8 If the MOD 10 000 442 0 then 8 else 0 10 000 22 8 8 10 184 Step 2 450 TRN 10 184 450 If the MOD 10 148 450 0 then 1 else 0 450 22 1 450 23 10350 by...

Страница 51: ...hat will need modification are in the program scope data_read data_to_write UDT CF_File_Structure The third change to make is the definition of the UDT CF_File_Structure shown below Modify the Data El...

Страница 52: ...Publication LOGIX AP007B EN P January 2007 52 Expand the Code to Support More than 4500 Bytes of Data Notes...

Страница 53: ...this publication more useful for you Completeness Can we add more information to help you procedure step illustration feature example guideline other explanation definition Technical Accuracy all pro...

Страница 54: ...NECESSARY IF MAILED IN THE UNITED STATES BUSINESS REPLY MAIL FIRST CLASS MAIL PERMIT NO 18235 CLEVELAND OH POSTAGE WILL BE PAID BY THE ADDRESSEE 1 ALLEN BRADLEY DR MAYFIELD HEIGHTS OH 44124 9705 PLEA...

Страница 55: ......

Страница 56: ...it http support rockwellautomation com Installation Assistance If you experience a problem with a hardware module within the first 24 hours of installation please review the information that s contain...

Отзывы: