|
现要求通过定时器定一段时间比如2ms,就调用F_GetFFTSample()(该函数用来读取A/D值,如读128个值(采样点));
在采样点128情况下,当A/D完成第128个采样时记下时间作为开始时间,同样记下第128个输出时间作为结束时间,不知道怎样去标记开始/结束时间,该过程应该怎样实现?
- .include GPCE.inc
- .text
- .public _SystemInitial
- _SystemInitial: .proc
- int off
- fiq off
-
- r1 = C_Fcpu_49M //C_49MHz // 49MHz, Fcpu=Fosc
- [P_SystemClock] = r1
- r1 = 0x0030 // TimerA CKA=Fosc/2 CKB=1 Tout:off
- [P_TimerA_Ctrl] = r1 // Initial Timer A
- r1 = C_Timer_Setting_16K // 8K[color=#FF0000]这应该是设置采样频率[/color]
- [P_TimerA_Data] = r1
- r1 = 0xffff
- [P_INT_Clear] = r1 // Clear interrupt occuiped events
-
- r1 = [P_INT_Ctrl]
- r1 |= C_FIQ_TMA // Enable Timer A FIQ
- [P_INT_Ctrl] = r1
-
- fiq on //
-
- r1 = [P_ADC_Ctrl] // enable AGC,MIC,AD
- r1 |= 0x0005
- [P_ADC_Ctrl] = r1
- r1 = [P_DAC_Ctrl]
- r1 |= 0x0008
- [P_DAC_Ctrl] = r1
- r1 = 0
- [P_IOA_Data] = r1
- r1 = 0xffff
- [P_IOA_Dir] = r1
- [P_IOA_Attrib] = r1
-
- retf
- .endp
- //---------------------------------------------------------------------------
- // Get FFT Sample process
- // User have to implement this according to get data from mic or line in
- // return r1 = FFT sample
- //
- .public F_GetFFTSample
- F_GetFFTSample: .proc
- L_WaitADCRdy:
- r1 = [P_ADC_Ctrl]
- r1 |= 0x8000//[color=#FF0000]设置采样点个数吗?但具体的buffer怎样读入呢?[/color]
- jz L_WaitADCRdy
-
- r1 = [P_ADC]
- retf
- .endp
复制代码 |
|