Allen-Bradley Logix5000 Series Application Book

Allen-Bradley Logix5000 Series Application Book

Compactflash file system
Hide thumbs Also See for Logix5000 Series:
Table of Contents

Quick Links

CompactFlash File
System on
Logix5000
Controllers
1756-L61, 1756-L62, 1756-L63,
1756-L64, 1756-L60M03SE
Application Solution
Table of Contents
loading

Summary of Contents for Allen-Bradley Logix5000 Series

  • Page 1 CompactFlash File System on Logix5000 Controllers 1756-L61, 1756-L62, 1756-L63, 1756-L64, 1756-L60M03SE Application Solution...
  • Page 2: Important User Information

    BURN HAZARD alert people that surfaces may reach dangerous temperatures. CompactFlash, Logix5000, Allen-Bradley, Rockwell Automation, TechConnect, PowerFlex, CompactLogix, ControlLogix, and RSLogix 5000 are trademarks of Rockwell Automation, Inc. Trademarks not belonging to Rockwell Automation are property of their respective companies.
  • Page 3: Table Of Contents

    Table of Contents Important User Information ........2 Purpose of This Manual.
  • Page 4 Table of Contents Write Data to the CompactFlash Card ......26 Read Data from the CompactFlash Card ..... . . 28 Delete a File on the CompactFlash Card .
  • Page 5: Purpose Of This Manual

    Preface This manual describes how you can use the CompactFlash file system on Purpose of This Manual Logix5000 controllers. You should use this manual if you program applications that use Who Should Use CompactFlash card and RSLogix 5000 programming software with the This Manual following Logix5000 controllers: •...
  • Page 6 Notes: Publication LOGIX-AP007B-EN-P - January 2007...
  • Page 7: Introduction

    Chapter CompactFlash Card Enhancements Overview This chapter reviews the enhancements for the CompactFlash file system. Introduction Topic Page CompactFlash Card Enhancements Sample File Compatibility CompactFlash File System Features Possible Applications of the CompactFlash File System The CompactFlash file system has gone through several enhancements. CompactFlash Card Enhancements •...
  • Page 8: Sample File Compatibility

    CompactFlash Card Enhancements Overview This document is compatible with the sample projects, version 3.2, dated Sample File Compatibility January 2007. • CF_Read_Write_V3_2.ACD • CF_Read_Write_V3_2_Example.ACD The file system has the ability to perform a variety of operations to read or CompactFlash File System write data to the CompactFlash card.
  • Page 9: Possible Applications Of The Compactflash File System

    CompactFlash Card Enhancements Overview Using RSLogix 5000 software, version 16 or later, and using the application Possible Applications of provided in this publication, you can read and write data to the CompactFlash the CompactFlash File card. This could include tag values, recipes, or data log information, just to System name a few.
  • Page 10 CompactFlash Card Enhancements Overview Notes: Publication LOGIX-AP007B-EN-P - January 2007...
  • Page 11: Introduction

    Chapter CompactFlash File System Restrictions This chapter describes the restrictions of the CompactFlash file system. Introduction Topic Page Restrictions of the File System Number of Open Files Maximum Data Per Message Memory Resources and Performance Limited Life Read or Write Portions of a File The following are the restrictions of the CompactFlash file system.
  • Page 12: Minimum File Size/Resolution

    CompactFlash File System Restrictions Minimum File Size/Resolution The minimum file size supported is 450 bytes. If you create a file and write 4 bytes to the file the application will actually write 450 bytes. The same concepts applies for reads and writes. If you read or write 500 bytes, 900 bytes will be read or written.
  • Page 13: Chapter 3 Introduction

    Chapter CompactFlash Commands This chapter describes four of the CompactFlash commands, the ControlFlash Introduction Data Working Tag, and how to determine the number of bytes to read or write. Topic Page CF_Data_Working Tag Create Command Write Command Read Command Delete Command Determine the Number of Bytes to Read or Write The file system has the ability to perform a variety of operations to read or write data to the CompactFlash card.
  • Page 14: Cf_Data_Working Tag

    CompactFlash Commands Before explaining the four commands, you need to understand the layout of a CF_Data_Working Tag key tag in the application. 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 to get all the information needed to perform the command, such as file name, data, or number of bytes to read or write.
  • Page 15: Create Command

    CompactFlash Commands The UDT tag's type is called CF_File_Structure. This will be important if you create a Recipe_Manager. The only 3 tags you will need to manipulate in the UDT are: • File_Name The name of the file that will be on the CompactFlash card. This name can be up to 140 characters in length.
  • Page 16: Set Up The Create Command

    CompactFlash Commands Set Up the Create Command To set up the Create command, define the filename including the file extension, for example, testfile1.dat. To execute the Create command, set the execute_CF_Create_File bit. The application code resets this bit. Refer to Chapter 4, Example Application for complete instructions. Use the Write command to write data to the CompactFlash card.
  • Page 17: Set Up The Write Command

    CompactFlash Commands • The checksums are verified and the data in data_to_write and data_read are compared to make sure they are equal. If the checksums are not calculated, compared, and parsed, the file is closed and the write sequence is restarted from the beginning.
  • Page 18: Read Command

    CompactFlash Commands The Read command is used when you want to read data from the Read Command CompactFlash card. A file must exist on the CompactFlash card before executing this command. The read command is broken into six commands: • The file is open. •...
  • Page 19: Delete Command

    CompactFlash Commands Use the Delete command when a file needs to be deleted from the Delete Command CompactFlash card. A file must exist on the CompactFlash card before you can use the Delete command. The delete command consists of two commands: •...
  • Page 20 CompactFlash Commands For example, the tag MYDINTS[100] will be 4 times 100 elements, or 400 bytes of data. Similarly, if a UDT is used, 1 instance of that UDT will be the sum of the sizes of all the data types within the structure. When reading or writing to the CompactFlash card, it is best to use UDT tags.
  • Page 21: Introduction

    Chapter Example Application You should now have a good understanding of the basics using the Introduction CompactFlash file system. This example application brings all the concepts together. Topic Page Requirements Configure Message Instructions Create a File on the CompactFlash Card Write Data to the CompactFlash Card Read Data from the CompactFlash Card Delete a File on the CompactFlash Card...
  • Page 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. 6. Find the tag Controller_Slot_Number. Publication LOGIX-AP007B-EN-P - January 2007...
  • Page 23: Create A File On The Compactflash Card

    Example Application 7. Enter the slot number where the controller will be located in the value column. When the application enters Run mode, the D_CF_Intialization routine executes. The paths for all the message instructions will be modified to contain the slot number you just entered. You can add a new rung zero to the D_CF_Intialization routine to move the slot number into the tag Controller_Slot_Number.
  • Page 24: Publication Logix-Ap007B-En-P - January

    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 Controller Scoped tags. Publication LOGIX-AP007B-EN-P - January 2007...
  • Page 25 Example Application 9. Sort the tags by name. 10. Find the tag execute_CF_Create_File. 11. Enter a 1 in the value field and press Enter. The tag goes back to a 0. This indicates that the application has attempted to create your file. 12.
  • Page 26: Write Data To The Compactflash Card

    Example Application Set up how the program is going to write the data to the CompactFlash card. Write Data to the CompactFlash Card 1. Switch to the MainPrograms tags. Make sure the Monitor Tags tab is selected in the tag editor. 2.
  • Page 27 Example Application 7. Enter a value of 100 in the first element of the Data array. 8. Switch the Scope to CF_Read_Write in the tag monitor to view the Controller Scoped tags. 9. Sort the tags by name. 10. Find the tag execute_CF_Write_Data. 11.
  • Page 28: Read Data From The Compactflash Card

    Example Application Determine how the program is going to read the data from the CompactFlash Read Data from the card. CompactFlash Card 1. Switch to the MainPrograms tags. Make sure the Monitor Tags tab is selected in the tag editor. 2.
  • Page 29: Delete A File On The Compactflash Card

    Example Application 10. Enter a 1 in the value field and press Enter. The tag will go back to a 0. This indicates that the application has attempted to read from your file. 11. Find the tag CF_Read_Seq_Status and click + to expand the tag. This is a user-defined data type (UDT).
  • Page 30: Build An Example

    Example Application 6. Find the tag execute_CF_Delete_File. 7. Enter a 1 in the value field and press Enter. The tag will go back to a 0. This indicates that the application has attempted to delete your file. 8. Find the tag CF_Delete_Seq_Status and click + to expand the tag. This is a user-defined data type (UDT).
  • Page 31: Set Up Recipe Data

    Example Application 2. Open the Recipe_Manager routine. 3. Look at the next rung (rung 1). The first conditions determine that this recipe and a command have been selected. After this there are 5 branches. Branch Description Handles the command to write data to the CompactFlash card.
  • Page 32 Example Application 3. Scroll down until you find the tag Recipe1. This is the UDT (Recipe Data) we discussed in the previous chapter. 4. Expand the tag and enter some data. Earlier we discussed a program scope tag called CF_Working_Data. When a command is executed, the routines use this tag to get all information, such as file name, data, number of bytes to read or write.
  • Page 33: Create The File

    Example Application 8. Define how many bytes you want to read/write to the file. From the previous section, a waffle recipe was 72 bytes in size. 9. Enter 72 in the tag Bytes_to_RW. The last piece of data to manipulate is the Data. You will copy the data from the waffle Recipe1 into this array.
  • Page 34: Write The Recipe

    Example Application Write the Recipe Write the recipe data to the CompactFlash card. You entered data into Recipe1 before you download to the controller. 1. Enter a value of 1 in the Recipe_Number tag. This tells the Recipe_Manager routine to work with Recipe1. 2.
  • Page 35: Appendix A Introduction

    To use the information described in this document, it is necessary to have the Requirements CompactFlash card formatted to a FAT16 file system. Allen-Bradley CompactFlash cards (1784-CF64) are pre-formatted to a FAT16 file system and are ready to use. If the CompactFlash card needs to be formatted, it can be...
  • Page 36 Format a CompactFlash Card The following screen appears. 4. Choose FAT from 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.
  • Page 37: Format Rslogix 5000 Software And A Logix5000 Controller With

    Format a CompactFlash Card The card can also be formatted using RSLogix 5000 software and a Logix5000 Format RSLogix 5000 controller with CompactFlash Support. Software and a Logix5000 Controller with 1. Open RSLogix 5000 software, click Start > Programs > Rockwell Software >...
  • Page 38 Format a CompactFlash Card 4. Double-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. Right-click the Controller folder in the Controller Organizer and select Properties.
  • Page 39 Format a CompactFlash Card The following screen appears. 6. Click the Nonvolatile Memory tab. Publication LOGIX-AP007B-EN-P - January 2007...
  • Page 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 Store. Publication LOGIX-AP007B-EN-P - January 2007...
  • Page 41 Format a CompactFlash Card 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 stored on the CompactFlash card. The card is now ready for use.
  • Page 42 Format a CompactFlash Card Notes: Publication LOGIX-AP007B-EN-P - January 2007...
  • Page 43: Appendix B Introduction

    Appendix Performance Data This appendix describes performance data of the CompactFlash card. All tests Introduction were done with Rockwell Automation 1784-CF64 Revision BO1 cards. Performance with third party CompactFlash cards will vary. Topic Page Performance Data Tables Access 450 Bytes Access 4500 Bytes Access 4500 Bytes with an HMI Load Access 4500 Bytes with 16 Message Instructions...
  • Page 44: Access 4500 Bytes

    Performance Data Access 4500 Bytes This table shows the baseline performance of the CompactFlash card. The application code as it is shipped was used to access 4500 bytes. All data shown is in ms. Each command was performed 32,000 times and the highest value is shown.
  • Page 45: Introduction

    Appendix Troubleshoot the CompactFlash File System This appendix describes possible troubleshooting topics you might encounter Introduction while using the CompactFlash file system. Topic Page Status User-defined Data Type Tag Layout Message Error Codes For each command that the application supports there is a status user-defined Status User-defined Data data type created.
  • Page 46: Tag Layout

    Troubleshoot the CompactFlash File System Tag Layout In the write sequence, there are seven major steps and one overall status. The CF_Write_Seq_Status.Parse_Data status has been expanded to show its format. After a command has been executed, you will want to check the overall status.
  • Page 47: Message Error Codes

    Troubleshoot the CompactFlash File System The following table lists the error codes that you might see when working with Message Error Codes the CompactFlash file system. All error codes are in hex. Error / Extended Extended Error Description 0C/0 File does not exist. Invalid handle (State conflict). 05/00 Card removed while command was active.
  • Page 48 Troubleshoot the CompactFlash File System Notes: Publication LOGIX-AP007B-EN-P - January 2007...
  • Page 49: Appendix D Introduction

    Appendix Expand the Code to Support More than 4500 Bytes of Data This appendix describes how to expand the code to support more than 4500 Introduction bytes of data. Topic Page Modify the Application to Access More Data Access 10,000 Bytes Example Modify the Arrays Modify the Data Element The baseline application supports reading or writing 4500 bytes of data to...
  • Page 50: Access 10,000 Bytes Example

    Expand the Code to Support More than 4500 Bytes of Data Access 10,000 Bytes Example For example, if you want to access 10,000 bytes: 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:...
  • Page 51: Modify The Arrays

    Expand the Code to Support More than 4500 Bytes of Data Modify the Arrays The arrays that 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.
  • Page 52 Expand the Code to Support More than 4500 Bytes of Data Notes: Publication LOGIX-AP007B-EN-P - January 2007...
  • Page 53 ___No, there is no need to contact me ___Yes, please call me ___Yes, please email me at _______________________ ___Yes, please contact me via _____________________ Return this form to: Rockwell Automation Technical Communications, 1 Allen-Bradley Dr., Mayfield Hts., OH 44124-9705 Fax: 440-646-3525 Email: [email protected] Publication CIG-CO521C-EN-P- May 2003...
  • Page 54 PLEASE FASTEN HERE (DO NOT STAPLE) Other Comments PLEASE FOLD HERE NO POSTAGE 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...
  • Page 56: Rockwell Automation Support

    Rockwell Automation provides technical information on the Web to assist you in using Rockwell Automation its products. At http://support.rockwellautomation.com, you can find technical Support manuals, a knowledge base of FAQs, technical and application notes, sample code and links to software service packs, and a MySupport feature that you can customize to make the best use of these tools.

This manual is also suitable for:

1756-l611756-l621756-l60m03se1756-l631756-l64

Table of Contents