Loading ...
Sorry, an error occurred while loading the content.

Re: pic + wav

Expand Messages
  • pendor2k
    Firts, thanks to Bert and Matt for their answers. The resistor is about 600 ohms, capacitor is 0.2 uF. I have not checked with an oscilloscope. The complete
    Message 1 of 5 , Mar 1 5:32 AM
    • 0 Attachment
      Firts, thanks to Bert and Matt for their answers.
      The resistor is about 600 ohms, capacitor is 0.2 uF.
      I have not checked with an oscilloscope.

      The complete code is posted below, be aware that most variable names and comments are in spanish.

      ======================= BEGIN CODE ====================
      include 16f877a
      --
      pragma target OSC HS -- HS crystal or resonator
      pragma target clock 20_000_000 -- oscillator frequency
      --
      pragma target WDT disabled
      pragma target LVP disabled
      --
      include delay
      --

      pin_b7_direction = output
      pin_b6_direction = output
      alias salida_audio is pin_b7
      alias testigo is pin_b6

      const byte arreglo[]={
      0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0xaa,0x1f,
      0xe0,0x80,0xdf,0x81,0xf0,0x7f,0x83,0x70,0x3f,0x98,0xf9,
      0x00,0x3b,0xe7,0xa0,0x47,0xd1,0x83,0x1a,0x7e,0x79,0xe4,
      0x83,0x80,0xff,0xd0,0x3e,0x43,0xf0,0x3f,0x13,0x99,0xe0,
      0x2f,0xce,0x80,0x93,0x37,0xfa,0x26,0x07,0xf1,0xe8,0x40,
      0xff,0x10,0xb6,0x2f,0x07,0xc0,0x47,0xfc,0x80,0xf7,0xc1,
      0xe6,0x0f,0xb0,0x7c,0x4f,0x10,0xe4,0xb8,0x1e,0xef,0x83,
      0xee,0x0d,0x72,0x24,0x1d,0xa0,0xdf,0xe2,0x00,0x7f,0x80,
      0x7f,0xc0,0xbd,0xca,0x46,0xf0,0xcc,0x81,0xff,0x10,0x38,
      0xff,0x00,0x9f,0xe4,0x03,0xf8,0xc4,0xe0,0x3f,0xd1,0x03,
      0x7e,0x41,0x7b,0xc0,0x1f,0xe6,0x19,0xf1,0xf0,0x01,0xfe,
      0x0c,0xdb,0x20,0x6f,0xcc,0x01,0xa7,0xde,0xd0,0x3b,0x8e,
      0x20,0xcc,0x5f,0xf0,0x7e,0xd0,0xe4,0x0c,0x7f,0x36,0x38,
      0x0f,0xc7,0x80,0xe7,0xc4,0x1f,0x60,0x3f,0xb0,0x0b,0x4f,
      0x3f,0x00,0x3f,0x1c,0xe4,0x0e,0xf8,0x6c,0x09,0xd9,0xcf,
      0xc3,0x07,0x0d,0xbe,0x39,0x01,0xcb,0x3e,0x0e,0x27,0x7a,
      0x5a,0x0b,0xfc,0x02,0x77,0x38,0x77,0x81,0xce,0x63,0x59,
      0xe4,0xc2,0x0b,0xaf,0xf4,0x01,0xe7,0xcf,0x60,0x03,0x7f,
      0xc0,0xfb,0x82,0x0e,0xe0,0x8f,0xbc,0x2d,0x81,0xb9,0xf6,
      0x03,0xf1,0x1e,0x34,0x22,0x37,0xeb,0xe8,0x48,0x3f,0x20,
      0xe0,0xef,0xba,0x08,0xf3,0x3a,0x9a,0x1c,0x71,0xe5,0xb8,
      0x1c,0x6c,0xbc,0x70,0x3f,0x83,0x07,0x7f,0x30,0x9c,0x0f,
      0xbc,0x47,0x03,0xf4,0x07,0xb8,0x37,0x87,0xd1,0xbc,0x44,
      0xbb,0x20,0x9f,0x18,0xbf,0x03,0x9b,0xe1,0x38,0xb3,0x39,
      0xc6,0x0c,0x79,0x4d,0xdc,0x1f,0x88,0x4d,0xc3,0x3b,0x1c,
      0x37,0xb0,0x0f,0x3d,0xc8,0x09,0xbf,0x8e,0x80,0xae,0x6f,
      0xc8,0x0f,0x3a,0x6c,0x0f,0x39,0x66,0xe1,0x86,0x5e,0x7c,
      0x1e,0x1c,0x3c,0x93,0xe0,0x6f,0x0e,0xf0,0x37,0xb0,0x31,
      0xbe,0x74,0x18,0xe9,0x1b,0xe2,0xe1,0x8b,0xe0,0x7e,0x25,
      0xe0,0xd5,0x9c,0x68,0xf1,0xb2,0x3c,0x3e,0x18,0xcf,0x50,
      0x37,0x63,0x9d,0x1c,0x2f,0x82,0x66,0x78,0x3e,0xe9,0x84,
      0x32,0x77,0xe4,0x0d,0x2f,0xcb,0x81,0x76,0x85,0xdc,0x11,
      0xef,0x0a,0x9b,0x60,0xf6,0x8c,0x9a,0xac,0x33,0x4e,0xad,
      0x62,0xaa,0x35,0x56,0xd8,0x4e,0x39,0xae,0x0b,0x61,0xb6,
      0xaa,0xa2,0x67,0xaa,0x6a,0x54,0xe2,0xd3,0x4a,0x3b,0x92,
      0x6d,0x2a,0xba,0xa1,0x73,0x2a,0x5a,0xb4,0xb4,0xb4,0xd2,
      0xcd,0x45,0xaa,0xb5,0x2d,0x4a,0xaa,0xca,0x5c,0xc9,0x6b,
      0x54,0xa5,0xab,0x54,0xd2,0xa5,0x55,0xac,0x56,0xaa,0xd3,
      0x0b,0x56,0xaa,0x55,0x95,0x55,0x35,0x64,0xd6,0xa8,0xaa,
      0xd5,0x55,0x55,0x54,0xd5,0x9a,0x2a,0xad,0x2a,0xb3,0x4d,
      0x55,0x65,0x54,0xad,0x55,0x32,0xab,0x52,0xaa,0xd5,0x4a,
      0xad,0x2a,0xb2,0xa6,0xad,0x4a,0x5a,0xb5,0x2a,0xaa,0x9a,
      0xaa,0x96,0x65,0x96,0xaa,0x6a,0xa5,0x6a,0xa5,0xaa,0x6a,
      0xa5,0x6a,0xaa,0x55,0x6a,0xaa,0x96,0xaa,0x55,0x55,0xaa,
      0xaa,0x95,0x6a,0xaa,0x95,0x6a,0x95,0x56,0x95,0x55,0x55,
      0x56,0xa5,0x55,0x55,0x69,0x55,0x55,0x55,0x55,0x55,0x55,
      0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
      0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,
      0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x4b,0x55,0x55,
      0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x40}

      var word posicion = 0
      var byte dato = 0
      var word tamanio = 0

      procedure tocar_sonido is
      var bit resul at dato:7

      tamanio = count(arreglo)
      posicion = 0

      while posicion < tamanio loop
      ; leer byte tabla
      dato = arreglo[posicion]
      ; separar bits individuales (el MSB va primero, el LSB último)
      ; y luego enviar al pin de salida dichos bits individuales
      for 8 loop
      if resul == 1 then
      salida_audio = on
      else
      salida_audio = off
      end if
      dato = dato << 1
      delay_10us(10)
      end loop
      ; incrementar puntero de lectura
      posicion = posicion + 1
      end loop

      end procedure


      salida_audio = off

      testigo = on
      for 3 loop
      delay_100ms(10)
      end loop
      testigo = off


      forever loop

      tocar_sonido
      ; retardito de 2 segs
      for 2 loop
      delay_100ms(10)
      end loop

      testigo = !testigo

      end loop

      ======================= END CODE ======================

      Thanx again, I´ll try modifying the output smapling, maybe even try tmr0.

      Fabián
    • ei9feb
      Is it CVSD encoding? It uses 1 bit DAC and oversampling. Early encryption, digital transmission and voice mail used CVSD in 1970s and 1980s. Encoding can be
      Message 2 of 5 , Mar 1 3:47 PM
      • 0 Attachment
        Is it CVSD encoding?
        It uses 1 bit "DAC" and oversampling. Early encryption, digital transmission and voice mail used CVSD in 1970s and 1980s. Encoding can be done with a comparator.
      Your message has been successfully submitted and would be delivered to recipients shortly.