# Patent

## Title
Electro-optical device and method for monitoring instantaneous singlet

## Abstract

This is a division of application Ser. No. 195,665, filed Oct. 9, 1980, now U.S. Pat. No. 4,424,812.

## Background
This application incorporates by reference U.S. application Ser. No. 153,093, filed May 27, 1980, which has now matured into U.S. Pat. No. 4,361,153 by Slocum et al., entitled "Implant Telemetry System", assigned to the assignee of the present application.

The invention relates generally to electronic implants, and more particularly to externally programmable multimode biological tissue stimulators.

Neural stimulators hold great promise for relief from the effects of various physiological disorders. For example, electrodes can be implanted at sites in the human brain for control of neurological disorders or along the spine to block intractable pain. While neural stimulators share many of the characteristics of cardiac pacers, the great variety of neural applications frustrates attempts to adapt pacer technology and to define standard parameters. Rate, width and amplitude requirements vary by factors of ten from one neural application to another. Moreover, the optium parameters for a given patient may drift widely from time to time.

The complexity of the functional requirements suggests the use of a multi-purpose programmable generalized neural stimulator. For chronic conditions, a fully implanted battery-operated stimulator with telemetry is indicated. Because the pulse rate may greatly exceed the one to two pulse per second (pps) cardiac rate, battery drain, however, is a more acute problem. Moreover, the increased complexity of the programming variables increases the chances for error. Despite the complexity of the overall system, the power consumption and number of electronic components must be kept within bounds. The exceptionally high degree of programmable adaptability and relatively high pulse rate for the ideal neural stimulator require a wholly new approach to both the internal electronics and the external programming.

Accordingly, the general purpose of the invention is to provide a higher degree of programmable flexibility in an implantable stimulator with minimum power consumption. A corrollary object of the invention is to provide a reliable technique for establishing pulse parameter values over an extendable range.

These and other objects of the invention are achieved by a microprocessor-controlled externally programmable stimulator which includes a pulse generator for producing stimulation output pulses to multiple independently connected electrodes. A single chip microprocessor accompanied by a ROM implements a stored program data processing system which sets a plurality of multibit latches to establish the desired pulse parameters. Externally transmitted parameter data is decoded by the processing system, confirmed by two-way telemetry and loaded into control registers. The microprocessor obtains corresponding stored values from parameter tables in the ROM, and then sets the amplitude, rate and width latches. The pulse rate and width latches present discrete rate and width down counters. Separate slow and fast clocks operate the rate and width counters, respectively. To conserve power, the fast clock is enabled only briefly each time the rate counter times out when it is time to issue an output pulse. When running, the fast clock replaces the slow clock input to the microprocessor. The timed-out signal, (ZERO)-bar low, from the rate counter generates an interrupt request to the microprocessor which calls a subroutine to reprogram electrode and case polarity latches before enabling each output pulse. This system allows several electrodes (including the case, if desired) to be alternately connected as anodes and cathodes.

The microprocessor times a commanded on/off cycle with an internal machine cycle counting routine which disables the interrupt capability during the off portion of the cycle and programs the rate to a fixed minimum. The on and off time tables in the ROM take into account the rate variable frequency of fast clock intervals.

The continuous slow clock can be turned off with a magnet-operated reed switch whenever the rate counter's (ZERO)-bar output is not low. Reception of the first externally generated data pulse turns on the fast clock and software causes the microprocessor to restart the slow clock while reprogramming the latches.

In the preferred embodiment pulse width modulated IR transmissions to the implant are coded in a series of thirty bits, three command bits followed by a 27-bit data word representing selected parameters. The data word is loaded into temporary registers, confirmed by reflected signal magnetic telemetry and transferred to control registers. On and off numbers from the ROM table and electrode and case connection data are loaded into corresponding registers. After the on portion of the cycle, the off number is transferred to a cycle register which is incremented to zero by software whereupon the interrupt is enabled and the on number is loaded into the cycle register and similarly incremented. All of the registers are provided by separate scratch pad registers in a single microprocessor chip in the implant. The external programmer as well is preferably implemented by a microprocessor based system which encodes, stores, transmits, receives, decodes and compares pulse parameter data, and repeatedly checks for proximity with the implant.

FIG. 1 is a block diagram of the programmable neural stimulator system according to the invention.

FIG. 2 is a schematic diagram of the communications module of FIG. 1.

FIG. 3 is a block diagram of the microprocessor-based controller of FIG. 1.

FIG. 4 is a block diagram of the pulse generator and latches of FIG. 1.

FIG. 5 is a diagram of waveforms associated with alternating polarity stimulator pulses and data transmission.

FIG. 6 illustrates a typical pattern of serial bits for the load command followed by a data word.

FIG. 7 is a diagram of bit positions of the data word in a pair of registers on the microprocessor chip.

FIG. 8 is a block diagram of the programmer console and telemetry head of FIG. 1.

FIG. 9 is a timing diagram illustrating the telemetry handshake sequence and interrogate command.

FIG. 10 is a table of digital values in hexadecimal form stored in consecutive locations in read only memory (ROM 52) of the implant of FIG. 3.

FIG. 11 is a table of digital values in hexadecimal form stored in consecutive locations in read only memory (EPROM 102) of the programmer of FIG. 8.

In addition to the above drawings, Appendices I and II filed with the original application contain annotated program listings in machine code and assembly language and a detailed flow chart for the implanted stimulator. Appendices III and IV filed with the original application contain annotated program listings in machine code and assembly language plus a functional flow chart for the presently preferred external programmer.

The overall system is organized as shown in FIG. 1. An electronic implant 10 communicates with a programmer console 12 via a two-way communications module 14 in the implant and an external telemetry head 16, described in greater detail in the above-referenced copending application. The communications module 14 interfaces with a microprocessor-based controller 18 which establishes and programs the following parameters in accordance with transmitted data received by the communications module 14: pulse rate, pulse width or pulse duration, current amplitude, on/off times for pulse trains, the electrical connection status of each electrode and the metallic case, (i.e., disconnected, connected as anode or connected as cathode), and whether the selected polarity is constant or alternating from pulse to pulse.

When new programming occurs, the controller 18 sets a plurality of pulse parameter latches 20 to establish the rate, width and amplitude parameters for a pulse generator 22, external to the controller 18. Individually pulse I/O strobe lines 1, 2 and 3 signal the corresponding latches to obtain the parameter values from a data bus 24, which is actually provided by the memory address bus as explained below. The output signal from the pulse generator is connected to pass current through the selected electrodes in the selected direction (polarity) by an electrode connection controller 26. The selected polarities and electrodes are determined on a pulse by pulse basis. Electrode connection latches 28 are strobed (I/04, I/05) immediately before the generation of each pulse to reacquire the applicable data from the controller 18. In addition, I/04 enables the output of pulse generator 22. By omitting the I/04 enable pulse, the controller 18 enforces an off time. The on/off cycle is timed continuously by software in the controller 18.

As shown in FIG. 2, the communications module 14 includes an impedance modulated resonant transponder 30 including a tuned coil with a transistor shunt controlled by the serial output port Q of the microprocessor controller 18. The binary signal Q which gates the shunt transistor in the resonant transponder 30 changes the amplitude and phase of the signal reradiated by the tuned coil in the presence of a carrier magnetic field imposed by the external telemetry head 16. The modulation of the tuned coil load impedance is picked up in the telemetry head 16 as phase modulation, as described in detail in the above-referenced copending application.

The voltage developed across the resonant transponder coil is level-detected by transistor circuit 32 whose output actuates a monostable circuit (one-shot) 34 to turn on a normally dormant infrared receiver 36. In the receiver, the voltage drop across a phototransistor is amplified and applied to the reset input of a data flip-flop 38 whose Q-bar output forms the primary data input to the microprocessor controller, (EF2)-bar. Communication module 14 also includes a reed switch circuit 40 responsive to a magnetic field applied from outside by a hand-held magnet (not shown). The output of the reed switch circuit 40 clocks the inverting reed switch flip-flop 42 to allow the patient to turn the stimulator on and off.

The controller 18, as shown in FIG. 3, includes a one chip CMOS (complementary symmetry metal oxide semiconductor) 8-bit, register-oriented, byte-oriented central processing unit, in particular, the RCA CDP1802 COSMAC microprocessor 50. This particular microprocessor is characterized by the availability of 16 on-chip 16-bit scratch pad registers and 8-bit parallel organization with a bidirectional data bus and memory address (MA) bus. The microprocessor 50 is paired with a so-called 1K ROM52, in particular the RCA CDP1833, containing 1,024 bytes of fixed read only memory. The ROM contents are given in hexadecimal digit form in FIG. 10 and the second column of Appendix I. The read only memory is addressed by an 8-bit MA bus and data is transferred from the addressed byte of memory to the microprocessor on the data bus. In the preferred embodiment, the MA bus also serves as a data bus for transferring parameter data to the parameter latches.

Timing for all operations in the microprocessor 50 is provided by either a slow clock 54 (600 Hz) with a period of 1.67 milliseconds (ms) or a fast clock 56 (100 KHz) with a period of 10 microseconds. The clocks 54 and 56 are implemented by separate RC controlled, Schmitt trigger-type oscillators to conserve current. Current consumption is also minimized by using the slow clock instead of the fast clock for most operations since current drain in CMOS circuitry is proportional to the rate of operation and the fast clock operates 167 times faster than the slow clock. The clock selector multiplexer 58 applies the output of either the fast or slow clock to the clock input of the microprocessor 50. The fast clock 56 is enabled by the fast clock enabler multiplexer 60.

The microprocessor 50 is connected to receive input signals on the interrupt request line (INT)-bar, the external flag 1 line (EF1)-bar and the external flag 2 line (EF2)-bar. The (EF2)-bar input is the output of the IR receiver 36. The output of the microprocessor 50 appears on lines N.sub.0, N.sub.1 and N.sub.2, the so-called command bits, gated by internal timing pulse B (TPB) to an output instruction decoder 62 which decodes the three bit word into five individually actuated I/0 strobe lines. The N command bits are normally low, and the 3-bit code signifies eight different output codes of which only five are used. One of the five I/0 strobe lines from the decoder 62 goes high when the corresponding 3-bit binary number is presented to the decoder.

As shown in FIG. 4, the I/0 strobe lines are connected to multibit latches (groups of flip-flops). Reprogramming of the latches is achieved via the output instruction decoder 62 (FIG. 3). Strobe lines I/01-I/05 establish rate, duration, output current (amplitude), electrode polarity and case polarity, respectively via the MA bus.

When the microprocessor 50 issues an I/01 command, a binary "1" is presented to the inputs of the output instruction decoder. As a result, the I/01 output of the decoder goes high; all other outputs remain low. Since this line is tied to the strobe input of an 8-bit rate latch 70, the rate latch will accept and hold the data present on the MA bus at that time. Thus an I/01 output instruction reprograms the rate latch. Sixteen different 8-bit words, in this embodiment, designate 16 rates from 8 pps to 200 pps.

The binary number held by the latch 70 is applied to the parallel preset "jam" inputs of a presettable divide by "N+1" down counter 72 operated by the slow clock 54 (FIG. 3). The (ZERO)-bar output of the rate counter 72 is normally high. However, when a series of clock pulses equal in number to the binary number present at the jam inputs has been applied to the counter's clock input, the (ZERO)-bar output goes low. On the next clock pulse (1.67 ms later) the output returns to the high state, presetting the internal down counter back to the value of the jam inputs via the synchronous preset enable (SPE)-bar input. The effect is to divide the clock frequency by N+1 where N is the value at the jam inputs. This value is set during the programming of the rate latch and is held there by the rate latch itself. For example, a stimulator rate of 100 pulses per second (pps) corresponds to an interval of 10 ms. Since the period of the slow clock is 1.67 ms it requires the 6 clock pulses to reach 10 ms. However, since the rate counter divides by N+1, the rate latch 70 is programmed to 5 to provide the desired stimulator rate. Each time the rate counter 72 "times out", the transition low of the normally high (ZERO)-bar output indicates that it is time to issue a stimulation pulse.

In FIG. 3 the reset input of flip-flop 74 (referred to below as the EF1 flip-flop) is connected to the data output of the IR receiver 36 (FIG. 2) to alert the microprocessor 50 to incoming data. The first IR pulse causes the output of the flip-flop 74 to go low which signals the microprocessor 50 via the first external flag (EF1)-bar input, to look for data at (EF2)-bar. Flip-flop 74 is returned to its initial high state by I/01 whenever the rate latch is reprogrammed.

The (ZERO)-bar output of the rate counter 72 (FIG. 4) signals the microprocessor 50 via the interrupt request input (INT)-bar. This input is accessed through a multiplexer 76 (FIG. 3) which is used to cut the 1.67 ms pulse in half to make sure that the rate counter output does not interrupt twice on the same cycle.

The (ZERO)-bar output of rate counter 72 also enables the fast clock 56 (FIG. 3). Multiplexers 58 and 60 each apply the X input to the output on a "0" control input and the Y input to the output on a "1" control input. The control inputs to the clock multiplexers 58 and 60 are both provided by the output of an AND gate 78 which receives the Q output of the EF1 flip-flop 74 and the (ZERO)-bar output of the rate counter 72. The Q-bar output of the IR data flip-flop 38 (FIG. 2) is normally low. Thus the Q output of the EF1 flip-flop and the (ZERO)-bar output are normally high and the high output of the AND gate 78 normally causes the clock multiplexers to connect their respective Y inputs to their respective outputs. This in turn applies the slow clock 54 to the microprocessor 50 while turning off the fast clock 56. This condition is reversed when the rate counter times out and the (ZERO)-bar output goes low so that the fast clock 56 is available for timing pulse duration. The low output of the EF1 flip-flop which occurs on the first IR pulse also turns on the fast clock input to the microprocessor to enable the microprocessor to accurately decode the relatively fast pulse width modulated data from the IR receiver.

In summary, then, during each cycle when the rate counter times out, the transition to the low state of the (ZERO)-bar output generates an interrupt to microprocessor 50, turns on the fast clock 56 and steers it to the microprocessor 50. Prior to enabling the stimulator pulse, the microprocessor 50 decides whether it is in the on or off portion of the pulse train cycle (i.e., interrupt enabled or disabled, respectively) and reprograms the electrode and case connections which alternate from pulse to pulse if so programmed.

The I/02 strobe line actuates a 4 bit pulse duration latch 80 (FIG. 4) which acquires the four lower order bits of the duration code from the MA bus. There are eight possible durations from 50 to 400 microseconds. A whole byte designates each duration but the two higest order bits, b7b6, are always zero and the next two higher order bits, b5b4, are routed to a borrowed portion of a different latch, as explained below.

The output of latch 80 is connected to the jam inputs of a duration counter 82 which is implemented in the same fashion as rate counter 72 by a divide by N+1 presettable down counter. The normally high (ZERO)-bar output goes low for one clock period when a number of clock pulses equal to the preset number has been counted and reestablishes the preset count via (SPE)-bar on the next clock pulse. In other respects, however, the counter 82 differs significantly from the rate counter 72. First, not all eight jam inputs are supplied by the same duration latch 80 actuated by I/02. The two highest order bits (b.sub.6 b.sub.7) are wired "0"'s and the next two higher order bits are supplied from a separate 2-bit higher order duration latch 84a which is strobed by I/05 in conjunction with case polarity latch 84b. Latches 84a and b comprise a single 4-bit latch. Secondly, the clock input is connected to the fast clock 56 which normally only comes on briefly for a 100 KHz "burst" following the low (ZERO)-bar output of the rate counter. In addition the (COUNT ENABLE)-bar input to duration counter 82 is tied to the Q output of a pulse flip-flop 86 which synthesizes the input pulse to the stimulator amplifier.

I/03 strobes a 7-bit output current latch 88 which takes the corresponding 7-bit word off the bus. When enabled by the pulse flip-flop, the latch 88 causes the selected output level to be applied by an amplifier 90 which produces the output of the pulse generator 22. The output pulse is applied to the electrodes (and the metallic case of the implant, if desired) via a bank of MOSFET's (metal oxide semiconductor field effect transistors). To allow connection of each electrode or the case as either a cathode or an anode, two FET's are employed per electrode. Thus a set of eight FET's 92 are employed for the four electrodes E1-E4 and a single pair of FET's 94 are employed for the metallic case. Each electrode can either be disconnected, connected as an anode or connected as a cathode, according to the connection pattern established by electrode polarity latch 96 which accepts and holds the 8-bit number presented on the bus when I/04 is strobed. Similarly, the case can be either disconnected or connected as an anode if continuous or if alternating, as an anode or cathode. These connections are established by the case polarity latch 84b which accepts and holds the 2-bit case polarity word on the bus when I/05 is strobed. I/04 and I/05 are strobed in that order on each interrupt of the microprocessor, i.e., whenever the rate counter 72 times out when it is time to issue a pulse unless the interrupt is disabled by the on/off cycle software. An example of the voltage waveform on a connected electrode in the alternating mode is shown in FIG. 5, line A.

The pulse flip-flop 86 is reset by the I/04 stobe produced as part of the interrupt service subroutine. This causes the Q output of the flip-flop to go low which simultaneously enables the duration counter 82 and output current latch 88, whereupon a stimulator pulse is begun by the amplifier. Timing out of the duration counter 82 clocks the pulse flip-flop 86 high since the data input is tied to the positive logic level. When the flip-flop output Q goes high the duration counter and output current latch are disabled. However, in the meaintime the duration counter 82 has already been preset by the (ZERO)-bar output to begin the next countdown. The pulse flip-flop is set in order to disable the duration counter and output current latch in any event by the (ZERO)-bar output of the rate counter 72 returning to the high state.

A stimulator pulse can only be enabled by the appearance of an I/04 strobe since this is the only input which can cause the Q output of the pulse flip-flop 86 to go low. If the microprocessor determines that the stimulator is in the off portion of an on/off pulse train cycle, the I/04 signal following an interrupt is omitted until such time as the microprocessor decides that the off portion of the cycle has ended. In the meantime, however, the rate counter 72 continues to operate and thus continues to provide interrupts and fast clock enable singals at regular intervals. The duration counter 82, however, holds at the threshold of its preset count during the off period even though the fast clock is enabled.

In FIG. 2 the reed switch 40 in the communications module 14 allows the patient to turn the implanted stimulator off and back on by disabling and re-enabling the slow clock 54 via and NAND gate 98 (FIG. 3). The slow clock 54 is on when the Q-bar output of reed switch flip-flop 42 (FIG. 2) to gate 98 is low. The patient turns off the clock 54 by momentarily closing the reed switch 40 with a magnet which inverts the state of the flip-flop 42. The Q-bar output to NAND gate 98 goes high and causes the slow clock 54 to stop immediately unless the rate counter 72 at that moment is in that one clock cycle when the (ZERO)-bar output is low and the fast clock is on. In the latter case, the clock stops when the rate counter 72 resumes its countdown and the (ZERO)-bar output returns to its normally high condition.

If programming is attempted when the slow clock has been disabled in this manner, the first IR pulse sets EF1 and turns on the fast clock. Software actuates I/03 while programming, which sets the reed switch flip-flop 42 causing its Q-bar output to go low to enable the slow clock 54.

The dual purpose of the microprocessor controller 18, when not processing a data transmission, is (1) to decide whether to omit the next pulse because the stimulator is in the off portion of the on/off cycle in a pulse train mode of operation and (2), if in the on portion, to reprogram the electrode and case connections just prior to the next pulse. The timing of the on/off cycle and the alternation of the electrode and case connections in the interrupt mode are carried out in accordance with routines stored on ROM 52 (Appendix I). In the preferred embodiment an additional function of the microprocessor is to slow down the pulse rate during the off portion of an on/off cycle so that the interval between the fast clock bursts is as long as possible to conserve current.

In the Table below, specifications for sixteen standard integrated circuit components of the implant of FIGS. 2-4 are offered only by way of illustration of one presently preferred embodiment of the invention. ______________________________________ Op. Amp. (IR receiver 36) Motorola LM 3078 One-shot 34    1/2 RCA CD 4098 (Dual Monostable) Flip-flops 38, 42, 74, 86 2 RCA CD 4013 (Dual "D") Microprocessor 50 RCA CDP 1802 ROM 52         RCA CDP 1833 MUX 58, 60, 76 RCA CD 4053 (Triple 2-bit) Latches 70, 80, 88, 84, 96 4 RCA CD 4508 (Dual 4-bit) Counters 72, 82 2 RCA CD 40103 Decoder 62     RCA CD 4028 AND Gate 78,   RCA CD 4081 (Quad 2-in) gates for decoder 62 NAND Gate 98,  RCA CD 4093 (Quad 2-in) gates in clocks 54, 56 ______________________________________

The two-way implant telemetry system features synchronous communication with identical pulse width modulation codes. As shown in FIG. 5, line B, data is encoded into binary ones and zeros by employing a bilevel pulse signal having a pulse to pulse repetition period of 3 ms. A pulse width of 1 ms indicates a binary "0" while a pulse width of 2 ms indicated a binary "1". For IR transmission from the telemetry head, the high portions of the binary signal correspond to intervals when the IR drive is enabled and the light emitters are lit. For the resonant transponder 30 of FIG. 2 the high portions of the pulse width modulated binary data signal correpsond to intervals when the shunt transistor is conductive.

The programmer console 12 converses with the implant by means of two different kinds of words: a 3-bit command word and a 27-bit parameter value data word, as illustrated in FIG. 6. The command words call corresponding subroutines on the ROM 52. The commands per se are not stored in the microprocessor 50; they are directly acted upon. The 27-bit data word, on the other hand, contains all of the pulse parameter data and is stored in the microprocessor 50. Among the 16 scratch pad registers in the microprocessor (CDP1802), two pairs of registers are chosen as temporary and control registers for the parameter data word transmitted by the programmer 12. The first pair of registers is designated temporary register A (TEMPA) and temporary register B (TEMPB). Each has a 16-bit capacity for a combined total of 32 bits, five fits of which are dedicated to a fixed model identification number. The second pair of registers is designated control A (CONTA) and control B (CONTB) in the same manner. The remaining register assignments are discussed in conjunction with Appendix I.

The command vocabulary includes the following commands designated by six corresponding 3-bit codes: LOAD T, ACTIVE, XMIT T, XMIT C, ROM DMP, and STAT OFF. The command LOAD T signals the microprocessor to place the immediately following 27 bit data word into the temporary registers A and B as shown in FIG. 7. The data word comprises 27 serial bits which are position coded. The first three bits beginning with b0 dictate the pulse duration by reference to a stored parameter table in the ROM 52. The next eight bits beginning with bit position b3 define the electrode connections (off, anode, cathode, i.e., two bits for each of four electrodes). The next bit, bit position b11, indicates whether the case will start off as an anode or will be disconnected. Bit b12 selects constant or alternating polarity mode of operation. The next three bits beginning with bit position b13 establish the off time for a pulse train mode of operation, and the following three bits beginning with b16 specify the on time. The on/off times each may be zero to seven minutes long in one minute increments and are actually given in the parameter table. The four bits beginning with b19 denote the amplitude of the output current and the last four bits, b23-b26 designate the programmed pulse rate. The amplitude and rate bits also refer to the parameter table.

The implanted stimulator 10 can be interrogated and reprogrammed to new pulse parameters by means of an interactive external neural stimulator programmer, as shown in FIG. 8. The programmer is an intelligent, microprocessor-based interactive system capable of noninvasively programming, interrogating and verifying the parameter values in the neural stimulator implant 10. The programming system comprises two separate components: a table-top programmer console 12 and a cable-connected hand-held telemetry head 16, described in detail in the incorporated copending application by Slocum et al. The programmer console 12 is run by a single chip CMOS 8-bit microprocessor 100 of the same type as microprocessor 50 in the implant, i.e. the RCA CDP 1802. Software is stored on an electronically programmable read only memory (EPROM 102).

The console 12 includes a twenty key calculator-type keyboard 104 for parameter selection, review and programming by the operator. The keyboard 104 consists of four command keys in the right hand column bearing the letters F, P, S and T and 16 numeric keys (0-15) arranged in a 4.times.4 array. The numeric keys 0-10 are marked with legends corresponding to the various programmable parameters duch as rate, amplitude, etc. Key number 15 bears a legend ROM DMP. Briefly, the "S" key is used to program the implant to the off condition automatically; the "P" key programs the stimulator to new pulse parameter values; the "F" key is used to propose a new value for any one of the programmable parameters; and the "T" key merely displays the already proposed value for the selected parameter.

Adjacent to the keyboard 104, a pair of visible light emitting diodes (LED's) 106 and 108 are connected to indicate, respectively, an invalid keyboard entry and proximity of the programming head 16 to the implant 10. Also adjacent to the keyboard 104 is a four digit, seven segment LCD clock-type display 110 operated by conventional decoder, latch and driver circuitry 112 and a 30 hertz oscillator 114. The display 110 is controlled via an I/O decoder 116 responsive to the three N command bits from the microprocessor 100. Data to be displayed is taken off of the 8-bit data bus. The keyboard 104 is interrogated via the I/O decoder 116 which controls a column input latch 118 and row latch and driver circuit 120. Key rows are individually interrogated by the row latch and driver circuit 120 and the keyed information is put on the data bus via the column input latch 118. A 32-byte random access memory (RAM) 122 is used for temporary storage of current and proposed parameter data words. The EPROM 102 and RAM 122 are both accessed by an address decoder circuit 124 via the microprocessor address bus. Incoming and outgoing data from the memories 102 and 122 is placed on the data bus. The command bit I/O decoder 116 in conjunction with the data bus also operates the telemetry enable output and LED's 106 and 108 via latch and LED drivers 126.

The telemetry head 16 performs receiving, transmitting and proximity detecting functions. For signalling into the implant 10, the head 16 includes an infrared driver 128 which operates a plurality of infrared LED's (not shown) located on the surface of the head 16. The infrared driver 128 is keyed directly by the serial bit Q output of the microprocessor 100 in the console 12. The Q output is provided in pulse width modulated form (i.e., 1 ms and 2 ms pulses), and the driver 128 turns the IR LED's on and off in accordance with the state of the Q output. Inside the implant 10 this data signal is received by the IR receiver circuit 36 shown in FIG. 2.

The telemetry head 16 also includes a 16 kHz magnetic carrier transmitter 130 for flooding the implant 10 with a continuous wave myriametric frequency magnetic signal. The reflected or reradiated magnetic signal from the implant 10 is picked up with a characteristic phase shift. The amplitude of the phase shift is threshold detected by a proximity detector 132. The output ACQ of the detector 132 sets an external flag at input (EF1)-bar of the microprocessor 100 to indicate that the programming head 16 is adequately positioned with respect to the implant 10 to carry on two-way communication. A telemetry receiver 134 in the head 16 produces an output signal to the (EF2)-bar input of the microprocessor 100. The output of the receiver 134 duplicates the pulse width modulated binary data signal applied to the resonant transponder circuit 30 (FIG. 2) in the implant. The phase shift caused by shunting the tuned coil in the implant is demodulated by the receiver 134. The telemetry enable signal from the console 12 activates the receiver 134 when the external programmer is expecting a data transmission from the implant.

The software program stored on EPROM 102 which operates the programming system is reproduced in FIG. 11 and Appendix III with an accompanying English language flow chart in Appendix IV. Appendix III contains not only the machine code in hexadecimal digit form but also fully annotated assembly language. This material, like that for ROM 52 of the implant, is based on the standard programming repertoire of the RCA CDP 1802.

When the programmer is turned on, before the keyboard comes into play, the software runs the programming system through an automatic initial interrogation routine outline in twenty-six steps in Table I below. __________________________________________________________________________ Initial Interrogation Routine PROGRAMMER ACTION       STIMULATOR RESPONSE __________________________________________________________________________ Wait for proximity detection. 2. Enable infrared detector. Transmit "REQUEST TO SEND" pulse 4. Transmit 2 "CLEAR TO and wait for "CLEAR TO SEND" SEND" pulses. pulses. Transmit "INTERROGATE CONTROL 6. Decode Command. REGISTER" Command 7. Transmit contents of Control Register. Decode Control Register Pulse Train. Store control register values. 10. Wait for Proximity detection. Transmit "REQUEST TO SEND" 12. Transmit 2 "CLEAR TO pulse and wait for "CLEAR SEND" pulses. TO SEND" pulses. 20. Transmit "INTERROGATE TEMPORARY 21. Decode command. REGISTER" command. Decode temporary register pulse train. Store temporary register values. Compare temporary register 26. Resume stimulation. values to control register values. Go to Step 1 if not equal. __________________________________________________________________________ On power up, the programmer clears the display 110 and waits for the programming head 16 to be placed over the implant. Once the programmer detects proximity via the ACQ line, the programmer lights the proximity indicator LED 108 and proceeds to interrogate and verify the implanted stimulator's current programmed values, i.e. the values stored in the control registers A and B of the microprocessor 50 inside the implant. Meanwhile, in the implant the 16 kHz magnetic field enables the infrared detector 36 (FIG. 2).

Once proximity is detected, an automatic "handshaking" interaction occurs as shown in FIG. 9. The upper line in FIG. 9 represents IR transmission via the infrared driver 128 in the head 16. The lower line represents the output of the telemetry receiver 134 which receives the phase shift modulated data signal from the implant, as described in the copending application. According to step 3 of Table I, the programmer generates at least one request to send pulse. The first IR pulse detected by the implant signals EF1 in microprocessor 50 of FIG. 3. This condition is continuously tested in the implant by the operating cycle of the microprocessor 50. In response to EF1, the software in the implant causes the serial Q output of the microprocessor 50 to be set to "1" for 1 ms, to "0" for 2 ms and again to "1" for another 1 ms pulse. These two pulses from the implant (lower line, FIG. 9) represent "clear-to-send" pulses to complete the handshake routine. The programmer will automatically continue to generate request-to-send pulses every 7 ms until detection of clear-to-send pulses from the stimulator.

Next, in step 5 of Table I, the "interrogate control register" command, i.e., the 3-bit XMIT C command "001", is transmitted by IR pulses. The stimulator decodes the command with software and then transmits the 32-bit contents of the dual control registers in the implanted microprocessor 50, as shown in FIG. 9. The contents of the control registers are shifted serially out the Q output of the implanted microprocessor in pulse width modulated code and trasmitted via the resonant transponder to the external head 16. Software in the programmer console 12 decodes the control register pulse train (step 8) and stores the control register values (step 9).

At this point the automatic initial interrogation routine repeats the handshaking routine in steps 10, 11 and 12 after which the programmer transmits the 3-bit LOAD T command followed by the serial contents of the stored control register values which were previously transmitted in step 7 from the implant. Steps 14 and 16 in the stimulator cause the externally stored control register value to be placed in the temporary registers A and B in the microprocessor 50 of the implant. At this point, the current values of the actual stimulation parameters in the control registers have been transferred to the temporary registers so that now the temporary and control registers in the implant should both be identical with the values received and stored by the external programmer.

Steps 17 through 19 repeat the handshaking routine once again to insure continuing proximity for proper signal acquisition. In step 20 the programmer causes 3-bit XMIT T command to be transmitted via the IR driver 128, which makes the stimulator transmit out the contents of its temporary registers. Temporary register values are stored externally in the RAM 122 and compared in steps 24 and 25 to the previously stored control register values. If they match, successful interrogation is indicated to the operator by four dashes in the digit positions of the LCD display 110: [-:-]. If the values do not match, the entire interrogation routine is repeated. In the meantime, in the absence of unexecuted external commands, the stimulator resumes stimulation.

The automatic initial interrogation interaction of Table I is a data transfer checking routine. Thus, the implant transfers a 32-bit word to programmer; the programmer transfers the same 32-bit word back to the implant and then asks the implant to transfer the same 32-bit word back to the programmer which compares it with the original reception to see if the two match. This interplay insures the transmission and decoding integrity of the communications system.

Once the initial interrogation routine is successfully completed, software turns off the proximity indicator LED 108 and begins monitoring the keyboard. However, the contents of the control registers in the implant are maintained in storage (RAM 122) reflecting the current parameters which were found to be in effect for the implant during the initial interrogation routine. Table II below indicates the display reference numbers corresponding to the programmable values which may be selected via the keyboard 104. ______________________________________ Parameter     Display Ref. # Actual Value ______________________________________ Rate          0             8       pps. 1             10      pps. 2             12      pps. 3             15      pps. 4             20      pps. 5             25      pps. 6             30      pps. 7             33      pps. 8             40      pps. 9             50      pps. 10            60      pps. 11            75      pps. 12            100     pps. 13            120     pps. 14            150     pps. 15            200     pps. Amp (Amplitude) 0             0.1     ma. 1             0.2     ma. 2             0.4     ma. 3             0.6     ma. 4             0.8     ma. 5             1.0     ma. 6             1.2     ma. 7             1.4     ma. 8             2.0     ma. 9             3.0     ma. 10            4.0     ma. 11            5.0     ma. 12            6.0     ma. 13            7.0     ma. 14            8.0     ma. 15            10.0    ma. Ton (Time On) 0             0       min. 1             1       min. 2             2       min. 3             3       min. 4             4       min. 5             5       min. 6             6       min. 7             7       min. Toff (Time off) Same as Ton  Same as Ton Mode          0             Continuous 1             alternate Case          0             off 1             anode Elec 1 (Electrode 1) 0             anode 1             off 2             invalid 3             cathode Elec 2 (Electrode 2) Same as Elec 1 Same as Elec 1 Elec 3 (Electrode 3) Same as Elec 1 Same as Elec 1 Elec 4 (Electrode 4) Same as Elec 1 Same as Elec 1 Dur (Duration) 0             50      sec. 1             100     sec. 2             150     sec. 3             200     sec. 4             250     sec. 5             300     sec. 6             350     sec. 7             400     sec. ______________________________________

The "F" command key calls a subroutine which is used to display the current value and propose a new value for any one of the programmable parameters listed above the numeric keys 0-10. Depressing the "F" key displays a "-4" on the left half of the display. Key Press    Resulting Display ______________________________________ F            [-4:  ] 1 (amp)      [1:10] ______________________________________

The above two keystroke sequence, F, 1, results in the display of the current value for the amplitude according to the stored contents of the control registers. The "1" on the left half of the display corresponds to the numeric key above which is written "amp" for amplitude on the keyboard 104 of FIG. 8. The "10" on the right half of the display is a reference number for the value 4.0 ma from the parameter Table II above. To propose a new value, a third consecutive key strike, "9", for example, results in a display [1:9]. The "1" still represents the parameter amplitude, and the "9" represents the proposed new value corresponding to 3.0 ma, which is now maintained in storage by the programmer console 12.

This operation is repeated for each of the other parameters, RATE, TIME ON, TIME OFF, MODE, CASE, ELECTRODES 1, 2, 3 and 4, and DURATION (pulse width). Initially, however, the register in the external programmer which is to hold the proposed values is set equal to the current values received from the implanted control register. Accordingly, only those parameters which are desired to be changed have to be entered via the "F" key sequence.

After the new parameter values have been entered, the "P" command key is used to program the implant to the new proposed value "P". Depressing the "P" key clears the display until verification of successful programming is indicated by the appearance of "-3" in the left half of the display: [-3: ]. A step by step description of the programming routine initiated by striking the "P" key is presented in the following Table III. __________________________________________________________________________ Programming Routine PROGRAMMER ACTION       STIMULATOR RESPONSE __________________________________________________________________________ Wait for proximity detection. 2. Enable infrared detector. Transmit "REQUEST TO SEND" 4. Transmit 2 "CLEAR TO pulse and wait for "CLEAR SEND" pulses. SEND" pulses. Transmit "INTERROGATE CONTROL 6. Decode command. REGISTER" command. Decode control register pulse train. Compare redeived "Control Register" data to previous "Control Register" data. If not equal programmer assumes new patient and goes to Step 1 of Table I. 10. Wait for proximity detection. Transmit "REQUEST TO SEND" 12. Transmit 2 "CLEAR TO pulse and wait for "CLEAR SEND" pulses. TO SEND" pulses. Transmit "LOAD TEMPORARY 14. Decode command. REGISTER" command. Transmit "PROPOSED VALUES". 16. Decode pulse train and store in Temporary Register. Wait for proximity detection. Transmit "INTERROGATE TEMPORARY 21. Decode command. REGISTER"" command. 22. Transmit contents of Temporary Register (Proposed Values). Decode and Store Temporary Register pulse train values. Compare Temporary Register values to Proposed Values. Go to Step 1 (Table III) if not equal. Wait for proximity detection. Transmit "REQUEST TO SEND" 27. Transmit 2 "CLEAR TO pulse and wait for "CLEAR SEND" pulses. TO SEND" pulses. Transmit "ACTIVATE" command. 29. Decode command. 30. Transfer Temporary Register values to Control Register. Wait for proximity detection. Transmit "REQUEST TO SEND" 33. Transmit 2 "CLEAR TO pulse and wait for "CLEAR SEND" pulses. TO SEND"  pulses. Transmit "INTERROGATE CONTROL 35. Decode command. REGISTER" command. Decode and store Control Register values. Compare received Control 39. Resume stimulation. Register values to Proposed values. Go to Step 1 (Table III) if not equal. __________________________________________________________________________

The first eight steps of the automatic sequence activated by pressing the "P" key are the same as in the initial interrogation routine in which the contents of the implant control registers are transmitted out to the programmer after proximity detection and handshaking. This time, the programmer compares the newly received control register data to the previously stored control register data which was taken during the initial interrogation. If the two do not match, the programmer assumes that there is a new patient and runs through the initial interrogation routine of Table I. This is indicated, assuming that the initial interrogation is successful, by four dashes appearing in the digit positions of the display [-:-]. If the contents of the control register match in step 9 of Table III, the programming routine goes through acquisition and handshaking again and then commences loading the temporary registers in the microprocessor 50 of the implant by transmitting the 3-bit command LOAD T followed by the 27-bit data word.

The programming routine reacquires and handshakes again in steps 17-19 and interrogates the just loaded temporary registers by issuing a 3-bit command XMIT T. In steps 23 and 24 the temporary register values transmitted out by the implant are compared to the proposed values and if they do not agree the programming routine in Table III starts over. If they agree, the programmer reacquires, rehandshakes with the implant (steps 25-27) and transmits the ACTIVE command which makes the implant transfer the values in the temporary registers to the control registers (step 30). This command reprograms the stimulator to the desired parameter values as explained below in conjunction with the stimulator software. However, the external programming routine is not finished yet. After rehandshaking, it orders the implant to transmit the control register values by sending the 3-bit command XMIT C, as in the initial interrogation routine. If the just transmitted control register values do not equal the proposed values still stored in the external programmer, the programming routine is started over. If they are correct, the display flashes [-3: ] signalling the end of the programming routine and the resumption of stimulation by the implant according to the newly programmed stimulation parameters.

There are two other functions which can be selected by the programming keyboard 104. The "T" command key is similar to the "F" command key but is used to display only the proposed value of the selected parameter. Key Press    Resulting Display ______________________________________ T            [-1: ] 1            [1:9] ______________________________________

The above two keystroke sequence displays the proposed value for amplitude which was entered in the first example. If the "F" key were used instead of the "T" key, the value for the amplitude parameter which was found during initial interrogation (i.e., "10") would have been displayed.

The "S" command key is used to program the implant to "OFF" automatically without having to use the F key to enter all of the OFF conditions as proposed new values. Depressing the "S" key is indicated by displaying a "-2" in the left half of the display.

In addition to the four commands described, the programmer is capable of verifying the read only memory contents of the implant. This feature would generally only be available in a programmer used in manufacturing to verify the ROM contents of the implantable stimulator before shipping. This feature is available through the following key stroke sequence: Key Press    Resulting Display ______________________________________ F            [-4: ] 15           [15: ] ______________________________________

The machine cycle of the external microprocessor 100 is by design about 1.25 microseconds. Thus the crystal clock for the external microprocessor 100 should be nominally 6.5 megahertz. Since the implanted and external devices operate with independent power supplies and the internal clock at least by present design is not a crystal oscillator, it is possible with aging batteries for the timing of the telemetry pulse code to elude the 1.5 ms sampling interval. Thus it may be advisable to test the pusle width of the clear to send pulses for example and adjust the sampling interval accordingly with additional software.

The ROM DMP and STAT OFF commands from the external programmer call specific subroutines in the implant. The ROM DMP subroutine automatically dumps the serial contents of the implanted ROM 52 out the data port Q of the microprocessor 50 in pulse width modulated code. The STAT OFF subroutine in the implant automatically establishes off parameters directly via an internal initialization subroutine on the ROM 52.

Appendix I contains the program listings in machine code and assembly language for the implanted microprocessor 50 along with English annotations. Appendix II is a detailed flow chart of the routines in assembly language with English comments. The software is based on standard CDP1802 architecture and standard CDP1802 instruction repertoire. However, the program is considerably more complex than the external programmer software (Appendix III). Thus, the explanation which follows is tied more closely to the actual software instructions.

In the Appendices the higher order byte in a 16-bit rate register is specified as R(RATE) 0.1, for example. The lower order byte in the TEMPA register is specified as R(TEMPA) 0.0. The address of the decode subroutine, a specific number, is specified as A(DECODE).

In Appendix I the first column on the left comprises four hexadecimal (hex) digits indicating memory locations for the instructions in the second column, which are also given in hex digit form. Each pair of hex digits represents one 8-bit byte in the ROM. The four decimal digits in the third column designate line numbers of the printout. For example, in line 33 there are five instruction bytes located in consecutive memory addresses 2, 3, 4, 5 and 6. The next column to the right of the line number column includes program location markers such as "START" which form headings to identify special locations in the program. The next column gives the assembly language translation of the machine code instruction, and finally the English annotations are provided in the far right portion of each line set off from the assembly language by a pair of periods.

The instructions in the second column of Appendix I are stored in ROM 52 (FIG. 3) which is appropriately programmed by mask during manufacture. The program takes up just over two pages of consecutive memory locations (205 hex). Unused ROM locations contain zeros. Seventy-nine more locations (03B1to 3FF) for the parameter tables are listed beginning at line number 484. Here, specific alternative values for on times, off times, rates, current amplitudes and pulse durations are addressed by corresponding portions of the data word. The actual rate for example is not specified by the rate bits of the data word. Instead, the rate bits give the local address in the table where the desired rate can be obtained. Different parameters can be prescribed in the ROM tables without affecting the program operation or data word. This feature enables the physician to bring several neural stimulator packages into the operating room, each one different from the other only in terms of the ROM parameter tables, to provide an even wider selection of parameters than is afforded by a single programmable neutral stimulator. Once implanted, of course, the neural stimulator of this embodiment would be confined to the sixteen selectable rates in the parameter table for the ROM in that specific neural stimulator. The parameter table feature also provides product adaptability for the manufacturer.

The first 26 line numbers of the program listing in Appendix I define the assignments for the 16 scratch pad registers in the microprocessor 50. The register numbers are arbitrary. TEMPA, TEMPB and CONTA and CONTB are the 16-bit temporary and control registers which receive the data word. Registers ONE, MAIN, RDEC and FREE are general utility registers. The RATE register holds the programmed rate from the parameter table for quick reprogramming during on/off cycles. There are two registers each for the case and electrode connections for alternating polarity operation on consecutive output pulses. The on/off register indicates which portion of the cycle the neural stimulator is presently in.

The program actually begins at line number 29 where the interrupt capability of the microprocessor is disabled. When the interrupt is disabled, stimulator output pusles are also disabled because the microprocessor cannot issue an I/04 output pulse. The registers are initialized by placing the address of the first interrupt service subroutine in register ONE, the address of the DECODE subroutine in register RDEC and the address of the telemetry output subroutine "SUBQ" in register QOUT. Next the STAT OFF subroutine automatically places preordained bit patterns in the temporary registers A and B. The STAT OFF subroutine programs parameter values which cause the neural stimulator to be in the off condition. In addition to the STAT OFF parameters the five higher order bits in the lower order byte of temporary register B are assigned model number bits whih identify the neural stimulator model.

Next the program branches to the ACTIVE subroutine which begins at line 211 of Appendix I. The ACTIVE routine moves the contents of the temporary registers into the control registers and programs all of the neural stimulator's parameters. Before transferring the data to the control registers, the microprocessor first programs the amplitude latch by isolating the amplitude code in the higher order byte of the temporary register A, obtaining the addressed amplitude from the parameter table and putting it on the data bus. The assembly language instruction "INP 3" activates the I/03 strobe line and sets the reed switch flip-flop 42 in the communications module (FIG. 2). After programming the amplitude latch, the entire contents of the temporary registers are transferred to the control registers. The rate and lower order duration latches 70 and 80 are programmed in a similar manner using the code from the corresponding portion of the control register to address the parameter table. The higher order duration bits are placed in the case registers for subsequent programming.

The electrode and case registers are programmed in lines 256 through 303 beginning at location 31 in Appendix I. The eight electrode polarity bits are placed in the lower order bytes of the two electrode registers (ELEC1 and ELEC2) and the mode bit is tested. If the mode of operation is to be continuous there is no need to change the bits in the second electrode register. However if the mode indicates alternating polarity, the bits in the second electrode register (i.e., for the even cycles) are logically manipulated to produce the alternate mode. This is somewhat more complicated than merely taking the complement of the bits since the two bit code for each electrode can specify four different conditions, only two of which are reversible, that is anode and cathode. The other two are of (i.e., disconnected) and disallowed, both of which remain the same on odd and even cycles.

At location 33 the case is programmed by first testing the case bit. Only the two higher order bits of the lower order byte of the two case registers (CASE1 and CASE2) are used. If the case is always off, "1" and "0" are placed in the higher order bits of both registers. If the case is normally connected as an anode then zeros are placed in the higher order bits of both registers if the mode is continuous. If alternate, zeros are placed in the higher order bits of the first case register and ones are placed in the higher order bits of the second case register.

The subroutine beginning at location 38 (line 308) programs the correct on and off times into the corresponding registers by isolating the on and off code from the control register. If the on time code indicates that the stimulator is to be always off then the pulse rate is slowed down to the minimum by the subroutine beginning at location 61. On the other hand, if the code for the off time indicates that the stimulator is supposed to be always on, the subroutine beginning at location 60 reprograms the rate latch via the I/01 line and enables the interrupt to allow the neural stimulator to begin operating. In either case, always on or always off, there is no need for the microprocessor to time the on/off cycle. Accordingly, the program at location 62 allows the interrupt line to remain either disbled or enabled depending on whether the stimulator is supposed to be always off or always on while the software continuously tests EF1 to see whether it is time to program. Otherwise, the microprocessor is exclusively under the control of the itnerrupt request input, i.e., the output of the rate counter.

A more complicated operation takes place if on and off times are involved. To continue with the routine which began at location 38 in line 319, the off time from the parameter table addressed by the off code in the data word from the control register is placed in the higher order byte of the OFF register and the hex digits 6 and 5 are placed in the lower order byte of the OFF register in order to get closer to 60 seconds. Next the on code bits are isolated and placed in the FREE register. The CYCLE register is pointed to the proper position in the on parameter table. The on parameter tables run from memory locations 3B1 through 3CF. Each on value in the table is two bytes long. The table is addressed by obtaining the higher order address byte (03) of the parameter tables and adding to it the doubled rate number. Next the value in the on time code number and the product is subtracted from hex digits FFFF and stored in the ON register. The program then branches to location 42 (line 132) to set up the on time by placing the contents of the ON register into the CYCLE register, reprogramming the stimulator rate and setting the ON/OFF flag register to on, whereupon the program returns to the starting point of the MAIN routine at location 21 (line 47).

The MAIN routine enables the interrupt line and tests EF1 to see whether it is time to program. If not, on each pass through the loop the program repeatedly increments the number in the cycle counter until the cycle counter times out. When the cycle counter is at zero, the interrupt is disabled and the program shifted to location 41 which tests the on/off register. If the stimulator has been on and is going to be turned off, the RATE latch is programmed to the minimum rate and the contents of the OFF register are placed into the CYCLE register and the off flag set. After the off flag is set the software returns to location 23 by bypassing the enable interrupt instruction and continues to test EF1 and increment the cycle counter. On the other hand if the stimulator has been off and is going to be turned on the contents of the ON register are placed in the CYCLE register and the programmed rate is reprogrammed. After the on flag is set, the program returns to the top of the MAIN loop (location 21) and enables the interrupt which allows the stimulator output to resume.

The remainder of the routines in the program are callable subroutines for performing special tasks. The most important of these of course is the interrupt service subroutine (line 435) which occurs whenever the rate counter 72 times out and interrupt is not disabled. In the interrupt subroutine the case polarity and higher order duration bits are programmed by applying the contents of the CASE1 register to the MA bus lines while strobing I/05. Next, the contents of register ELEC1 are put on the memory bus while strobing I/04. The address of the interrupt service routine is incremented so that the next time the interrupt occurs the second or alternate interrupt service subroutine will be called. In the second interrupt subroutine, the contents of the CASE2 register are placed on the bus while the I/05 line is strobed. Next the contents of register ELEC2 are applied to the memory address bus and the I/O line 4 is strobed to program the electrode polarity and enable the output circuit. If the alternating mode has been selected, the connections for the case and electrodes which have been connected as either anode or cathode are reversed.

The other subroutines perform special tasks in decoding or telemetry. The COMMAND subroutine beginning at line 65 decodes the 3-bit command code and steers the program accordingly. The command subroutine is also responsible for generating the 1 ms clear to send pulse in response to the first programming pulse when EF1 is set and 2 ms later for generating a second 1 ms pulse (ready-to-program) after which the decode subroutine is called to test the status of (EF2)-bar, i.e., the IR data input. The XMIT T (line 169) and XMIT C (line 177) subroutines shift the contents of the temporary or control register, respectively, out the Q output port for telemetry back to the programmer. The SUBQ subroutine shifts the "D" register (i.e., the "accumulator" in the microprocessor) out the Q output of the microprocessor, pulse width modulated. The 27 pulse train decoding routine beginning at line 187, location 1, decodes the twenty-seven pulse width modulated input signals into ones and zeros and stores the results in temporary registers A and B. Finally, the DECODE subroutine (line 404) tests each bit at 1.5 ms to determine whether it is a zero or a one. The DECODE subroutine is incorporated in the COMMAND subroutine and the 27 pulse train decoding subroutines.

If the programmed on/off cycle of the implanted stimulator is such that the stimulation pulse train is always on (i.e., off time equals zero), the microprocessor 50 spends all of its free (non-interrupt) time executing the instruction at location 62 (line 356). This instruction causes the microprocessor to keep on testing EF1 to see if it is time to program. When responding to an interrupt request the microprocessor executes the interrupt service subroutines. If the programmed on/off cycle is such that the stimulator is always off (i.e., on time equals zero) the microprocessor spends all of its time testing EF1. If the stimulator is executing a real on/off duty cycle, the microprocessor repeatedly tests EF1 and increments the cycle register, spending all of its time at location 23 (line 50). In transition from one state to the other, the microprocessor executes instructions beginning at location 41 and then returns to the timing and EF1 testing loop at location 23. While in this loop, the microprocessor will respond to interrupt requests only in the on portion of the cycle.

When the physician wants to change the programmed pulse parameters to prescribe a different stimulation therapy program for the patient, he positions the telemetry head 16 over the implant with the magnetic carrier transmitter 130 (FIG. 8) on, as described in the above-referenced copending application. The resonant transponder 30 (FIG. 2) turns on the IR receiver 36. The first IR pulse transmission from the telemetry head sets EF1 in the microprocessor 50. EF1 disables the interrupt (location 22) and calls the command decoding routine which sends the two "clear to send" pulses back to the telemetry head via the transponder 30, and then waits for a command. The programmer console automatically executes the initial interrogation routine (Table I). The thirty-two bit data word received by the telemetry head receiver 134 is decoded and stored externally. Meanwhile the implanted microprocessor returns to normal operation via location 38 (line 308). The physician can display the current parameters one at a time with the "F" key and respective number keys.

After selecting new parameters for stimulation via the "F" key strike sequence, the physican initiates the automatic programming routine of Table III by pressing the "P" key. After the "handshake" routine, and patient confirmation, the temporary registers are loaded and verified before transfer to the control registers. After executing each external command, the microprocessor returns to normal operation via location 38 (Appendix I). The ACTIVE command calls the subroutine which transfers the contents of the temporary registers to the control registers and reprograms all of the latches and the RATE, ON, OFF, ELEC1, ELEC2, CASE1, and CASE2 registers in the microprocessor and then returns to normal operation with the newly programmed parameters via location 38. To doublecheck, the external programming routine interrogates the control registers once more via the XMIT C command. Following telemetry execution of the XMIT C subroutine, normal operation continues via location 38.

If, prior to reprogramming, the patient has turned off the stimulator by disabling the slow clock 54 with his reed switch permanent magnet, the fast clock will operate the microprocessor through a portion of the reprogramming schedule in the following manner. When the telemetry head is placed over the implant, the passive tuned coil transponder activates the IR receiver. The first IR pulse resets the EF1 flip-flop 74 (FIG. 3), turning on the fast clock. The slow clock remains off. The registers are interrogated with the fast clock operating the microprocessor. No stimulation pulses (interrupt requests) will occur until the slow clock starts. To start the slow clock the magnet can be used to toggle the read switch flip-flop 42. Altnernatively, the flip-flop is reset by reprogramming the latches. In the ACTIVE routine, the amplitude latch is first programmed via I/03 (line 220), which also sets the reed switch flip-flop 42 thus starting the slow clock and the rate counter immediately. As the ACTIVE routine continues, the rate latch is programmed via I/01 (line 235) which is also fed back to set the EF1 flip-flop. The Q output of the EF 1 flip-flop 74 operates the clock multiplexers which (normally) direct the slow clock to the microprocessor and disable the fast clock. From this point on, the ACTIVE routine operates at the slow clock rate in the normal fashion until normal operation of the stimulation pulse generator is resumed via location 38.

The microprocessor-controlled neural stimulator implant described above optimizes the flexibility of control over the stimulation pulse parameters for the manufacturer as well as the physician while minimizing the number of components and current drain for a long battery life. Energy is conserved by disabling the fast clock which times the pulse width except when absolutely necessary for this function or for operating the microprocessor. The full two-way communication capability of the implant assures reliable program entry and offers a channel for interrogating the operating parameters of the stimulator at any time. The unique division of labor between the stored program microprocessor and the discrete digital counter offers maximum flexibility and efficiency. The alternating polarity mode of operation is a formerly unavailable stimulating mode which will have physiological advantages in certain situations. In particular, it is believed that electrochemical effects on the tissue at the site of the electrode will be ameliorated by alternating polarity for extended therapy. The use of a stored parameter table for rate, width, amplitude and on and off times adds the capability of altering the stored parameters by mask without any effect on the operating system.

The above-described circuitry can be varied and modified in many respects without departing from the underlying principles of the invention. For example, the operation of the microprocessors does not depend on any specific form of data transmission. While pulse width modulated IR transmission and reflected signal magnetic telemetry are preferred, other modes of communication will work if the system is adapted to decode the data. The RCA CDP1802 microprocessor is preferred for the implant because of its CMOS construction and abundance of internal registers. Nevertheless, other commercially available microprocessor systems can be used, and with advances in technology, new components will undoubtedly be even better suited. External random access memory can be used if needed. The slow and fast clocks can be implemented in a variety of different ways although the RC Schmitt trigger combinations illustrated in FIG. 3 are preferred because of lower power consumption. Alternatively, it may be possible to use a single oscillator and interchange only the portion of the oscillator which determines the rate. This would still be viewed as two separate oscillator configurations, however.

The invention does not depend upon the specific details of the programmer console or a specific command or data format as the stored program can be modified to meet the needs of any reasonable format. The principles of the invention are not confined to multi-electrode neural stimulators but are applicable to all implantable stimulators which operate by applying pulses of electricity to a stimulation electrode. While discrete components are used in the preferred embodiment for the parameter latches and pulse generation functions, this is not meant to exclude the possibility of implementing these functions in software executed by the same microprocessor that is used for programming or by a second microprocessor dedicated to the pulse generation function. Certain aspects of the system are not limited to stored program data processing systems and are applicable in general to stimulator implants. For example, the alternating polarity mode can be implemented entirely in hardware as can the dual clock energy conserving pulse generation system.

As various changes can be made in the above construction without departing from the scope of the invention, it should be understood that all matter contained in the above description or shown in the accompanying drawings shall be interpreted as illustrative and not in a limiting sense.

## Claims

1. An implantable tissue stimulator, comprising timed-output indicative of counting down to zero from a preset number, and each having a preset input and a clock input, said first and second counting clock inputs being connected to said slow clock and said fast clock respectively, said first counting means, output of said first counting means and ending said output pulse in response to the timed-out output of said second counting means, pulse from said logic means to said electrode, multiplexer having an output, and of said fast clock enabler multiplexer and having a second input connected to said slow clock, said clock selector multiplexer applying selectively either the fast clock or slow clock to a clock input of a microprocessor.

2. The stimulator of claim 1, wherein said first and second counting means each include a respective preset enable input, the preset enable input of said first counting means being responsive to said timed-out output of said first counting means for recycling said first counting means and the preset enable input of said second counting means being responsive to the output of said logic means, and means for disabling said fast clock following said logic means output pulse.

3. The stimulator of claim 2, further comprising means responsive to an externally generated signal for disabling said slow clock.

4. The stimulator of claim 3, wherein said means for disabling said slow clock includes logic means for causing said slow clock to be disabled in response to said signal only when said fast clock is also disabled.

5. The stimulator of claim 1, wherein said slow and said fast clocks are separate oscillator circuits.

6. An implantable stimulator, comprising clock for fetching and executing instructions in accordance with the stored program, second clock, for disabling said first clock for predetermined variable time periods, electrical stimulation pulse via said electrode, and disconnecting said first clock from the clock input of said microcomputer means and for connecting said second clock to the clock input of said microcomputer means.

7. The stimulator of claim 6, wherein said interval timing means includes producing an output signal upon counting a number of second clock pulses corresponding to the number in said register means, and first clock.

8. The stimulator of claim 7, wherein said microcomputer means has means for altering the number in said register.