How to Program a Device Using the File Tab in the DS185XEVKIT
Abstract
By using the DS185x Evaluation Kit (DS185XEVKIT) and its associated software, you can program the DS185x family of devices through their I²C serial interface. The DS185x devices have internal EEPROM that is used for configuring device settings, as general-purpose memory, and as Lookup tables for calibration. To ease the programming of the tables, the software's File tab lets you upload a correctly formatted text file into the memory. This application note explains the formatting required for the Lookup tables, and other precautions to take while using this feature of the DS185XEVKIT software.
The File Tab in the DS185XEVKIT Software
Figure 1 illustrates the File section of the DS185x evaluation kit (DS185XEVKIT) software. You use the Gen Template and the Fill Device buttons to program a device. The Gen Template button is used first to generate a template for importing into Microsoft Excel or any other spreadsheet program. This imported file can be modified, saved, and then later uploaded into the device by using the Fill Device button.
Figure 1. The File tab in the DS185XEVKIT software.
Gen Template
The Gen Template button provides the template format of the text file used to program the memory tables. This button is useful anytime the user wants to create a new set of values for programming the device. On executing Gen Template, the program prompts the user for a file name and location to save the template file. This template file is a tab-delimited text file, and is how you start creating the actual file used for programming the memory tables. The default file name is DS185xTemplate.txt; each table has a separate section in the text file. Open the template file in Microsoft™ Excel.
Modifying the Excel File for Programming
Modify the data in the Excel file for each table until the spreadsheet reads as desired. If you want to program only one Lookup table, delete the unused tables. The program uses decimal values for programming the memory. For the Lookup tables, the entire table must be programmed. For the other tables, programming can be done one byte at a time. Once the contents of the table are correct, save the file as a text file.
Fill Device
Press the Fill Device button. A dialog prompts for the location and name of the text file. Navigate to the file that you saved as a text file in the previous step, select it, and press OK. The program parses through the file, reads one line at a time looking for inconsistencies, and converts the text to lower case as it reads. The parser begins on the first line and treats each line as a comment until the first "tag" is found. Appearing at the beginning of every line in the text file, the tag identifies whether that line is a comment or a valid input. A list of tags is shown in Figure 2 below.
Figure 2. The possible tags in the template file.
Any line starting with ";" is a comment and is ignored. The user can comment out tables which are not intended to be programmed. The Main Device and Table 1 are commented in the template file. Consequently, to program a Table, 'uncomment' the Table tag and the lines for the registers to be programmed (that is, remove the ";" at the beginning of the line).
The parser recognizes the beginning of a particular table when it sees no comment tag and sees text that starts with the table number. Programming Table 3, for example, would start with the tag, Table 3 (see Figure 2). Following this table indicator, the parser then starts looking for numeric data in a particular format for programming that table within the device. As indicated in the template file, the data should have the following format:
Address | Data | Comment fields |
The parser is only interested in the Address and the Data and looks to see if the numeric data satisfy the limits of that particular table. If the parser determines that the data do not satisfy the table requirements, it indicates an error.
As soon as the parser sees non-numeric data or a carriage return, it assumes that the programming for the particular table is done. The parser then starts looking for either the beginning of a new table (indicated by the corresponding table indicator) or an end of file, where it returns control to the main program. The program reports what it has done in the status window, which should be checked to verify that no errors occurred. Errorcodes and the corresponding Errors are provided in Figure 3 below.
Figure 3. Errorcode and the errors that can occur when entered data do not satisfy template parameters.
* Note that the x in the Errorcode references a particular table. Figure 4 below indicates the different tables and the corresponding value of x.
Figure 4. The tables that correspond to the values of x.
Even if only one value has to be changed in a Lookup table, the user must ensure that the entire table is programmed. Individual bytes can be programmed for the other tables used for configuration.
The tables for the DS1856 are ordered differently, and described in the data sheet. The program generates a separate text file for the DS1856, which can be then used for programming its tables.