首页    期刊浏览 2025年02月12日 星期三
登录注册

文章基本信息

  • 标题:Firmware design for a multiple-mode instrument - HP 8904A Multifunction Synthesizer - technical
  • 作者:Mark D. Talbot
  • 期刊名称:Hewlett-Packard Journal
  • 印刷版ISSN:0018-1153
  • 出版年度:1989
  • 卷号:Feb 1989
  • 出版社:Hewlett-Packard Co.

Firmware design for a multiple-mode instrument - HP 8904A Multifunction Synthesizer - technical

Mark D. Talbot

Firmware Design for a Multiple-Mode Instrument

THE HP 8904A MULTIFUNCTION SYNTHESIZER hardware offers many different operating modes, depending on the requirements of the user. The HP 8904A firmware was designed and implemented with the goal of efficiently handling the existing operating modes and allowing for changes within these modes and the addition of new modes. Three major firmware modules provide this required flexibility: the numeric data parser, the command parsing structure, and the interrupt handling scheme. Each of these modules provides hooks to customize or add to the HP 8904A firmware with little or no changes to the existing firmware.

Numeric Data Parser

The firmware of most HP signal generating instruments has the luxury of fixed data types, string lengths, and display window positions. In contrast, the HP 8904A, with its multiple modes, requires custom configuration of the firmware to handle the widely varying data types, string lengths, terminators, and display positions. The numeric data parser allows custom configuration of signaling sequence and mode command parameters (e.g., 10 kHz, AM, FM, etc.). A parser, as used in this article, refers to firmware functions written in the C language that check data or commands for their syntactic and semantic correctness.

The numeric data parser is a library function used by the front-panel and HP-IB command parsers described in the next section. Its role in parsing input data is illustrated in Fig. 1. The instrument is in the channel configuration mode and the user enters a frequency of 120 Hz from the front panel. When the FREQ key is pressed, the channel configuration mode parser calls the function np_init() to initialize the data structure used by the numeric data parser in subsequent key presses associated with setting frequency. When the user enters 120 Hz the string is sent to the numeric data parser. The numeric data parser uses the parameters established during initialization to parse the string.

Fig. 1b enumerates the five parameters that can be passed to the numeric parser initializer. The firmware designer builds the parsing rules for the numeric data parser by filling in the parameters shown in Fig. 1b. This collection of parameters is then passed to the np_init() function which sets up the data structure for the numeric data parser. For the example above, data_type = Real, and term_type = Frequency. The other parameters are used to position the value on the front-panel display.

Command Parsing Structure

The HP 8904A command parsing structure, which is shown in Fig. 2, allows the implementation of customized command modes or changes to existing modes without affecting the other modules in the parsing structure. Besides the numeric data parsers, there are four other parsers in the HP 8904A firmware. Each parser is tailored to a specific category of commands. The following is a partial list of HP 8904A commands and their associated parsers.

Front Panel and HP-IB Input Parsers. All inputs to the command parsers enter through the front-panel keys or the HP-IB. The keys-to-command parser and the token-to-command command parser shown in Fig. 2 handle front-panel input and HP-IB input, respectively. There is a numeric data parser contained in each of these parsers. These parsers perform syntax checks on the command or parameter input and then set up the commands for processing by the other parsers in the command parsing structure. Each command or parameter passing through the input parsers concludes with one of the following actions taken:

* The input is ignored because of an error or some out-of-sequence input.

* The input is not converted but stored as part of a yet to be completed input string.

* The input is successfuly converted to a command data item.

Initial Command Parser. After a command has been parsed by the front-panel and HP-IB bus parsers, a data item representing the command is passed to the initial command parser. Depending upon the type of command, the initial command parser performs one the following actions:

* If the command is one of the generic commands the initial command parser is responsible for handling, it processes the command in total or in part.

* If the command is one of the generic commands handled by a mini-parser and the mini-parser is not active it calls an initialization function to set a pointer to the command's mini-parser, which results in making the specific mini-parser active. Setting the pointer is illustrated by the switch shown in Fig. 2.

* If a mini-parser is active it is invoked.

* If the command is not found in the list of generic commands or a command needs further action, the active mode command parser is invoked.

A valid active mode command parser will always be present in addition to the initial command parser. This will be either the top level command parser (tlp_prs()) for main level commands, or a mode command parser for one of the mode-specific commands.

Mode Command Parsers. The mode command parsing section of the command parsing structure is divided into mode installation functions and the mode command parsers. The installation functions initialize and activate the mode command parsers, including setting a pointer to the selected mode command parser.

During a normal power-up sequence, the execution of the MAIN command, or an instrument PRESET, the install_tlp() (install top level command parser) function is performed. This function sets a pointer to the top level command parser function tlp_prs(). This causes the flow of commands not handled by the initial command parser to be directed to the top level command parser. The top level command parser allows the user to scroll through the available instrument command modes. When a new mode is selected, its installation function (install_modei(), i = 1,2...N) is executed. The mode installation function configures the hardware for the selected mode, sets a pointer to the function to call when the mode is exited, and sets the pointer to the command's mode command parser, which causes command flow to be directed to the selected mode command parser. Hardware initialization, display update, and softkey configuration are also performed.

The responsibility of the mode command parser is to test a command to see if the command is within its repertoire, and if so, to execute the command; otherwise, it is reported to the operator as an error. For example, the commands AMPTD (amplitude) and FREQ (frequency) would be processed successfully in the channel configuration mode, but the FREQ command in dual-tone multifrequency mode would cause an error. The same mode-specific command can be valid for several different modes but perform different operations from one mode to the next. For example, in the channel configuration mode the FREQ command sets the output frequency, whereas in the tone sequence mode the FREQ command sets the frequency for the selected tone. A mode exit function is called whenever the presently active mode is exited. This is done whenever a softkey function EXIT is selected, or when the MAIN or PRESET keys are pressed. The mode exit function will clean up its working environment, leaving it clean for the next mode to use. It also forces the top level command parser to be installed.

Mini-Parsers. While the instrument is in one of the instrument modes or at the main selection level, it is sometimes necessary to perform some other function momentarily without disrupting the present operation, and then resume the present operation when the momentary function is finished. Examples of these momentary functions include SAVE, RECALL, changing the HP-IB address, or turning off an output. These types of operations are performed by the mini-parsers. The mini-parser is a command parser that has a very limited functionality and is placed in series with the command path for a short period of time.

When a command to perform a function that requires the use of a mini-parser is received, a call to that mini-parser's initialization function is made. This function installs the specific mini-parser by setting a pointer to a mini-parser function. The mini-parser will execute the present command or pass it on for further processing by other parsers. When the mini-parser is finished or chooses to abort the operation because an invalid command was received, it will remove itself from active status so that subsequent commands are not passed to it.

Vectored Interrupts

For the HP 8904A real-time hardware, interrupts are generated by the timer IC and the digital waveform synthesis IC control logic. During an interrupt a microprocessor typically directs program flow (vectors) to locations stored in fixed addresses in its program ROM. When the HP 8904A firmware was written the requirements for handling interrupts by all present and future modes were unknown. This was inconsistent with the fixed interrupt handler methodology. The solution was to develop an environment that allows each operating mode to install its own individual interrupt handlers. Fig. 3 shows the HP 8904A interrupt handling structure.

Depending on when and how the interrupt is to be used, the interrupt handler is installed by the mode initialization function or some other function before enabling the interrupt. This is done by setting the variable flag to one and placing a pointer to the desired interrupt handler function into the variable vector. When a hardware interrupt occurs, such as a nonmaskable interrupt (NMI), the microprocessor will vector to the nmi_int() function. The status of flag is checked to see if an alternate handler is installed. If the flag is set, the function pointed to by vector is called and if it is not set, default interrupt routines clear the interrupt. This latter situation occurs only if the interrupt was unintentionally or spuriously generated. The special interrupt handler function is removed by setting flag to zero. This is done by the mode command parser when it is finished, or when the mode exit cleanup function is invoked, or after PRESET or instrument power-up.

Acknowledgments

The author would like to thank Troy Beukema who wrote all of the tone, DTMF, and digital signaling firmware for the HP 8904A, Bill Dickerson who developed the overall instrument methodology for the channel configuration mode firmware, and Ken Thompson and Bob Rands who defined the requirements for the signaling modes.

COPYRIGHT 1989 Hewlett Packard Company
COPYRIGHT 2004 Gale Group

联系我们|关于我们|网站声明
国家哲学社会科学文献中心版权所有