Microcontroller development tool using software programs5852733Abstract A software development tool is provided for Texas Instruments microcontrollers which provides register initialization, register information, and register editing in conjunction with Windows.RTM.-based forms generated by programs written according to well-known software programming languages. The editor function of the software development tool functions without the use of an emulator. Claims We claim: Description BACKGROUND OF THE INVENTION
______________________________________
Latest Register Settings
18 MAY 96
Bits
ASM Identity
C Identity
7 6 5 4 3 2 1 0
______________________________________
1022h ADATA 0 0 0 0 0 0 0 0
1070h ADCTL 1 1 1 1 1 1 1 1
______________________________________
The Help option from the Menu bar shown in FIG. 1 provides a pull-down menu and dialogue box which are calculated to assist a user in getting information on the use of the invention's software development tools for the TMS370 family of microcomputers. The Registers entry from the menu bar shown in FIG. 1 prompts a pull-down menu with entry options which prompt further pull-down menus concerning register initialization options such as System Reset, System Control, Digital I/O, External Interrupt Control, Data EEPROM Control, Program EPROM Control, Timer 1, Timer 2, Serial Communication Interface, Serial Peripheral Interface and Analog-to-Digital Converter. These register initialization options cover substantially all of the register initialization aspects involved with programming devices in the TMS370 family. Register initialization is accomplished by pulling-up on-screen display forms which are used to program bits in a register. Dialog boxes associated with the pull-down menus allow the register settings to be converted to the selected language (using the language selected in conjunction with the Language menu entry) by clicking on a save button presented in the dialogue box. The initialization code according to the specified language is placed in "Edited Register Codes" section of the TMS Register Programming Editor window of FIG. 1. In conjunction with the register initialization, dialog boxes provide a description of substantially all bits within a register. In its preferred embodiment, the invention strives to maintain as much similarity among display forms as possible in order to increase user familiarity with the operation of the invention. Further, dialog box buttons should provide information which is as descriptive and concise as possible. A better understanding of the Register initialization aspects of the invention can be gleaned from FIGS. 2 through 9 which illustrate displays of selected dialog boxes associated with register initialization associated with the A/D converter. Register initialization with one of the analog-to-digital modules shall be examined below. Analog-to-digital module ADC1 is initialized by setting the Analog Control Register, ADCTL. Analog Control Register, ADCTL, is organized according to chart 1.
Chart 1
______________________________________
Analog Control Register (ADCTL)
Bit 7 Bit 6 Bit 5 Bit 4
Bit 3
Bit 2 Bit 1 Bit 0
______________________________________
Convert
Sample REF REF REF AD AD AD
Start Start Volt Volt Volt INPUT INPUT INPUT
______________________________________
Bits 0 through 2 control the selection of the input pin on which the analog data for conversion will be used. These input pins serve as selection channels to the ADC1 on which the analog data is provided to ADC1 for conversion of that data from an analog value to a digital value for output of that digital value to data register ADDATA. There are 8 possible input pins which can serve as channels, consecutively numbered and preceded by the designation "AN," e.g., AN0 through AN7. FIG. 2 illustrates the dialog box display which can be used to initialize the ADCTL register. This dialog box display serves as a form by which the ADCTL register is programmed. A brief explanation of the register is displayed at the top of the form. A brief explanation of the associated register is generally found on all forms associated with the invention. As shown in FIG. 2, bits which are numerically labeled 0 through 7 can be set (to logic one value) or cleared (logic zero) according to the register setting mode, bit mode or byte mode, selected as displayed in binary form in the dialog box. In byte mode, the bit values are displayed in the larger box following the numerical bit label. Clicking the smaller box (which is a button in the dialog box) which follows numerical bit label will change the binary state shown in the larger box. Bits are set with a logic 1, the result of which is manifested by an "x" being displayed in the smaller box. In byte mode, the "set" and "clear" buttons are displayed. "Set" is the logical OR function while "clear" is the logical AND function. The database is not updated in byte mode. Most registers associated with the invention are 8 bit. Register modes are not needed on 16 bit register display forms of the invention since 16 bit registers are concerned with display counters or frequency. Registers in bit mode are overwritten depending on the input of the user. Also in this mode the large box which follows the numerical label in byte mode is not shown. The "set" and "clear" buttons determine the functionality of bit buttons: namely, an individual bit is set equal to logic one by the "set" button while an individual bit is cleared to logic zero by the "clear" button. Buttons, such as those shown in FIG. 2, (AD Input Select, REF Volt Select, Sample Start and Convert Start) are associated with each bit of a register, which when clicked-on, present an information dialog box explaining the functionality of the register bit value. This practice of having a button in conjunction with an information dialog box is followed for each register initialization display of the invention. Collectively, activation of these buttons will result in an explanation of the functionality of each register bit. This serves as a learning tool for using the TMS370 family of microcontrollers. It further obviates the need to rely as much, in connection with programming the microcontroller, on one's memory or the user's manual associated with the microcontrollers. At the lower portion of the display in FIG. 2, three buttons are displayed which are common to many of the forms presented for register initialization. These buttons are "Save," "Cancel," and "Reset." The "Save" button, when activated, converts the entered registered data on the form into the selected language under the Edited Register Codes section of the Register Programming Editor form illustrated in FIG. 1. The "Cancel" button clears the register initialization form of the values entered, and the "Reset" button clears the register bit values. Chart 2 identifies the bit settings for bits 0 through 2 of the Analog Control Register corresponding to channels AN0 through AN7.
Chart 2
______________________________________
Channel Selecting Bit Settings for the ADCTL Register
Bit 2 Bit 1 Bit 0 Channel
______________________________________
0 0 0 AN0
0 0 1 AN1
0 1 0 AN2
0 1 1 AN3
1 0 0 AN4
1 0 1 AN5
1 1 0 AN6
1 1 1 AN7
______________________________________
FIG. 3 illustrates the information dialog box display associated with the AD Input Select button shown in FIG. 2. This form gives a function explanation, as is illustrated along with the proper settings corresponding to the channel selection for the ADCTL register control. Desired settings can be implemented by buttons "AN0" through "AN7" which provide one-touch selection (as opposed to individually setting each bit of the register corresponding to the button illustrated) of the registers associated with the input selection. A "Close" button is provided with this box which will return the user to the ADCTL register display dialog box of FIG. 2. The analog-to-digital conversion proceeds according to the formula specifying the calculated digital value as being 255 (2.sup.8 -1) times the ratio of the input voltage to a reference voltage. Analog Control Register, ADCTL uses a positive voltage reference provided by either one of the input channels, AN0 through AN7 or through an analog voltage supply pin to the microcontroller, pin V.sub.CC3. On most members of the TMS370 family, Bits 3 through 5 specify the reference voltage source according to Chart 3 below.
Chart 3
______________________________________
Bit Settings to Specify
Analog-to-Digital Conversion Reference Voltage Source
Reference Voltage
Bit 5 Bit 4 Bit 3 Source
______________________________________
0 0 0 V.sub.CC3
0 0 1 AN1
0 1 0 AN2
0 1 1 AN3
1 0 0 AN4
1 0 1 AN5
1 1 0 AN6
1 1 1 AN7
______________________________________
FIG. 4 illustrates the dialog box display associated with the REF Volt Select button of FIG. 2. As shown, the bit settings for the source of reference voltage sources can be set by activation of the Vref Source buttons illustrated. This form contains a brief self-explanation as well as a "Close" button. Setting bit 6 of the ADCTL register specifies stopping any ongoing analog-to-digital conversion and starting sampling the selected input channel for a new analog-to-digital conversion. Bit 7 of the ADCTL register, when set, starts the analog-to-digital conversion. AN0 through AN7 can also be configured as digital input pins which function as a general purpose input for the microcontroller rather than being inputs for the A/D converter ADC1. Analog Port E Enable Register, ADENA, sets any of AN0 through AN7 as a general purpose input when a corresponding bit is set to one. Chart 4 illustrates the bits corresponding to the AN0 through AN7 for the bits of Register ADENA.
Chart 4
______________________________________
Register ADENA
Bit 7
Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
______________________________________
AN7 AN6 AN5 AN4 AN3 AN2 AN1 AN0
______________________________________
FIG. 5 illustrates the dialog box display which serves as the form for setting the ADENA register. A description of the form is provided at the top of the form as shown and an information button (Description of Bits) is provided to detail the functionality of the bit settings. The previously described Register Setting Mode option along with the previously described "Save" (for code conversion on to the Edited Register Codes section of the display of FIG. 1), "Cancel" and "Reset" buttons are provided on this form. ADC1 control registers also include the Analog Status and Interrupt Register, ADSTAT. Bits 0, 1, and 2 can be programmed while bits 3 through 7 are reserved. Chart 5 illustrates the settings for register ADSTAT.
Chart 5
______________________________________
Register ADSTAT
Bit 7
Bit 6 Bit 5 Bit 4 Bit 3
Bit 2 Bit 1 Bit 0
______________________________________
-- -- -- -- -- AD AD Int
AD INT
Ready Flag ENA
______________________________________
Bit 2 is set by the ADC1 whenever the ADC1 is ready for a new A/D conversion and a conversion is not in progress. Bit 0 is the ADC1 interrupt enable. When this bit is set to 1, it allows the ADC1 to generate an interrupt, otherwise setting this bit to zero disables the ADC1 from generating an interrupt. Bit 1 is the ADC1 interrupt flag which is set by ADC1 at the end of an A/D conversion. An interrupt request is generated if this bit is set while bit 0 is set to 1. FIG. 6 illustrates the dialog box display which provides the form for setting the ADSTAT register. As shown, buttons (AD INT ENA, AD INT Flag, and AD Ready (Read Only)) are provided which serve to explain the functionality of the configurable register bits. This form includes the previously described Register Setting Mode and "Save," "Cancel" and "Reset" buttons. The priority level of the ADC1 interrupt is set by the Analog Interrupt Priority Register (ADPRI). Chart 6 below is representative of the ADPRI register functions. Chart 6
______________________________________
Register ADPRI
Bit 7 Bit 6 Bit 5 Bit 4 Bit 3
Bit 2 Bit 1
Bit 0
______________________________________
AD AD AD -- -- -- -- --
STEST Priority ESPEN
______________________________________
Bit 7 (AD STEST) must be set equal to 0 for proper operation of the interrupt priority level of the ADC1 interrupt. The ADC1 interrupt is of a higher priority when bit 6 is set to 1. Otherwise, a bit 6 value of 0 places the ADC1 interrupt at a lower priority. Bit 5 operates in conjunction with the TMS370 family's emulator which is typically used to debug a program. When bit 5 is set to 1, the emulator is suspended and the operation of the ADC1 is stopped so as to allow examination of its state at the point of the emulator suspension. Bits 0 through 4 are reserved. FIG. 7 illustrates the dialog box display which serves as the form for setting the ADPRI register. A brief explanation of the ADPRI register is illustrated at the beginning of the form as shown. Buttons AD ESPEN, AD Priority, and AD STEST, when activated, explain the functionality of the associated register bit. The Register Setting Mode buttons and "Save," "Cancel," and "Reset" buttons, as previously described are provided by this form. When one or more of the input bits AN0 through AN7 are configured as general purpose, digital inputs, register ADIN shows the data present at input pins so configured. Pins configured as ADC1 channels are read as 0s from this register. Chart 7 shows the corresponding bit and input pin information for register ADIN.
Chart 7
______________________________________
Register ADIN
Bit 7 Bit 6 Bit 5 Bit 4
Bit 3
Bit 2 Bit 1 Bit 0
______________________________________
Data Data Data Data Data Data Data Data
AN7 AN6 AN5 AN4 AN3 AN2 AN1 A0
______________________________________
FIG. 8 illustrates the corresponding dialog box display for the ADIN register. As illustrated by this "Read Only Bits" button, this display serves to allow a visual inspection of the contents of the ADIN register since bits 0 through 7 are not programmed in conjunction with this form. The "Read Only Bits" button provides an information dialog box explaining the ADIN register. A "Close" button at the bottom of this display closes the ADIN dialog box upon activation of the button. As indicated above, the results of the A/D conversion are placed in register ADDATA. FIG. 9 illustrates a dialog box display form which serves to provide a visual inspection of the ADDATA register. In addition to the brief explanation of the ADDATA register at the beginning of this form, a "Read Only Bits" button, when activated, provides further information on the ADDATA register. A "Close" button, when activated, closes the dialog box. The foregoing described interactive display forms and report are most effectively implemented with object-oriented graphics in conjunction with an object-oriented interface using a object-oriented programming language. In the invention's preferred embodiment, Microsoft.RTM.'s Visual Basic.RTM. 4 programming language is the programming language of choice to implement the display forms. Visual Basic.RTM. 4 provides event-driven programming. Therefore, rather than writing a computer program that plots out every step in precise order, the programmer writes a program that responds to the user's action-e.g., choosing a command, clicking an icon in a window, moving the mouse (as is the case with the foregoing described A/D converter ADC1). Further, rather than the programmer writing a single large program, the programmer creates an application that is a collection of cooperating miniprograms triggered by user-initiated events, thereby allowing forms to be created according to the invention with great speed and ease. This events-driven programming is most suitable for a Windows.RTM. environment. As an example, the Visual Basic.RTM. code for the commonly used form functions such as, "Save," "Cancel," "Reset," and the Register Setting Mode selection is given below. This code is contained in a file named REGCMDS.BAS. The REGCMDS.BAS file is a collection of global variables and common subroutines used by the register editing display forms. The variables declared are register form initialization status, oscillator frequency, bit setting modes, register form number (for system reset routine), programming language, register window display mode, report data (name & type), output comment arrays, SCI automatic bit set enable, and timer function mode. The main function of the global variables is to transfer information about program states (i.e. EqualMode) and universal data (e.g. OscFreq) between program routines and forms. The primary functions of the subroutines included in the REGCMDS.BAS file can be summarized as involving form initialization (InitRegSetForm, SetEQUAL, SetBitMode, SetAND, SetOR, and DisplayLines), register bit data transfer & recording (ExecSAVE, RegSAVE, RegDEFAULT, and RegSave16Bit), and output code comment function servicing (PlaceCommentintoCode, CalculateComment, PlaceCommentintoCode16Bit, CalculateComment16Bit). The included subroutines are as follows: InitREGSETFORM calls the SetEQUAL routine when a register editing display form is called from the main menu. This subroutine eliminates nuisance re-initializations of the register editing form after a sub-form to the register editing form closes. SetEQUAL sets up the register editing display form for changing all eight bits of the register. It also tells the RegSAVE routine to write statements that affect all eight bits. SetBitMode sets up the register editing form for changing individual bits of the register. Its primary function is disabling the bytewise editing functions (negate SETEQUAL). SetAND enables writing of zeros in bit mode editing. The selected bits on the register editing form are changed to zeros using an AND statement & mask as output code. SetOR enables writing of ones in bit mode editing. The selected bits on the register editing form are changed to ones using an OR statement & mask as output code. SetEQUAL, SetAND & SetOR functions are exclusive of each other. ExecSAVE prevents execution of the RegSAVE routing when none of the SetOR, SetAND, or SetEQUAL functions is enabled. This can occur if SetBitMode is selected without specifying AND (SetAND) or OR (SetOR) functions. An error message is shown if RegSAVE cannot be executed. RegSAVE performs bit or byte changing operations according to the selected mode (SetEQUAL, SetAND, or SetOR). It then saves the result to the database and outputs appropriate code with comments from the PlaceCommentintoCode subroutine. RegDEFAULT copies the TMS370 default reset bit values to the checkboxes on the register editing form. These default values are read from the database. DisplayLines shows or hides selected lines on a register editing form. Affected lines typically group sets of bits in a register. This routine is used for hiding RESERVED group lines in bit setting modes. RegSave16Bit functions like RegSAVE except it affects 16-bit registers. Only EqualMode register setting mode is available with this routine. Place CommentintoCode retrieves appropriate comments form the database and sends them to RegSAVE for printout on the Edited Register Codes window. In some cases it calls CalculateComment to get calculated values for comments. CalculateComment calculates values from selected bits in a register according to keywords in the comment section of the database. When the "CALC:" prefix is encountered in the database, CalculateComment is called. The next two numbers after "CALC:" specify the register bit range. Six or seven characters after the bit range specify the calculation type; these are "ClkSrc" (Timer), "CharLen" (SPI, SCI), "ClkFrq" (SPI), "ChanSel" (A/D), and "VrefSrc" (A/D). Characters listed after a quotation mark at the end of "ClkSrc" & "CharLen" statements are shown at the beginning of the comment in the output code. PlaceCommentintoCode16Bit functions like PlaceCommentintoCode except that it is for 16-bit registers. These 16-bit registers include timer counters serviced by the Tcounter form (for register control of a 16-bit free-running, read-only counter) and the SCI (serial communications interface) baud rate serviced by the SCIBaud form. CalculateComment16Bit provides register values or time period equivalents to the PlaceCommentintoCode 16Bit subroutine. This routine is always called for by 16-bit registers. ShowinitOutCode shows the required initialization code in the Edited Register Codes window before the first line of programming code is output in that window. The source code for the REGCMDS.BAS file is given below. Program comments are set-off in by a single quote (`) prior to the comment. Attribute VB Name="RegFormCmds" ##SPC1## The foregoing program makes function calls where needed. Consequently, in order to implement the "Save," "Reset," and "Cancel" buttons macros are used in order to give the user easier access to programming routines which are run a multiple number of times. The database used to hold register information in conjunction with the information entered into the forms discussed above is Access.RTM.2.0. The database holds the default values for the registers as well as the comments for all register values. This is a commonly used personal computer-resident data base. Consequently, database information (e.g., register information can be updated by foregoing discussed display forms or externally using Access.RTM.2.0 without the need to use Visual Basic.RTM.. Therefore, the invention provides a Visual Basic.RTM. front-end and an Access.RTM.2.0 rear-end. This Access.RTM. data base provides for entity and referential integrity and it is data independent in that the front-end will work properly regardless of the data in the database file, provided that the data in the file has valid data. The database file used with the invention is named regedit.mdb. The software corresponding to the reports (Reports) option (file name regedit.rpt--which is a Crystal Reports file) can be edited to reflect a particular user's specification, although, the user will need Visual Basic.RTM. or Crystal Reports.RTM. to perform any changes to this file. One advantage of the invention is its use of widely known programming languages to accomplish form creation and data storage, e.g. Visual Basic.RTM., Access.RTM., Crystal Reports.RTM., etc. Register information can be altered by modifying the database in Access.RTM. on which register information is stored. Additionally, provided the source code, a software developer need not learn additional programming languages in order to customize the register initialization programs. Further, the invention provides a development tool that uses a substantially minimum amount of memory in comparison with applications such as Motorola's MCUinit.RTM.. The programs of the invention were written as a 16-bit application which are fully compatible with Windows3.x.RTM., Windows 95.RTM., Windows NT3.x.RTM., Windows NT 4.x.RTM., and Windows NT Workstation.RTM.. The invention's programs are fitted easily on a few computer diskettes without modification being necessary for running these distribution disks on the foregoing Windows.RTM. operating environments. The programs of the invention output source code and comments in at least two different languages, C and Assembly. The source code represents the initialization of the registers in the TMS370 family of microcontrollers. In its preferred embodiment, the invention has modular source code which incorporates the use of functions. Comments within each function should be calculated to provide information so as to ensure the possibility of readily making changes to the programs in the future as needed. The comments are dynamic comments in that they will vary depending on the configuration of a particular register. Information from the foregoing development tool which is supplied to the microcontroller's main program (the program selected to execute the desired functions) and includes the main program, need only be assembled, compiled and/or linked and downloaded to the desired microcontroller in order to input the desired register information in conjunction with running the main program. Forms generated by the foregoing described invention can be made in conjunction with programming in the aforementioned languages using well-known programming techniques. Although the invention has been described in detail herein with reference to its preferred embodiment, it is to be understood that this description is by way of example only and is not to be construed in a limiting sense. It is to be further understood that numerous changes in the details of the embodiments of the invention, will be apparent to and may be made by persons of ordinary skill in the art having reference to this description. For instance, a limited number of forms can be generated by software (i.e., 2 forms), which can be adapted to supply information for all registers rather than providing a distinct form per each register. Additionally, the foregoing described invention can be adapted for use with future generations of software, (e.g., involving the C language) and/or future generations of microcontrollers. It is contemplated that all such changes and additional embodiments are within the true scope and spirit of the invention as claimed below.
|
Same subclass Same class Consider this |
||||||||||
