Connect with us

advise on doing voice transmission using pic 16f876, URGENT....!!!!

Discussion in 'Hobby Electronics' started by Yoong Ping, Lim, Sep 12, 2004.

Scroll to continue with content
  1. Hi there,

    I am doing a project on 16f876s addressing the above mentioned. The
    objective is to use one 16f876 to adc the voice from a mic and then transmit
    in to the other end 's pic using rs232.

    I am struck at obtaining intelligentable voice and has the below
    observations that has made been worrying me if I am placing on the wrong

    I am currently using a relatively high level c compiler , wiz c,
    professional edition. It is very high level in the sense in which lots of
    libraries are already given.
    the compiler is a one man show, which i am starting to doubt its capability.
    I am using a 20Mhz clock.

    1. when i tried a


    void on_timer_overflow(){
    reset the timer to a value;

    i see the time taken for a period of short blast of 1 and then 0 is about
    56us. is it too short? Which relates to about 17khZ. which is very slow

    2. assuming that i have very reliable transmission rate of 19200bps. and
    rs232 has 1 start and 1 stop, each frame is 10 bits.
    each frame is 520us.

    3. nyqust states 2*bw. voice of 4k thus sampling of 8k is required. (bare
    each require sample time is 125us.



    i can see a contradiction between pt 2 and 3. with 8 bits and that i use a
    typical voice coding dpm, i at least 2 bits for each sample. (is it
    enough)???? i can only pack 4 sample in each 520us instead of 5. not to
    mention that it is the bare min sampling. and if i do companding i dun even
    know if it helps..

    please advise. or get me a new direction? i tried to find some codec chips
    but as i am in melb. i can only find the etc5057. oki semiconductor.
    it is very complex and it has get me thinking if i should change my


    IN addition, as i mentioned that due to 1. the loop time is 56us. we need 1
    sample per 125us. how can we find time to do transmission using rs232 -
    requiers 520us.

    i realise that i can either go into assembly or change a compiler( i am
    running out of time , i presume)
    or use a codec chip? i cant find one that is easy to use.

    i can too use real time programming BUT due to the inherent slow speed, i
    dun think i can. (leading slow context switching)

    I presumed that the best way out is to use a codec chip which is able do
    data transmission.
  2. Phil Allison

    Phil Allison Guest

    "Yoong Ping, Lim"

    ** Try entering " infinitely clipped speech " into Google.

    Pre processing the audio this way will reduce the data rate drastically.

    Here is an example of how to do it.

    ............ Phil
  3. another question.

    if i am using the 16f876 which only has one 1 rs232 hardware port.

    but i need two uart port, can you pls guide me on how to create another?

    thanks .
  4. Don McKenzie

    Don McKenzie Guest

    why not ask on the help group that has been set up for it?

    details at:
    Cheers Don...

    Don McKenzie
    E-Mail Contact Page:

    USB to RS232 Converter that works
    Don's Free Guide To Spam Reduction
  5. Unbeliever

    Unbeliever Guest

    The PIC 16F876 can run at up to 312.5 kbaud from a 20MHz clock, just pick a
    faster baud rate to get the data through, simple.
    A second serial port can be implemented in software (bit banged). There are
    examples for various PICs on the microchip website.

    All that being said, asking a student to use a PIC in this sort of
    application must be the academic equivalent of the old army punishment of
    cleaning the dunny with a toothbrush, just pure sadism. It can be done, but
    for a couple of dollars more a flash DSP or at least a general purpose
    processor with a reasonable architecture (like the MSP430, AVR or any ARM)
    would be my choice.

  6. =)

    Perhaps, that is why no demonstration prototype has been built by the
    lecturers to "convince" us.

    Btw, what do you mean by bit bang?

    I am using a 20Mhz, i suppose it is due to the inefficiency of the compiler
    that I was instructed to use.

  7. Don, can you please advise me what is the help group ?
  8. Unbeliever

    Unbeliever Guest

    Basically using software to output the serial character one bit at a time
    out through a port pin, timing the output to the required baud rate.


    Definition: Transmission of data on a serial line accomplished by
    rapidly changing a single output bit, in software, at the appropriate times.
    The technique is a simple loop with eight OUT and SHIFT instruction pairs
    for each byte. Input is more interesting. And full-duplex (doing input and
    output at the same time) is one way to separate the real hackers from the

  9. onestone

    onestone Guest

    Contact me privately and I'll send you some code.

Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day