EXHIBIT 10.40


                            NOTE PREPAYMENT AGREEMENT

         THIS AGREEMENT ("AGREEMENT") is made as of October 15, 2003, between
Whitebox Hedged High Yield Partners ("WHITEBOX") and HEI, Inc. (the "COMPANY").

         WHEREAS, the Company issued to Colorado Medtech, Inc. ("CMED") the
Company's Subordinated Promissory Note dated January 24, 2003 payable to the
order of CMED in the original principal amount of $2,600,000 (the "Note");

         WHEREAS, on or about May 8, 2003, CMED sold the Note to Whitebox;

         WHEREAS, pursuant to a letter agreement dated on or about May 16, 2003
(as modified by subsequent agreements between Whitebox and the Company evidenced
by a letter agreement dated July 28, 2003 and an exchange of e-mail
communications dated September 12, 2003, the "LETTER AGREEMENT"), Whitebox
agreed to accept a discounted amount as payment in full of the outstanding
principal amount of the Note if such Note is prepaid in accordance with the
provisions of the Letter Agreement on or before October 15, 2003;

         WHEREAS, in connection with the latest modification of the Letter
Agreement, the Company paid Whitebox an advance payment of $50,000 (the "ADVANCE
PAYMENT"), such Advance Payment to be applied against the outstanding principal
amount of the Note in the event the Note is prepaid on or prior to October 15,
2003;

         WHEREAS, the Letter Agreement also provides that, in the event the Note
is prepaid on or prior to October 15, 2003, then (i) Whitebox will forgive
interest accrued on the outstanding principal amount of the Note from and after
September 15, 2003, and (ii) promptly following such prepayment, the Company
will issue, in payment of all interest accrued on the outstanding principal
amount of the Note through September 15, 2003, shares of the Company's common
stock; and

         WHEREAS, the Company now desires to so prepay the Note.

         NOW, THEREFORE, in consideration of the mutual covenants contained
herein and other good and valuable consideration, the parties to this Agreement
hereby agree as follows:

         1.       Prepayment of Note.

                  1.1 Prepayment. Contemporaneously with the signing of this
Agreement, to be applied against the outstanding principal amount of the Note
and as payment in full of the Note (i) Whitebox will apply the Advance Payment
against the Note, and (ii) the Company will pay Whitebox $2,190,000 (the "PAYOFF
AMOUNT") by wire transfer of immediately available funds into such account as
Whitebox shall designate.







                  1.2 Payment in Full. Upon Whitebox's receipt of payment in
full of the Payoff Amount, the obligations of the Company under the Note or
otherwise incurred by the Company in connection with the Note (the
"OBLIGATIONS") shall be deemed to have been paid in full, and Whitebox shall be
deemed to have forgiven and waived the right to receive payment of any amount by
which the Obligations exceed the sum of the Advance Payment and the Payoff
Amount.

                  1.3 Delivery of Note. Promptly following receipt of payment in
full of the Payoff Amount (and in any event within 10 days from and after its
receipt of such payment), Whitebox shall cancel and deliver the original Note,
marked "paid in full," to the Company.

                  1.4 Issuance of Stock.

                  (a) Whitebox and the Company each acknowledge and agree that
the amount of interest accrued under the Note through September 15, 2003, equals
$166,940 (the "CONVERSION AMOUNT"). In payment of such Conversion Amount, the
Company agrees to issue to Whitebox 47,700 shares of the Company's common stock
(the "CONVERSION SHARES"), subject to and promptly following the execution and
delivery by Whitebox and the Company of a subscription agreement and such other
documentation as the Company may reasonably require (such agreement and other
documentation, in each case to be in form and substance reasonably satisfactory
to Whitebox and the Company, is herein referred to as the "SUBSCRIPTION
DOCUMENTATION"). The Subscription Documentation shall include, among other
provisions as to which Whitebox and the Company may agree, a piggyback
registration right (but not a demand registration right) with respect to the
Conversion Shares, such piggyback registration right to be effective for 24
months following the issuance of the Conversion Shares.

                  (b) Whitebox and the Company agree that they will negotiate in
good faith with a view to complete the Subscription Documentation and the
issuance of the Conversion Shares on or prior to December 1, 2003.

         2. Representations and Warranties of Whitebox. Whitebox represents and
warrants to the Company that (i) Whitebox is the owner of the Note, free and
clear of liens, encumbrances, purchase rights, claims, pledges, mortgages,
security interests or other limitations or restrictions whatsoever, other than
the provisions of the Letter Agreement, (ii) Whitebox is an entity duly
organized, validly existing and in good standing under the laws of the
jurisdiction in which it is formed, (iii) Whitebox has the requisite power and
authority to execute this Agreement and to consummate the transactions
contemplated by this Agreement, (iv) the execution and delivery of this
Agreement by Whitebox and the consummation by Whitebox of the transactions
contemplated by this Agreement have been duly authorized by all necessary action
on the part of Whitebox, and (v) this Agreement has been duly executed and
delivered by Whitebox and, assuming due execution and delivery by the Company,
constitutes a valid and binding obligation of Whitebox, enforceable against
Whitebox in accordance with its terms.



                                       2





         3. Representations and Warranties of the Company. The Company
represents and warrants to Whitebox that (i) the Company is an entity duly
organized, validly existing and in good standing under the laws of the
jurisdiction in which it is formed, (ii) the Company has the requisite power and
authority to execute this Agreement and to consummate the transactions
contemplated by this Agreement, (iii) the execution and delivery of this
Agreement by the Company and the consummation by the Company of the transactions
contemplated by this Agreement have been duly authorized by all necessary action
on the part of the Company, and (iv) this Agreement has been duly executed and
delivered by the Company and, assuming due execution and delivery by Whitebox,
constitutes a valid and binding obligation of the Company, enforceable against
the Company in accordance with its terms.

         4.       Mutual Waiver and Release.

                  4.1 Release by Whitebox. Effective upon Whitebox's receipt of
payment in full of the Payoff Amount, Whitebox waives, releases and forever
discharges the Company and its past, present and future officers, partners,
managers, members, directors, employees, agents and affiliates from any and all
claims, obligations, demands, actions, causes of action and liabilities, of
whatsoever kind and nature, character and description, whether in law or equity,
whether sounding in tort, contract, or under other applicable law, whether known
or unknown, and whether anticipated or unanticipated, of or to Whitebox, which
Whitebox and its predecessors, successors or assigns ever had, now have, or may
have; provided, however, that Whitebox does not waive, release or discharge the
Company from any of the Company's obligations under this Agreement.

                  4.2 Release by the Company. Effective upon Whitebox's receipt
of payment in full of the Payoff Amount, the Company waives, releases and
forever discharges Whitebox and its past, present and future officers, partners,
managers, members, directors, employees, agents and affiliates from any and all
claims, obligations, demands, actions, causes of action and liabilities, of
whatsoever kind and nature, character and description, whether in law or equity,
whether sounding in tort, contract, or under other applicable law, whether known
or unknown, and whether anticipated or unanticipated, of or to the Company,
which the Company and its predecessors, successors or assigns ever had, now
have, or may have; provided, however, that the Company does not waive, release
or discharge Whitebox from any of Whitebox's obligations under this Agreement.

                  4.3 Consequences of Releases. The consequences of the
foregoing waiver provisions have been explained to each party by its counsel.
Each party acknowledges that it may hereafter discover facts different from, or
in addition to, those which they no know or believe to be true with respect to
its claims, and agree that this Agreement and the releases contained herein
shall be and remain effective in all respects, notwithstanding such different or
additional facts or the discovery thereof.


                                       3




         5.       Further Assurances.  Each party agrees that each of them will
execute and deliver such further instruments and take such other action as may
reasonably be requested by either party hereto to carry out the purposes and
intents hereof.

         6.       Miscellaneous.

                  6.1 Survival of Representations, Warranties and Covenants. All
representations, warranties, covenants and agreements of the parties made herein
shall survive the execution and delivery of this Agreement and the consummation
of the transactions contemplated hereby.

                  6.2 Expenses. Each party shall bear its own expenses
(including, without limitation, attorney's fees) incurred in connection with the
negotiation and execution of this Agreement and the consummation of the
transactions contemplated hereby.

                  6.3 Entire Agreement; Amendments and Waivers. This Agreement
represents the entire understanding and agreement between the parties hereto
with respect to the subject matter hereof and can be amended, supplemented or
changed, and any provision hereof can be waived, only by a written instrument
making specific reference to this Agreement signed by the party against whom
enforcement of any such amendment, supplement, modification or waiver is sought.

                  6.4 Governing Law. This Agreement shall in all respects be
governed by and interpreted, construed, and determined in accordance with the
internal laws of the State of Minnesota (without regard to any conflict of laws
provision that would require the application of the law of any other
jurisdiction).

                  6.5 Headings. The section headings of this Agreement are for
reference purposes only and are to be given no effect in the construction and
interpretation of this Agreement.

                  6.6 Severability. If any provision of this Agreement is
invalid or unenforceable, the balance of this Agreement shall remain in effect.

                  6.7 Binding Effect; Assignment. This Agreement shall be
binding upon and inure to the benefit of the parties and their respective
successors and permitted assigns. No assignment of this Agreement or of any
rights or obligations hereunder may be made by any party (by operation of law or
otherwise) without the prior written consent of the other party hereto and any
attempted assignment without the required consent shall be void.

                  6.8 Counterparts; Facsimile Signatures. This Agreement may be
execute in any number of counterparts, each of which shall be deemed to be an
original, but all of which together will constitute one and the same instrument.
A telecopy of any such executed counterpart shall be deemed valid as an
original.


                                       4





            [The remainder of this page is intentionally left blank]



























                                       5





         IN WITNESS WHEREOF, the parties hereto have caused this Agreement to be
executed by their respective officers thereunto duly authorized, as of the date
first written above.


HEI, INC.

By:  /s/ DOUGLAS J. NESBIT
   -----------------------------------------

Its: Chief Financial Officer
    ----------------------------------------


WHITEBOX HEDGED HIGH YIELD PARTNERS

By WHITEBOX ADVISORS, LLC,
         its general partner

By:  /s/ ANDREW J. REDLEAF
   -----------------------------------------

Its: Chief Executive Officer
    ----------------------------------------


..





                                       6