bonsoir tout le monde j'ai un problème je veux commander une LED et recevoir les temperatures de deux capteur LM35 au même temps, je recois les données de temperature mais quand je veux commander la LED elle ne repond pas voilà mon programme en Mikroc :
// LCD module connections
sbit LCD_RS at RB2_bit;
sbit LCD_EN at RB3_bit;
sbit LCD_D4 at RB4_bit;
sbit LCD_D5 at RB5_bit;
sbit LCD_D6 at RB6_bit;
sbit LCD_D7 at RB7_bit;
sbit LCD_RS_Direction at TRISB2_bit;
sbit LCD_EN_Direction at TRISB3_bit;
sbit LCD_D4_Direction at TRISB4_bit;
sbit LCD_D5_Direction at TRISB5_bit;
sbit LCD_D6_Direction at TRISB6_bit;
sbit LCD_D7_Direction at TRISB7_bit;
// End LCD module connections
unsigned char text0[4] ;
unsigned char text1[4] ;
unsigned short int dt;
int temp0 = 0;
int temp1 = 0;
// Main program
void main ()
{
TRISD.F0 = 0;
PORTD.F0 = 0;
Lcd_Init(); // Initialize LCD
Lcd_Cmd(_LCD_CLEAR); // Clear display
Lcd_Cmd(_LCD_CURSOR_OFF); // Cursor off
Lcd_Out(1,1,"ROOM1 TEMP.= C"); // writes text on line 1, column 1 of the lcd
Lcd_Out(2,1,"ROOM2 TEMP.= C"); // writes text on line 2, column 1 of the lcd
Uart1_Init (9600);
do {
if (UART1_Data_Ready ()) {
Uart1_Write (dt); }
switch (dt) {
case 'a':
PORTD.F0=1;
break;
case 'b':
PORTD.F0=0;
break;
}
temp0 = Adc_Read(0); // Read channel AN0 and save value in the variable temp0
temp0 =temp0/2.05;// Convert from value to TEMPERATURE
temp1 = Adc_Read(1); // Read channel AN1 and save value in the variable temp1
temp1 =temp1/2.05; // Convert from value to TEMPERATURE
ByteToStr(temp0, text0);// converts TEMP.to string
ByteToStr(temp1, text1); // converts TEMP.to string
Lcd_Out(1,12,text0); // Write the value to LCD
delay_ms (200);
Lcd_Out(2,12,text1); // Write the value to LCD
delay_ms (200);
UART1_Write_Text(text0); // Sent to uart
UART1_Write_Text("C");
Uart1_Write('\t'); // Tabe (Horizontal)
UART1_Write_Text("ROOM2 TEMP.=");
UART1_Write_Text(text1);
UART1_Write_Text("C");
Uart1_Write('\r'); // OR 13 : Carriage Return
}
while (1); }
je veux quand j'ouvre hyperterminal la temperature s'affiche mais quand j'appuis sur a la LED s'allume.
-----