Escolar Documentos
Profissional Documentos
Cultura Documentos
Group 21
5/04/04 Final Report
Faculty/Technical Advisor: Professor Hong Man
Louise Firner Matthew DuBois Radmila Nizberg Michael Krupnick Carla Grillman
We pledge our honor that we have abided by the Stevens honor system
Table of Contents
I.
Abstract I-1 Acknowledgement Implemented Prototype II-1 Introduction II-2 Prototype Specification II-3 Prototype Performance and Evaluation II-4 Financial Budget II-5 Project Schedule Conclusion Follow-on Ideas References Appendix VI-1 Software Flowchart VI-2 MC68HC11 Assembly Code
1 2
II.
3 4-6 7 8 9 10 11 12
I. Abstract: The Variable Frequency Skin Impedance Monitor (VFSIM) will measure the impedance of an individuals skin with respect to varying frequencies. With the VFSIM, the optimum frequency for penetrating skin can be determined. The VFSIM will utilize a Motorola MC68HC11 microcontroller to monitor skin impedance for frequencies between 100Hz and 1MHz. The MC68HC11 is an 8-bit microprocessor using ANSI C and assembly code to monitor and control continuous frequency sweeps. This test is performed in incremental sweeps or at individual frequencies to determine the impedance of the skin. The output signal from the MAX038 waveform generator is controlled by sending the appropriate digital signal to the MAX505 Digital to Analog Converter. An analog signal based on the digital signal forces the MAX038 waveform generator to output a sinusoidal voltage waveform proportional in frequency to the current at the output of the MAX505. Using the oscilloscope and multi-meter, the resulting voltage, frequency and current values across the skin are observed respectfully. These results are then used to calculate the individual's skin impedance to particular frequencies.
I-1 Acknowledgement: In the early stage of our project, the group utilized the microprocessor lab provided by the CPE/EE department. However, Professor Tewksbury was able to provide us with the MC68HC11 board and all the cabling components needed. Professor Ritter, our group advisor, provided us with an oscilloscope, which allowed us to set up a small lab inside one of our dormitory rooms. MAXIM Semiconductor, a chip manufacturer, provided us with various chip samples such as waveform generator and analog to digital signal converter. Miscellaneous parts such as resistors and capacitors have been purchased from Radio Shack. Professors Arthur Ritter and Hong Man continue to serve as our project advisors.
As this diagram makes clear, the laptop was connected to the MC68HC11 through an RS232 connection. Using this connection, machine code was loaded onto the MC68HC11 and then called using the Buffalo Monitoring program. Using keyboard input in order to control the flow of the program, the output of the microprocessor to the Digital to Analog (D/A) converter was controlled. This connection was effected using the 8 pins of output port B on the MC68HC11 to control the voltage level output by the D/A converter. The change in the output values of the D/A converter was effected by using two pins of port C on the MC68HC11 to handle the control of the value acquisition logic pins on the D/A converter. The output of this D/A converter was then used control the waveform generator. The waveform output by the waveform generator was then used to apply a frequency to the skin.
Below is the schematic of the interconnection of the waveform generator (Maxim part MAX038) and the AD/DC converter (Maxim part MAX505).
The input to the D/A converter was tested by finding the voltage input to each of the eight pins through which it was connected to the MC68HC11 microprocessor. This was done using the multimeter. The interconnection between the D/A converter and the waveform generator was tested by using a multimeter to find the level of the current input to the waveform generator. This was done by connecting the multimeter in series between the resistor configuration at the output of the D/A converter and the input of the waveform generator. The output of the waveform generator was tested using an oscilloscope to ascertain the output frequency and peak-to-peak voltage.
Below is an exact pin diagram of the interconnection between the different components:
II-3 Prototype Performance and Evaluation: Several subjects were measured and Frequency vs. Impedance was graphed.
The graph shows that the impedance of skin decreased with increased frequency. The obtained plots varied as a polynomial series of order 3. For the middle range frequency values, the impedance of skin varies linearly. It is hypothesized that the higher and lower end frequency readings may have been subject to errors due to noise in the circuit. This prototype serves to prove that the concept of the variable frequency skin impedance monitor is valid. Further work will perfect the design. By printing a circuit board, the noise inherent in the breadboard will be eliminated, and by performing tests in an environment without other major electronic devices, outside interference will be eliminated.
Component Digital to Analog Converter Waveform Generator Peak Detector Analog to Digital Converter MC68HC11 Oscilloscope Multi-meter Resistors/capacitors, etc. Patches EKG Cables Total
Price Free sample from MAXIM ($0) Free sample from MAXIM ($0) Free sample from MAXIM ($0) Free sample from MAXIM ($0) Obtained through Stevens ($0) Obtained through Stevens $ 78.74 $ 18.59 Obtained through Stevens Obtained through Stevens $ 97.33
Our expected expanses did not change drastically. The only component that was purchased that was not considered in early estimate was the multi-meter, which was required for both testing purposes and later as part of the circuit since the peak detectors, which the team obtained initially, were not of the correct type.
III. Conclusion:
Overall, the final design was not very different from the original. However, some adjustments had to be made because the initial type of peak detectors which the team got were incompatible with the rest of the circuit. Unfortunately, despite promises from the supplier, the correct peak detectors didn't arrive in time for the team to integrate them into the circuit. Therefore, the final design was implemented without them.
In the final design, a laptop interfaced with the MC68HC11, which controlled a DAC.
The output of the D/A converter then controlled the waveform generator, and the output waveform was applied to the skin, just as originally planned. However, because of the absence of the peak detectors, it was necessary to find some other way to determine the frequency and voltage level of the signal. This is why the oscilloscope and multimeter were integrated into the design. These devices were used to determine the frequency, voltage, and amperage of the waveform after it had passed across the skin. Using the voltage and the amperage, it was then easy to calculate the resistance across the skin (R = V / I). Given the resistance and the frequency, it was then possible to plot a graph of resistance versus frequency and find the frequency with lowest resistance.
Using assembly code the team loaded into the MC68HC11, it was possible to automatically run an incremental sweep of all possible output frequency ranges. It was also possible to use the software to test individual values. By doing this, it was possible to find the resistance of skin to various frequencies and determine the optimum frequency, which was exactly the desired functionality. Had the correct peak detectors been available, this project could have been improved and developed as autonomous circuit, where the MC68HC11 handled the calculation of frequency and resistance. V. Follow-on Ideas Obviously, the lack of the correct type of peak detectors was a major setback for the team. If there had been more time or if the peak detectors had arrived earlier, then the
10
team could have integrated the peak detectors into the circuit, and from their output, the MC68HC11 could have made frequency and voltage calculations. Using a measurement of the current along with the measurement for the voltage, the MC68HC11 could have found the resistance value for each particular frequency and then directly output the data. In the case of a frequency sweep, the microcontroller could have determined which frequency the skin had the least resistance to and output that value for the user as well. Although the supplier for the peak detectors was not very helpful, there was another company which did a wonderful job of sending out free samples of their hardware both quickly and reliably. This supplier is Maxim: Analog & Mixed Signal ICs, whose website can be found at http://www.maxim-ic.com. In addition, they have up-to-date, detailed specifications and information about all of their products available online, which helped a great deal during the design process. They would be a good source of components for future design projects. The local Radio Shack in Hoboken (218 Washington Street, phone number (201) 459-0490, website http://www.RadioShack.com) also proved useful as a quick, local source for basic circuit elements, such as resistors and capacitors. When the team needed a diagnostic tool, it was discovered that it was possible to buy a multi-meter with sufficient functionality at Radio Shack. In conjunction with Maxim, they were an excellent source for the needs of the Senior Design project.
11
12
Exit
Choose Single Frequency, Frequency Sweep, or Exit the program. Frequency Sweep
Single
Display Frequency
Yes
End
A-1
ORG LDAA STAA LDX JSR LDAA JSR LDAA JSR ModeSelect LDX JSR LDAA JSR LDX JSR LDAA JSR LDX JSR LDAA JSR LDX JSR LDAA JSR BRA JSR JSR TSTA BEQ CMPA BEQ CMPA BEQ CMPA BEQ
;start of program
#ModeMes ;let people choose mode OUTSTR #ENTER OUTPUT #SingleMes OUTSTR #ENTER OUTPUT #ContMes OUTSTR #ENTER OUTPUT #QuitMes OUTSTR #ENTER OUTPUT START INPUT OUTPUT START #$01 Donea #$31 SINGLE #$32 CONTa ;find out which mode to branch to
START
A-2
CMPA BEQ BRA INVALID selection LDX JSR LDAA JSR LDAA JSR BRA SINGLE LDAA JSR LDAA JSR LDX JSR LDAA JSR BRA JSR JSR TSTA BEQ CMPA pressed BEQ CMPA BHI CMPA BHI CMPA BHI CMPA BHI CMPA BHI CMPA BLO SUBA STAA BRA Donea CONTa SINGLEb HighSmHex BRA BRA BRA SUBA STAA BRA SUBA STAA
#$33 Donea INVALID #InvMes OUTSTR #ENTER OUTPUT #ENTER OUTPUT ModeSelect #ENTER OUTPUT #ENTER OUTPUT #ChooseFMes OUTSTR #ENTER OUTPUT GetHighF INPUT OUTPUT GetHighF #$01 Donea #$66 NOTVALID #$60 HighSmHex #$46 NOTVALID #$40 HighBgHex #$39 NOTVALID #$30 NOTVALID #$30 FREQH GetLowF Doneb CONTb SINGLE #$57 FREQH GetLowF #$37 FREQH ;adjusts a-f to 10-15 decimal ;single frequency input mode ;error message for invalid mode
GetHighF digit
HighBgHex
A-3
BRA NOTVALID input LDAA JSR LDAA JSR LDX JSR BRA GetLowF JSR JSR TSTA BEQ CMPA BEQ CMPA BHI CMPA BHI CMPA BHI CMPA BHI CMPA BHI CMPA BLO SUBA STAA BRA BRA BRA SUBA STAA BRA SUBA STAA BRA BRA
GetLowF #ENTER OUTPUT #ENTER OUTPUT #InvMes OUTSTR SINGLE INPUT OUTPUT GetLowF #$01 Doneb #$66 NOTVALID #$60 LowSmHex #$46 NOTVALID #$40 LowBgHex #$39 NOTVALID #$30 NOTVALID #$30 FREQL GotSF Donec CONTc #$57 FREQL GotSF #$37 FREQL GotSF SINGLEb ;adjusts a-f to 10-15 decimal ;handles low order (2nd) hex digit ;gives error message for invalid
LowBgHex
SINGLEa GotSF
LDAA FREQH LSLA 4bit places larger than the low LSLA LSLA LSLA LDAB FREQL ABA STAA FREQ LDAA #$0C STAA PORTC
A-4
LDAA STAA LDAA STAA LDAA STAA LDAA STAA LDAA JSR LDAA JSR LDAA JSR LDX JSR BRA SFreqAg LDAA JSR LDAA JSR LDX JSR BRA BRA BRA JSR JSR TSTA BEQ CMPA BEQ CMPA BEQ CMPA BEQ CMPA BEQ CMPA BEQ LDAA JSR LDAA JSR LDX JSR BRA LDAA JSR LDAA JSR LDX JSR
#$08 PORTC FREQ PORTB #$0C PORTC #$04 PORTC #ENTER OUTPUT #ENTER OUTPUT FREQ OUTPUT #FreqEntMes OUTSTR SFreqAg #ENTER OUTPUT #ENTER OUTPUT #SFreqAgMes OUTSTR SAgain Doned CONT INPUT OUTPUT SAgain #$01 Doned #LITTLEY SINGLEa #BIGY SINGLEa #LITTLEN Doned #BIGN Doned #ENTER OUTPUT #ENTER OUTPUT #InvMes OUTSTR SFreqAg #ENTER OUTPUT #ENTER OUTPUT #ChooseFMes OUTSTR
CONT
A-5
#GetLowFMes OUTSTR #ENTER OUTPUT GetLowBound Doned2 INPUT OUTPUT GetLowBound #$01 Doned #$66 NOVALID #$60 LHSmHex #$46 NOVALID #$40 LHBgHex #$39 NOVALID #$30 NOVALID #$30 FREQH GetLowHex #ENTER OUTPUT #ENTER OUTPUT #InvMes OUTSTR CONT #$57 FREQH GetLowHex #$37 FREQH GetLowHex Donee INPUT OUTPUT GetLowHex #$01 Donee #$66 NOVALID #$60 ;handles low order (2nd) hex digit ;handles high order (1st)hex digit
GetLowBound JSR JSR TSTA BEQ CMPA BEQ CMPA BHI CMPA BHI CMPA BHI CMPA BHI CMPA BHI CMPA BLO SUBA STAA BRA NOVALID LDAA JSR LDAA JSR LDX JSR BRA SUBA STAA BRA SUBA STAA BRA BRA JSR JSR TSTA BEQ CMPA BEQ CMPA BHI CMPA
LHSmHex
LHBgHex
Doned2 GetLowHex
A-6
BHI CMPA BHI CMPA BHI CMPA BHI CMPA BLO SUBA STAA BRA LLSmHex SUBA STAA BRA SUBA STAA BRA LDAA LSLA LSLA LSLA LSLA LDAB ABA STAA LDAA JSR LDAA JSR LDAA JSR LDX JSR BRA BRA LDAA JSR LDAA JSR LDX JSR LDAA JSR LDX JSR LDAA JSR BRA JSR JSR
LLSmHex #$46 NOVALID #$40 LLBgHex #$39 NOVALID #$30 NOVALID #$30 FREQL GotLCF #$57 FREQL GotLCF #$37 FREQL GotLCF FREQH
LLBgHex
GotLCF
FREQL FREQL #ENTER OUTPUT #ENTER OUTPUT FREQL OUTPUT #LFEntMes OUTSTR GetUpBound Donef #ENTER ;continuous frequency sweep mode OUTPUT #ENTER OUTPUT #ChooseFMes OUTSTR #ENTER OUTPUT #GetHighFMes OUTSTR #ENTER OUTPUT GetHHex INPUT OUTPUT ;handles high order (1st)hex digit ;adds low sig to high sig freq ;store result in FREQL
Donee GetUpBound
GetHHex
A-7
TSTA BEQ CMPA BEQ CMPA BHI CMPA BHI CMPA BHI CMPA BHI CMPA BHI CMPA BLO SUBA STAA BRA NVALID LDAA JSR LDAA JSR LDX JSR BRA BRA SUBA STAA BRA SUBA STAA BRA JSR JSR TSTA BEQ CMPA BEQ CMPA BHI CMPA BHI CMPA BHI CMPA BHI CMPA BHI CMPA BLO
GetHHex #$01 Donee #$66 NVALID #$60 HHSmHex #$46 NVALID #$40 HHBgHex #$39 NVALID #$30 NVALID #$30 FREQH GetHLHex #ENTER OUTPUT #ENTER OUTPUT #InvMes OUTSTR GetUpBound Doneg #$57 FREQH GetHLHex #$37 FREQH GetHLHex INPUT OUTPUT GetHLHex #$01 Donef #$66 NVALID #$60 HLSmHex #$46 NVALID #$40 HLBgHex #$39 NVALID #$30 NVALID
Donef HHSmHex
HHBgHex
GetHLHex
pressed
A-8
SUBA STAA BRA HLSmHex SUBA STAA BRA SUBA STAA BRA BRA BRA LDAA LSLA LSLA LSLA LSLA LDAB ABA STAA LDAA JSR LDAA JSR LDAA JSR LDX JSR LDAA CMPA BLO BRA LDAA JSR LDAA JSR LDX JSR BRA BRA LDAA JSR LDAA JSR LDX JSR LDAA JSR LDX JSR LDAA
#$30 FREQ GotHCF #$57 FREQ GotHCF #$37 FREQ GotHCF Doneh NVALID FREQH
HLBgHex
;got high continuous frequency ;makes high 4bit larger than low
FREQ FREQH #ENTER OUTPUT #ENTER OUTPUT FREQH OUTPUT #HFEntMes OUTSTR FREQH FREQL LGreatH AskInc #ENTER OUTPUT #ENTER OUTPUT #LGHMes OUTSTR NVALIDa Donei #ENTER OUTPUT #ENTER OUTPUT #IncMes OUTSTR #ENTER OUTPUT #Inc1Mes OUTSTR #ENTER
;load low signifigance freq value ;adds low sig to high sig freq ;store result in FREQH
LGreatH
Doneh AskInc
A-9
JSR LDX JSR LDAA JSR LDX JSR LDAA JSR LDX JSR LDAA JSR BRA Donei GetInc BRA JSR JSR TSTA BEQ CMPA BEQ CMPA BEQ CMPA BEQ CMPA BEQ CMPA BEQ BRA LDX JSR LDAA JSR LDAA JSR BRA LDAA STAA BRA LDAA STAA BRA LDAA STAA BRA LDAA STAA BRA
OUTPUT #Inc2Mes OUTSTR #ENTER OUTPUT #Inc3Mes OUTSTR #ENTER OUTPUT #Inc4Mes OUTSTR #ENTER OUTPUT GetInc Donej INPUT OUTPUT GetInc #$01 Donei #$31 Inc1l #$32 Inc2l #$33 Inc3l #$34 Inc4l INVAL #InvMes OUTSTR #ENTER OUTPUT #ENTER OUTPUT AskInc #1 INCF GotInc #5 INCF GotInc #25 INCF GotInc #50 INCF GotInc ;error message for invalid entry ;find out which increment to use
INVAL
Inc1l
Inc2l
Inc3l
Inc4l
A-10
Donej GotInc
BRA LDAA JSR LDAA JSR LDAA JSR LDX JSR BRA LDAA JSR LDAA JSR LDX JSR LDAA JSR LDX JSR LDAA JSR LDX JSR LDAA JSR LDX JSR LDAA JSR LDX JSR LDAA JSR LDX JSR LDAA JSR BRA BRA BRA JSR JSR TSTA BEQ CMPA BEQ CMPA BEQ CMPA BEQ CMPA BEQ
Donek #ENTER OUTPUT #ENTER OUTPUT #INCF OUTPUT #IncSelMes OUTSTR AskDel #ENTER OUTPUT #ENTER OUTPUT #DelMes OUTSTR #ENTER OUTPUT #Del1Mes OUTSTR #ENTER OUTPUT #Del2Mes OUTSTR #ENTER OUTPUT #Del3Mes OUTSTR #ENTER OUTPUT #Del4Mes OUTSTR #ENTER OUTPUT #Del5Mes OUTSTR #ENTER OUTPUT GetDel Donel AskDel INPUT OUTPUT GetDel #$01 Donel #$31 Del1l #$32 Del2l #$33 Del3l ;find out which delay to use
AskDel
A-11
CMPA BEQ CMPA BEQ BRA INVALD LDX JSR LDAA JSR LDAA JSR BRA LDAA STAA LDX JSR BRA SUBA STAA LDX JSR BRA SUBA STAA LDX JSR BRA BRA SUBA STAA LDX JSR BRA SUBA STAA LDX JSR BRA LDAA JSR LDAA JSR LDX JSR LDAA JSR LDAA STAA BRA
#$34 Del4l #$35 Del5l INVALD #InvMes OUTSTR #ENTER OUTPUT #ENTER OUTPUT AskDela #2 DELF #Del1SMes OUTSTR STARTC #11 DELF #Del2SMes OUTSTR STARTC #51 DELF #Del3SMes OUTSTR STARTC Donem #101 DELF #Del4SMes OUTSTR STARTC #251 DELF #Del5SMes OUTSTR STARTC #ENTER OUTPUT #ENTER OUTPUT #FSweepMes OUTSTR #ENTER OUTPUT FREQL FREQ FSweep ;tell user freq sweep is starting ;error message for invalid input
Del1l
Del2l
Del3l
Donel Del4l
Del5l
STARTC
A-12
FSweep
LDAA STAA LDAA STAA LDAA STAA LDAA STAA LDAA STAA LDAA CLRB LDX IDIV STX LDAA MUL TBA LDX IDIV STX LDAA MUL TBA LDX IDIV STX LDAA MUL TBA LDX IDIV STX BRA BRA BRA LDAA JSR LDAA ADDA JSR LDAA JSR LDAA ADDA JSR LDAA ADDA JSR LDAA ADDA JSR LDX JSR
#$0C PORTC #$08 PORTC FREQ PORTB #$0C PORTC #$04 PORTC FREQ #51 Digit1a #10
#51 Digit4a ShowVout Donen FSweep ENTER OUTPUT Digit1a #$30 OUTPUT #PERIOD OUTPUT Digit2a #$30 OUTPUT Digit3a #$30 OUTPUT Digit4a #$30 OUTPUT #VoutMes OUTSTR
A-13
LDAA JSR LDAA CMPA BEQ BRA FSweepa Donen DelayLoop OUT BRA BRA LDAB DECB BEQ JSR CMPA BEQ LDX INX CPX BNE BRA LDAA SUBA CMPA BLS LDAA LDAB ABA STAA BRA LDAA STAA BRA LDAA JSR LDAA LDX JSR RTS END FCC FCB FCC FCB FCC FCB FCC FCB FCC FCB FCC
#ENTER OUTPUT FREQ FREQH DoneCon DelayLoop FSweepb DoneCon DELF IncV INPUT #$01 DoneCon #0 INNER #10000 IN OUT FREQH INCF FREQ SetHF FREQ INCF FREQ FSweepa FREQH FREQ FSweepa #ENTER OUTPUT #ENTER #DoneMes OUTSTR
IN
IncV
SetHF
DoneCon
WelMes ModeMes
ChooseFMes
"Welcome to the VFSIM Program!" #$04 "Choose the operational mode: 1 or 2 (or 3 to quit):" #$04 "1 : Single Frequency Test" #$04 "2 : Continuous Frequency Sweep" #$04 "3 : Exit the VFSIM Program (You can always exit with ctrl + a)" #$04 "Please enter input to waveform generator in 2
A-14
FCB GetHighFMes FCC FCB FCC FCB FCC FCB FCC FCB FCC FCB FCC FCB FCC FCB FCC FCB FCC FCB FCC FCB FCC FCB FCC FCB FCC FCB FCC FCB FCC FCB FCC
LFEntMes
HFEntMes
LGHMes
IncMes
Inc1Mes
Inc2Mes
Inc3Mes
Inc4Mes
IncSelMes DelMes
Del1Mes
Del2Mes
Del3Mes
Del4Mes
Del5Mes
hex digits: 00-FF. " #$04 "Invalid input. Please make a valid entry." #$04 " has been output to the waveform generator." #$04 "Do you want to enter another frequency?(y/n)" #$04 "What output value do you which to start with (00-FF)? " #$04 "What output value do you which to end with (00-FF)? " #$04 " will be used as the lowest output value to the waveform generator." #$04 " will be used as the highest output value to the waveform generator." #$04 "Error. High end of frequency range is less than low end." #$04 "Please choose the increment by which the output should be increased (1-4)." #$04 "1. Increase the voltage by approx 0.02 V (1 LSB every time)." #$04 "2. Increase the voltage by approx 0.1 V (5 every time)." #$04 "3. Increase the voltage by approx 0.5 V (25 every time)." #$04 "4. Increase the voltage by approx 1 V (50 every time)." #$04 " was the increment selected." #$04 "Please choose the delay between the incrementing of the output (1-5)." #$04 "1. Delay of 0.1 seconds (25.5 seconds for 00FF sweep with inc 1)." #$04 "2. Delay of 1 second (4.25 min for 00-FF sweep with inc 1)." #$04 "3. Delay of 5 seconds (21.25 min for 00-FF sweep with inc 1)." #$04 "4. Delay of 10 seconds (42.5 min for 00-FF sweep with inc 1)." #$04 "5. Delay of 25 seconds (1 hour 45 min for 00FF sweep with inc 1)."
A-15
FCB FCC FCB FCC FCB FCC FCB FCC FCB FCC FCB FCC FCB FCC FCB FCC FCB FCC FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB FCB
VoutMes DoneMes
#$04 "Delay of 0.1 seconds" #$04 "Delay of 1 second" #$04 "Delay of 5 seconds" #$04 "Delay of 10 seconds" #$04 "Delay of 25 seconds" #$04 " was the delay selected." #$04 "Frequency Sweep will now commence. Outputting:" #$04 " V is being output now." #$04 "Thank you for using the VFSIM Program!" #$04 #$00 #$00 #$00 #$01 #10 #$01 #$00 #$00 #$00 #$00
FREQH FREQL FREQ INCF DELF MODE Digit1a Digit2a Digit3a Digit4a
A-16