Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

using BTC sound file in PIC18F

Help
sansenan
2008-05-29
2013-03-12
  • sansenan
    sansenan
    2008-05-29

    hello,

    I am planning of playing some sounds in my PIC18F4550 using Roman Black's BTc Sound Encoder 2.0 Software(http://www.romanblack.com/picsound.htm) which converts sound (in wave files) to a 1-bit format that can be played back on microprocessor chip

    The sound is output on 2 pins(or 1 pin as he has mentioned in his website) of the PIC as follows:

    ; Digital ----------2R-----,
    ; |
    ; Digital ----------2R-----*----- Analogue
    ; | out
    ; |
    ; |
    ; C = 0.22 uF
    ; |
    ; |
    ; |
    ; Gnd

    The generated file is in ASM format,or as a c function or a btc format.
    for example :his generated c function is like:::::
    void sound_data1()    org (1 * 256)
    {
       asm retlw 0x12 ;
       asm retlw 0x5E ;
       asm retlw 0xAA ; `
       asm retlw 0xAA ;
       asm retlw 0xCA ;
       asm retlw 0xAA ;
       asm retlw 0xAA ;
       asm retlw 0xB2 ;
       asm retlw 0xAA ;
       asm retlw 0xA5 ;
    .............
    }

    .My question is  how do i include that above function into a c file.What doest retlw do?and how do i tell sdcc,what port the sound is to be played out of?
    for example if i have to play the same on say PORTD.0 and PORTD.1.How do i do that.Pls help.

    and if we were to read directly the raw values from the .btc format and write it to a port how to do that??

    thanks and regards
    sans