salut.
svp j ai un problem de ce programme . je veux faire ajouter deux autres entre analogique et comment afficher les trois valeur sur LCD 2x16.?
freq=4MHz
<<<<
>>>>>>>>>>>>>>>>>>>>>>>>>>>> >Code:// Define LCD connections sbit LCD_RS at RB0_bit; sbit LCD_EN at RB1_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 TRISB0_bit; sbit LCD_EN_Direction at TRISB1_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 void Display(unsigned int num){ char temp[] = "I = 0.00 Amp"; temp[4] = num/1000 + 48; temp[6] = (num/100)%10 + 48; temp[7] = (num/10)%10 + 48; LCD_Out(2, 3, temp); } char message[] = "ACS712-05 Sensor"; unsigned int ADC_Value, Factor; unsigned long temp; main(){ ANSELA = 0x01; // PORTA.0 is analog TRISA = 0b00100001; // RA5 and RA0 are inputs ANSELB = 0x00; // PORTB pins are all digital TRISB = 0x00; // PORTB pins are all output Lcd_Init(); Lcd_Cmd(_LCD_CLEAR); // CLEAR display Lcd_Cmd(_LCD_CURSOR_OFF); // Cursor off Lcd_Out(1,1,message); Factor = 264; // To conver Count into current do{ // Read multiple samples for better accuracy ADC_Value = ADC_Read(0); ADC_Value = ADC_Value + ADC_Read(0); ADC_Value = ADC_Value + ADC_Read(0); ADC_Value = ADC_Value/3; temp = (ADC_Value-512)*Factor ; ADC_Value = temp/10; Display(ADC_Value); Delay_ms(1000); } while(1); }
le shema sur ISIS
http://embedded-lab.com/blog/wp-cont...ACS712_CKT.png
mercciiiii
-----