Autor Tema: Problemas UART  (Leído 1559 veces)

0 Usuarios y 1 Visitante están viendo este tema.

Desconectado pfc_18f4550

  • PIC10
  • *
  • Mensajes: 16
Problemas UART
« en: 06 de Septiembre de 2012, 07:17:22 »
Buenos días.

Tengo un problema con la UART, estoy programando un pic 18f25k22 y no consigo enviar nada por la UART. Esta es la configuración:

//***************************************************************
   RCON = 0X00;//IPEN = 0
   INTCON = 0XA0;//configuramos la interrupcion del timer0
   INTCON2   =0b11110000;
   INTCON3   =0b00000000;
   PIR1=0b00000000;
   PIR2=0b00000000;
   PIR3=0b00000000;
   PIR4=0b00000000;
   PIR5=0b00000000;
   
   PIE1=0b00000000;
   PIE2=0b00000000;
   PIE3=0b00000000;
   PIE4=0b00000000;
   PIE5=0b00000000;   

   IPR1=0b00000000;
   IPR2=0b00000000;
   IPR3=0b00000000;
   IPR4=0b00000000;
   IPR5=0b00000000;


   //PIE1bits.TX1IE=0;

//***************************************************************
//*******      Configuracion UART         *********************

   //bits TXSTAX:
            //bit 7 -> CSRC fuente reloj -> no utilizada en asincrono 0
            //bit 6 -> TX9 envio 9 bits -> 1
             //bit 5 -> TXEN habilitar tansmision -> 1
              //bit 4 -> SYNC seleccion modo trabajo -> 0 Asincrono
               //bit 3 -> SENDB send break -> 1 envio en la siguiente transmision /0 envio al completar
               //bit 2 -> BRGH high baud rate -> 1 high / 0 low
                //bit 1 -> TRMT Estado reg. tranmision -> 0 lleno/1 vacio (lectura)
                 //bit 0 -> TX9D 9º bit tranmision
   TXSTA1 = 0b01100100;
   //bits RCSTAX:
            //bit 7 -> SPEN habilitar puerto serie-> 1 on / 0 off
            //bit 6 -> RX9 habilitar recepcion 9 bits -> 1 9bits / 0 8bits
             //bit 5 -> SREN en asincrono no se usa
              //bit 4 -> CREN habilitar recepcion continua -> 1 on / 0 off
               //bit 3 -> ADDEN deteccion direccon 9º bit -> 1 habilitar deteccion/ 0 bit de paridad o dato
               //bit 2 -> FERR error framing -> 1 error / 0 no error
                //bit 1 -> OERR error overrun -> 1 error / 0 no error
                 //bit 0 -> RX9D 9º bit recepcion
   RCSTA1 = 0b11000000;

   //bits BAUDCONX:
             //bit 7 -> ABDONF deteccion automatica baud rate ->
              //bit 6 -> RCIDL recepcion Idle flag -> 1 recivida
               //bit 5 -> DTRXP polaridad data/recive -> 1 invertido/ 0 no invertido
               //bit 4 -> CKTXP polaridad clk/transmit -> 1 Idle estado bajo / 0 estado alto
                  //bit 3 -> BRG16 16 bits baud rate -> 1 16 bits / 0 8 bits
                 //bit 2 -> NO USE
                  //bit 1 -> WUE habilitar despertar -> 0 recepcion normal/ 1 espaera flaco bajada
                  //bit 0 -> ABDEN habilitar deteccion baud-rate -> 1 on / 0 off
   BAUDCON1 = 0b00001000;


   //calculo del valor del registro para un abaud rate de 115,200
   // Baud-rate = Fosc/[4*(n+1)] -> formula en funcion de los bits de SYNS, BRG16 y BRGH
   // n= [(fosc/baud-rate)/4]-1 = [(32MHz/115200)/4]-1 = 68,44 -> 68
   // n= 68
   SPBRGH1=0x00;
   SPBRG1 =0x44;

Algo debo de estar haciendo mal por miro con el osciloscopio en la salida de la UART1 y no se ve nada!.

Muchas gracias.

Desconectado pfc_18f4550

  • PIC10
  • *
  • Mensajes: 16
Re: Problemas UART
« Respuesta #1 en: 06 de Septiembre de 2012, 07:53:05 »
Problema solucionado !!

Gracias

Desconectado jukinch

  • Colaborador
  • PIC24F
  • *****
  • Mensajes: 608
Re: Problemas UART
« Respuesta #2 en: 07 de Septiembre de 2012, 10:36:36 »
Y como fue la solución?
"Divide las dificultades que examinas en tantas partes como sea posible para su mejor solución." -René Descartes


 

anything