PIC Sound Card

Discussion in 'Embedded Systems and Microcontrollers' started by CVMichael, Jun 20, 2008.

  1. CVMichael

    Thread Starter Senior Member

    Aug 3, 2007
    I want to make my own sound card using a PIC

    From what I know the PIC ADC is limmited in speed, let's say a PIC16F877, can it process at a sample rate of 44100 Hz ?

    If not, I will need an external ADC that will be connect to the PIC16F877, I looked on the web for ADC converters, but I have no idea what are better than others.

    For now I'm just concerned to bring the sound into the PIC, I will see about sending the sound to the computer later...

    PS, I don't mind that the ADC of the PIC is only 10 bits, I'm doing this for fun, and I don't need precision
    Last edited: Jun 20, 2008
  2. beenthere

    Retired Moderator

    Apr 20, 2004
    You can see how well the PIC will do by looking at a program loop that reads in each conversion and stores it in memory. The time it takes to execute that loop is the absolutely maximum rate you can convert sound into a file. Adding switching right/left sources will slow the process. You don't have the horsepower to do any compression, so it's a straight sound file (equivalent to a .wav).

    How many megs of memory can you put on the system? .wav files are huge.
  3. CVMichael

    Thread Starter Senior Member

    Aug 3, 2007
    I wrote a short program that reads from analog, and counts the total number of reads per second, and sends the result through the USART at baud rate 9600.

    I got ~6337 ADC reads per second.

    So how can I do this faster ?

    Better microchip ? or external ADC reader ?
  4. Hamilton


    Jun 20, 2008
    At 200ns per instruction and no more that 25 instructions per loop 200KHz is doable. Adding loop counters and accessing the USART will add to the 25 considerably. If you have a scope toggle a GPIO bit every 255 loops and measure the time between triggers. 50 instructions should easy which is 100KHz. Once again this is without any USART functions