|
|
Automatic
Audiometer base on Microcontroller AT89S51
Automatic Audiometer is a microcontroller application
in medical for investigating hearing thresholds in a 0 Hz to 22,000
Hz frequency range and -20 dB to 100 dB SPL range. It runs on very simple
hardware, including headphone, push button and does not require any
external or internal proprietary devices. It is very precise, easy to
use and, due to the stability of digital circuitry, needs to be calibrated
only once.
Automatic Audiometer will increase
frequency and SPL after patient do not hear anything from headphone.
If patient hear a sound from head phone, then patien must push the button
to indicate that He hears a sound from headphone, and microcontroller
will automatically increase frequency this will happen till 8k Hz, then
SPL wil increase decibel.. ( Download File asm : audio.zip
, Download complete circuit : audiometer.pdf)

;======================================================= ; Automatic AUDIOMETER ; by : Triwiyanto ;; Prosedur operasi ;=============================================================== ;R0 = to save transfer data Frequency ;R1 = to save transfer data Decibel ;R2 = to save data Counter Down in Convert Data DB dan Frequency subroutine MUX equ P0 ; DAC_Prnt equ P2 ; ttombol bit P3.2 ; INT0 = interupsi dari tombol pasien DataFreq equ 30h; RAM location for Data Frequency DataDb equ 31h; Ram location for DataDB Count200 equ 32h;RAM location for counter 200 CounterDFreq equ 36h;RAM location for Counter Frequency CounterDDB equ 37h;RAM location for counter DB ;40h s/d 4fh data array for frequency ;50h s/d 5fh data array for decibel ; org 00h sjmp Start ; org 03h ; interrupt external 0 address ljmp Xternal_Interupsi_0; jump to subroutineinterrupt external 0 address INT0 reti ; org 0bh ; timer interrupt 0 address ljmp Timer_Interupsi_0 ; jump to timer interrupt 0 TF0 ; org 13h; no interrupt reti ; org 23h;no interrupt reti ; Start: call Init_Interupsi_Xternal_Timer; call timer external interrupt Setb TR0 ; timer 0 run ; mov DataFreq,#0 ;initiate data datafreq=0 mov CounterDFreq,#40h ;RAM location for DFreq -> address 40h mov CounterDDB,#50h ;RAM location for DDB-> address 50h ; Clr A mov DPTR,#DataDecibel ;save address DataDecibel in DPTR Movc A,@A+DPTR ;look up table and take to A Mov DataDB,A ;saving data A to DataDB ; ;As you see in this subroutine. program will stack to this subroutine ; and jumps out to the others subroutine if there is an interruption Forever: mov MUX,DataFreq ; Choosing address in Multiplexer 4051 mov DAC_Prnt,DataDb ; Outputing data to DAC sjmp Forever ; Program will hang to this routine ; Xternal_Interupsi_0: jnb P3.2,$ call Simpan_DataDBdanDataFreq Mov Count200,#20 ;After interruption Xternal happen, Counter Down Timer will be Reset call Inc_Freq ;call subroutine increment Frequency reti ; Inc_DB_Fr_Xternal: Clr A inc DPTR ;Increment ROM Address Data Decibel movc A,@A+DPTR ;look up table data ROM and save to A cjne A,#'S',SendDb;Compare A and 'S' character if not equal will jump to SendDb call inc_Freq ;if A = 'S' then call subroutine inC_Freq SendDb: mov DataDB,A ;save data A in DataDB ret ; Inc_Freq: inc DataFreq ;Increment dataFreq this increment will happen if DataDb in maximum limit mov A,DataFreq ;save dataFreq to A cjne A,#7,GO_Inc;Compare A and #7,ifnotequalthen jump to Go_inc Clr TR0 ;Shutdown Timer 0 Clr EA ;Shutdown all Interrupt quit: sjmp quit ; GO_Inc: clr A ; mov DPTR,#DataDecibel ;look up tabel Datadecibel from ROM movc A,@A+DPTR mov DataDB,A ret ; Timer_Interupsi_0: ;This interruption will happen every 0.05s and must be reload mov tl0,#0afh ; by loading data 3CAFh to TL0 and TH0 will create an interruption mov th0,#03ch ;to TF0 every 0.05 second. djnz Count200,EndIntr ;Counter down = 200 x 0.05s = 10 detik mov Count200,#20 ;If there is no interruption external then DataDB ;or DataFreq will increment every 10 second call Inc_DB_Fr_Xternal ; EndIntr: reti ; Init_interupsi_XTernal_Timer: mov R0,#40h mov R1,#50h mov Count200,#200 ; initiate for interruption every 10 second mov tl0,#0afh mov th0,#03ch mov TMOD,#00000001b ; mode 1 timer 0 16 bit setb ET0 ; Enable timer 0 interrupt ; Setb IT0 ;Activate negative transition interrupt external 0 Setb EX0 ;Activate external interrupt 0 Setb EA ;Master Enable All Interrupt Setb PX0 ;First Interrupt for External Interruption ret ; Simpan_DataDBdanDataFreq: mov R0,CounterDFreq mov R1,CounterDDB mov @R0,DataFreq ;saving dataFreq to RAM mov @R1,DataDb ;saving dataDb to RAM inc CounterDFreq ;increment Address RAM for Frequency inc CounterDDB ;increment Address RAM for Frequency ret ; DataDecibel: DB 10,20,30,40,50,60,70,80,90,100,110,'S' end
BACK
|
|
Lesson 1:
T
o o l
1.1. Programmer
1.2. Edsim
51
1.3. MIDE-51
1.4. ATMEL
ISP
Lesson 2:
Input Output
2.1.LED
2.2.Swicht
2.3.7
Segmen
2.4.LCD
Character
2.5.ADC
2.6.DAC
2.7.Motor
Stepper
2.8.Keypad
Lesson 3:
Timer Counter
3.1.Basic
3.2.Mode
0
3.3.Mode
1
3.4.Mode
2
3.5.Mode
3
Lesson 4:
Serial Comm.
4.1.Basic
4.2.LED
4.3.Rotate
LED
4.2 ADC
4.3.LCD
Lesson 5:
Interuption
5.1.Basic
5.2.Timer
5.2.External
|