TODOPIC

Microcontroladores PIC => Lenguaje C para microcontroladores PIC => Mensaje iniciado por: cvargcal en 23 de Marzo de 2017, 13:19:16

Título: DTMF HT9200A
Publicado por: cvargcal en 23 de Marzo de 2017, 13:19:16
Hola, he intentado generar el tono con este integrado, pero no lo consigo.
Código: C
  1. #define  DATA_PIN    PIN_A0    // DATA, Dato serial del tono
  2. #define  CLOCK_PIN   PIN_A1    // CLOCK, Reloj DTMF
  3. #define  CE_PIN      PIN_A2    // CE, Habilita Chip DMTF, en bajo
  4.  
  5. int16 numero;
  6. void Init_HT9200(void);
  7. void envia_dtmf(numero);
  8.  
  9. void main(){
  10.    set_tris_a(0b11100000);
  11.    output_a(0x00);
  12.    output_c(0);
  13.    Init_HT9200();                        // init the chip
  14.  
  15.    while(1)
  16. {
  17.    output_toggle(PIN_C1);
  18.   envia_dtmf(1);envia_dtmf(0x1F);                      ///fprintf(debug,"1 = 697, 1209\r\n");//digito 2 //off dtmf
  19.    envia_dtmf(2);envia_dtmf(0x1F);fprintf(debug,"2 = 697, 1209\r\n");//digito 2 //off dtmf
  20. //   envia_dtmf(3);envia_dtmf(0x1F);fprintf(debug,"3 = 697, 1209\r\n");//digito 2 //off dtmf
  21. //!   envia_dtmf(4);envia_dtmf(31);fprintf(debug,"4 = 697, 1209\r\n");//digito 2 //off dtmf
  22. //!   envia_dtmf(5);envia_dtmf(31);fprintf(debug,"5 = 697, 1209\r\n");//digito 2 //off dtmf
  23. //!   envia_dtmf(6);envia_dtmf(31);fprintf(debug,"6 = 697, 1209\r\n");//digito 2 //off dtmf
  24. //!   envia_dtmf(7);envia_dtmf(31);fprintf(debug,"7 = 697, 1209\r\n");//digito 2 //off dtmf
  25. //!   envia_dtmf(8);envia_dtmf(31);fprintf(debug,"8 = 697, 1209\r\n");//digito 2 //off dtmf
  26. //!   envia_dtmf(9);envia_dtmf(31);fprintf(debug,"9 = 697, 1209\r\n");//digito 2 //off dtmf
  27.  
  28.  
  29.  
  30. }
  31. }
  32.  
  33.  
  34. void Init_HT9200(){
  35.   output_high(CE_PIN);           // start with chip disabled (else you go nuts)
  36.   output_high(CLOCK_PIN);        // start with clock pin high
  37.   output_low(CE_PIN);            // now enable the chip
  38.   delay_ms(10);                  // delay 10ms to ramp up the ocillator
  39.   //envia_dtmf(0x1F);
  40.   //DTMF_Out (DTMF_OFF);          // turn off any tone from previous run
  41. }
  42.  
  43. void envia_dtmf(numero){
  44. int i;
  45.   if (numero == 0) numero = 10;                    // take care of 0 here
  46.   for(i=0;i<=5;++i) {
  47.    
  48.     output_high(CLOCK_PIN);                        // clock high while setting data
  49.   //  if(bit_test(numero,i)){ output_high(DATA_PIN); }
  50.   //  else { output_low(DATA_PIN);}
  51.     output_bit(DATA_PIN,shift_left(&numero,1,0));  // set data LSB->MSB
  52.    
  53.     delay_us(5);                                   // 1/2 of 100K Clock speed
  54.     output_low(CLOCK_PIN);                         // clock low to latch data
  55.     delay_us(5);                                   // 1/2 of 100K Clock speed
  56.   }
  57.   delay_ms(200);  // duración
  58. }


Me copie de este código para arduino.
https://github.com/brucetsao/eRFID/blob/master/DTMF/DTMF.ino
http://www.pselectronic.cz/pdf/1120/1120895.pdf (http://www.pselectronic.cz/pdf/1120/1120895.pdf)   HT9200A, pagina 5/6
Alguien tiene alguna idea?