Main Loop
The pseudo code for the main loop is:

Main:
 

Initialize and start PRS
Initialize and start clocks
Initialize Variables
Start DAC
Start Amplifiers
Start DELSIG8
Set MIC AMP input to AGND
Set Autozero flag

         
Loop:        
  If BPF period is complete
   

Save current peak value
Average eight previous peaks
Select bar graph symbol
Load new values for next BPF
If Autozero AND all offsets are measured

     

Save Offset Values
Clear Autozero Flag
Set MIC AMP to P01

   

Set peak value to zero

  If A/D reading available
    If Filter has settled
     

Subtract offset from sample value
Perform absolute value if negative
If new value is > than last peak

        Save new peak

Timer Tick
The Pseudo code for the Timer Tick which occurs 40000 times per second is:

Get lower six bits of 16-bit PRS
Write six bit value to DAC6
Decrement BPF_Counter
If BPF_Counter =0
  Load BPF_Counter with Count Value (4)
         
  Decrement BPF_Timer
         
  If BPF_Timer =0
    Load parameters for next filter
     
    If Filter 0-3
      Set Mux to 2Khz Filter
         
    Else
      Set Mux to no Filter
         
   

Increment Filter Index
Load BPF_Timer with Filter-Specific Value
Load Settling_Timer with Filter-Specific Value
Clear SAMPLE flag

         
  Else
    If SAMPLE=FALSE
     

Decrement Settling_Timer
If Settling Timer = 0
Set SAMPLE flag

         
Decrement Disp_Timer
         
If Disp_Timer = 0
 

Load Disp_Timer with Count Value (50)
Drive next column in display with bargraph pattern

Note that the Timer Tick occurs at 40Khz, the BPF event occurs at 10Khz, and the Display Event occurs at 800Hz. Since the display has eight columns, the refresh rate is 100Hz.

Paging Previous 1 2 3 4 5 Next



Back to Top