codigo de adquisicion de datos


//CODIGO FUENTE DEL SISTEMA DE ADQUISICIÓN DE DATOS 
//USADO CON LA EASY PIC 6
//MTI JAIRO AVENDAÑO MALVAEZ
//PROFESOR EN EL TECNOLOGICO DE ZACATEPC
//E-MAIL:jairomarvin@hotmail.com
//MATERIA: HERRAMIENTAS COMPUTACIONALES
//LIBRE DE USARSE Y MODIFICARSE, SOLO MENCIONA LA FUENTE.. :)


/ LCD module connections
sbit LCD_RS at RB4_bit;
sbit LCD_EN at RB5_bit;
sbit LCD_D4 at RB0_bit;
sbit LCD_D5 at RB1_bit;
sbit LCD_D6 at RB2_bit;
sbit LCD_D7 at RB3_bit;

sbit LCD_RS_Direction at TRISB4_bit;
sbit LCD_EN_Direction at TRISB5_bit;
sbit LCD_D4_Direction at TRISB0_bit;
sbit LCD_D5_Direction at TRISB1_bit;
sbit LCD_D6_Direction at TRISB2_bit;
sbit LCD_D7_Direction at TRISB3_bit;
// End LCD module connections

char txt1[] = "Adquisicion de datos";
 char valor[6];
void main()
{  unsigned int adc_rd=0;
  ANSEL  = 0x01;                        // Configure AN0 pins as analog
  ANSELH = 0;
  C1ON_bit = 0;                      // Disable comparators
  C2ON_bit = 0;
  TRISA=0XFF;
 
  Lcd_Init();                        // Initialize LCD

  Lcd_Cmd(_LCD_CLEAR);               // Clear display
  Lcd_Cmd(_LCD_CURSOR_OFF);          // Cursor off
  Lcd_Out(1,6,txt1);                 // Write text in first row

  while(1)
  {
      UART1_Init(9600);                               // CICLO INFINITO
    adc_rd  = ADC_Read(0);                 // LEE EL CANAL 0 DE ADC

    adc_rd=((adc_rd*50)/103);            //CONVERSION A GRADOS CENTIGRADOS

   WordToStr(adc_rd,valor);
    LCD_Out(2,1,valor);


    UART1_Write(adc_rd);              // CONVERSION A TEXTO PRA MOSTRARLO EN LA LCD

    Delay_ms(200);

            }
}





Comentarios