Record, storage and compare analog signals


Results 1 to 17 of 17

Threaded View

  1. #6
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,170


    Did you find this post helpful? Yes | No

    Default Re: Record, storage and compare analog signals

    Lets then suppose you have the analog input at AN0.

    Code:
    ADCON0=%00000001    ' Channel 0, ADC on
    ADCON1=%00001110    ' AN0 as analog,rest as digital
    ADCON2=%10010101    ' Right justify result and Fosc/16
    
    analog_res_array    VAR WORD[40]
    counter             VAR BYTE
    start_array         VAR BYTE     ' first element of the array to store samples
    stop_array          VAR BYTE     ' last element of the array to store samples
    
    start_array=0:stop_array=19      ' first group of 20 samples
    gosub adc_routine
    start_array=20:stop_array=39     ' second group of 20 samples
    gosub adc_routine
    
    ......
    
    adc_routine:
        for counter=start_array to stop_array
            high adcon0.1
            while adcon0.1:wend
            analog_res_array[counter]=adresh*256+adresl
        next counter
    return
    Now in the array you have 40 samples (two groups of 20) and you can compare them.

    Note that code is untested, but you get the idea.

    Ioannis
    Last edited by Ioannis; - 22nd April 2014 at 17:58.

Similar Threads

  1. how to record sound into eeprom
    By Mus.me in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 20th November 2009, 21:16
  2. How to read analog signals?
    By thm ov3rkill in forum mel PIC BASIC Pro
    Replies: 23
    Last Post: - 8th March 2009, 05:00
  3. Using a PIC to record voice
    By weirdjim in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 24th December 2007, 20:21
  4. Replies: 6
    Last Post: - 20th August 2006, 22:00
  5. The best way to record non-volatile data
    By johnson in forum General
    Replies: 3
    Last Post: - 19th July 2004, 09:03

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts