Rough 'n Ready Audio Frequency extraction with a PIC


Results 1 to 34 of 34

Threaded View

  1. #15
    Join Date
    Mar 2009
    Posts
    653


    Did you find this post helpful? Yes | No

    Default

    Thanks Darrel....I'll check it out later.

    So here's the ludicrously simple 'get me up & running' setup I have (lifted/edited fromthe Microchip Tips' n trick sheet)



    I put a sawtooth from a sig gen on the comparator input, but get nowt on the output

    Now like I say, I always struggle with the registers - and even then, it's been a while - so try not to laugh...

    Code:
    @MyConfig = _INTRC_OSC_NOCLKOUT & _WDT_OFF & _PWRTE_ON  
    @MyConfig = MyConfig & _MCLRE_OFF 
    
    DEFINE OSC 4           ' Internal 4MHz
    
    CMCON0 = %00000001   	'CIN pins are configured as analog, COUT pin configured as Comparator output?
    ADCON0 = %00000000	'ADC disabled?
    ANSEL = %00001111	'All Analogue inputs enabled?
    TRISIO = %111011	'GPIO2 output (Comparator Out)
    
    ' PIN# NAME     USE & CONNECTION
    '  1   Vdd      +5VDC power supply
    '  2   GPIO.5   Debug Port (PicKit2 needs switching from here to pin Pin 7 to allow programming)
    '  3   GPIO.4   
    '  4   GPIO.3   
    '  5   GPIO.2   Comparator Out (GP2)
    '  6   GPIO.1   CIN-  Signal In  (GP1)
    '  7   GPIO.0   CIN+  trigger level (GP0)
    '  8   Vss      Power supply ground
    '-------------------------------------------------------------------------



    EDIT Ok, spotted it..

    Code:
    ANSEL = %00001011		'All Analogue inputs except AN2 enabled
    & here we have an output...



    Now...what to do with the output?!!!
    Last edited by HankMcSpank; - 8th March 2010 at 00:05.

Similar Threads

  1. Measuring change of frequency with PIC
    By Aussie in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 19th July 2007, 01:47
  2. PIC Audio
    By toofastdave in forum mel PIC BASIC Pro
    Replies: 28
    Last Post: - 27th June 2007, 13:49
  3. Pic driven digital audio delay
    By skimask in forum Off Topic
    Replies: 12
    Last Post: - 19th April 2007, 20:42
  4. Audio Encoding and playback in a PIC
    By Rob in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 24th March 2005, 08:56
  5. Frequency Counter using PIC and PicBasic
    By PICtron in forum mel PIC BASIC Pro
    Replies: 31
    Last Post: - 28th January 2005, 06:20

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