Autor Tema: Ayuda con proyecto de mikroC  (Leído 1265 veces)

0 Usuarios y 3 Visitantes están viendo este tema.

Desconectado cindyl77

  • PIC10
  • *
  • Mensajes: 1
Ayuda con proyecto de mikroC
« en: 03 de Junio de 2014, 23:57:29 »
Necesito de sus ayuda por favor, estoy creando un proyecto en mikroC pero no me anda bien, es de temperatura con motores, pero la temperatura si me la muestra bien pero los mototes se supone que uno tiene que funcionar al estar la temperatura menos de 35 y el otro arriba de 35 pero no me funcionan asi, me pueden ayudar por favor???? les pegare el codigo

unsigned char ch;
unsigned int adc_rd;
char *text,*text1,*text2,*text3,*text4;
long tlong;
int i,j;
char temp;


sbit LCD_RS at RB4_bit;
sbit LCD_RW at RB6_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_RW_Direction at TRISB6_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;



void main() {

  INTCON = 0;
  trisb=0;
  trisd=0;
 
  Lcd_init();
  LCD_Cmd(_LCD_CURSOR_OFF);
  LCD_Cmd(_LCD_CLEAR);


  for(i=0;i<5;i++){
  LCD_Cmd(_LCD_CLEAR);
  text = "LM35";
  LCD_Out(1,i,text);
  Delay_ms(200);
 
 
  }
  text1 = "TEMPERATURA";
  LCD_Out(2,3,text1);
  ADCON1     = 0x82;
  TRISA      = 0xFF;
  Delay_ms(1000);
  LCD_Cmd(_LCD_CLEAR);

  text  = "Temp:";
   for(j=16;j>0;j--){
    LCD_Cmd(_LCD_CLEAR);
    LCD_Out(1,2,text);
    Delay_ms(100);
    }

  while (1) {

   adc_rd  = ADC_read(0);
    tlong = (long)adc_rd * 5000;
    tlong = tlong / 1023 - 40;
    ch = tlong / 1000;

    if (RA0_bit>=ch){

}

    if(ch==0)
    LCD_Chr(2,6,' ');


    else
   
    LCD_Chr(2,6,48+ch);

    ch = (tlong / 100) % 10;
    LCD_Chr_CP(48+ch);
    ch = (tlong / 10) % 10;
    LCD_Chr_CP(48+ch);
    LCD_Chr_CP('.');

    ch = tlong % 10;
    LCD_Chr_CP(48+ch);
    LCD_Chr_CP('C');

    if (RA0_bit<ch){

    for (i=1; i>=ch;i++)


   
    if (Temp>=35)

    PORTD.B0 = 1;
    PORTD.B1 = 1;
    PORTD.B2 = 0;

    text3 = "Disipando calor";
    LCD_Out(5,2,text3);
   
  }
    else
  {
 
    PORTD.B0 = 0;
    PORTD.B1 = 0;
    PORTD.B2 = 1;

    text4 = "Temp Correcta";
    LCD_Out(5,2,text4);
   
    delay_ms(200);

}
}
}





 

anything