12f657 programming question


Closed Thread
Results 1 to 4 of 4
  1. #1
    puggy's Avatar
    puggy Guest

    Default 12f657 programming question

    i am currently trying to use the 12f675 pic in a metal detector that im building for a senior design class. i want the pic to output a constant 10 khz signal that never stops. also i want it to handle the data aquistion. to be more specific it needs to perform an a/d conversion and then analyize that signal to determine if metal has been detected and if so how strong is the signal so we might be able to figure out what we found. lastly i need to be able to output a signal that can change frequency depending on the data analysis (the different frequencies will be used to make different sounds so we know the strength of the signal so for instance the higher freq means the better the signal)

    so far i have got the 10 khz signal to output by flashing a pin. that was no problem. but this is running in a continuous loop that cant be stopped so that the metal detector will continue to operate. so while this 10 khz signal is being produced i have to do all my data analysis which i think i can do at the same time by using those instructions as part of the delay used in creating the 10 khz signal. however if i can do this how do i output the other signal that will be used to produce a sound. i dont think i can have to different loops running continuously creating different freqencies. i think it would be easier if there was a way to use the clkout in gpio4 and just have that output a square wave and just set up conditions to determine what freq it should output but i dont know how to get the clkout to work or if i can even do that with this chip

    do i need to use more than one pic for this

    do i need to possible get a different pic that would be better suitable for this problem and if so which one

    or does anyone have any suggestions or tips on how i can solve this problem using the one pic i have.

  2. #2
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    CLKOUT from any PIC will give you the Oscillator Frequency. If you're running on internal oscillator, that's probably going to be 4MHz. Not too handy I guess for you, BUT, if you put it through a divider (eg 4020) you can get either 15.6kHz (divide by 8) or 7.8kHz (divide by nine). That saves you the bother of having to generate a constant frequency. To work out how to set the configuration fuses for CLKOUT on any PIC, read the FAQ...

    http://www.picbasic.co.uk/forum/show...=&threadid=543

    Because you need to do other things besides generating a tone, you have two additional alternatives over and above what I suggested above...

    1. Chose a PIC with Hardware PWM as well as ADC's... 16F872, 16F876 etc immediately spring to mind, but there are heaps of others... the PWM can then be your constant frequency output.

    2. Have your 10kHz generated by background interrupts... tricky (but quite achieveable) with PICBasic, especially if you also need to devote significant foreground time to other tasks.

    It all depends on your skill level and how you want to proceed. You can do it all in a 12F675... actually, it's such a simple application, you probably could do it in a PIC10F series... but if you're a bit shaky with attempting some creative programing, then go for option 1.

  3. #3
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Hi puggy,
    My suggestion for developpement is of course a flash device such the 16F87x serie but for the end project PIC16c712.

    PIC16C712 have 1 PWM (for your 10KHZ tone ), 4 channel ADC and 1k of program memory (wich it's really enough for your needs).

    O.k these are not really the most cost price efficient but they have what you want to do your project fast.

    regards.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  4. #4
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Hi again,
    after a visit to microchip web site i discover PIC12F683 wich have 1 PWM + 4 ADC. It's also supported by PicBasic Pro V 2.45. So i think that's the most suitable for your application.

    have a look to this
    http://www.microchip.com/stellent/id...cName=en010115

    They are available for cheap on Newark web site.

    regards
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. Data Programming Error at 0000
    By cpatnoi in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 22nd May 2009, 03:37
  2. noobie to PICs and PBPro... Programming question.
    By mcphill in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 25th October 2007, 18:35
  3. 12F675, MPLAB programming question
    By EASY in forum General
    Replies: 0
    Last Post: - 2nd April 2006, 19:28
  4. Normal programming question
    By stevenlkz in forum General
    Replies: 4
    Last Post: - 13th June 2005, 14:59
  5. 12f675 programming question
    By puggy in forum General
    Replies: 3
    Last Post: - 30th November 2004, 23:34

Members who have read this thread : 1

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