اربع حساسات في متحكم واحد بتوفيق من الله تعالى
الكود
كود:
sbit LCD_RS at Rb0_bit;
sbit LCD_EN at Rb1_bit;
sbit LCD_D7 at Rb7_bit;
sbit LCD_D6 at Rb6_bit;
sbit LCD_D5 at Rb5_bit;
sbit LCD_D4 at Rb4_bit;
// Pin direction
sbit LCD_RS_Direction at TRISb0_bit;
sbit LCD_EN_Direction at TRISb1_bit;
sbit LCD_D7_Direction at TRISb7_bit;
sbit LCD_D6_Direction at TRISb6_bit;
sbit LCD_D5_Direction at TRISb5_bit;
sbit LCD_D4_Direction at TRISb4_bit;
unsigned char text0[4] ;
unsigned char text1[4] ;
unsigned char text2[4] ;
unsigned char text3[4] ;
int temp0 = 0;
int temp1 = 0;
int temp2 = 0;
int temp3 = 0;
//Programme principal : MOUAD //
void main ()
{
Uart1_Init (9600);
Lcd_Init();
Lcd_Cmd(_LCD_CLEAR);
Lcd_Cmd(_LCD_CURSOR_OFF);
Lcd_Out(1, 5, ">>T0");
Lcd_Out(2, 5, ">>T1");
Lcd_Out(1, 15, ">> T2");
Lcd_Out(2, 15, ">> T3");
do {
temp0 = Adc_Read(0);
temp1 = Adc_Read(1);
temp2 = Adc_Read(2);
temp3 = Adc_Read(3);
temp0 =temp0/2.05;
temp1 =temp1/2.05;
temp2 =temp2/2.05;
temp3 =temp3/2.05;
temp0=temp0-271.5;
temp1=temp1-271.5;
temp2=temp2-271.5;
temp3=temp3-271.5;
ByteToStr(temp0, text0);
ByteToStr(temp1, text1);
ByteToStr(temp2, text2);
ByteToStr(temp3, text3);
Lcd_Out(1, 1, text0);
Lcd_Chr_cp('C');
Lcd_Out(2, 1, text1);
Lcd_Chr_cp('C');
Lcd_Out(1, 10, text2);
Lcd_Chr_cp('C');
Lcd_Out(2, 10, text3);
Lcd_Chr_cp('C');
UART1_Write_Text(text0);
UART1_Write_Text(" C1 >>T0");
Uart1_Write('\r');
delay_ms(100);
UART1_Write_Text(text1);
UART1_Write_Text(" C >>T1");
Uart1_Write('\f');
delay_ms(100);
UART1_Write_Text(text2);
UART1_Write_Text(" C >>T2");
Uart1_Write('\n');
delay_ms(100);
UART1_Write_Text(text3);
UART1_Write_Text(" C >>T3");
Uart1_Write('\v');
delay_ms(100);
delay_ms(500);
}
while (1);
}
انتظرني حتى اكتب الكود في برنامج vusial basic