Bonjour j ai un souci avec mon compteur vitesse car tableau de bord hs . Le principe marche bien mais je n arrive pas a faire la conversion Volt KMH
Merci de m aider je suis nouveau dans la programmation de PIC
Code:/*Header******************************************************/ // 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 unsigned char ch; // unsigned int adc_rd; // Declare variables char *text; // long tlong; // void main() { INTCON = 0; // All interrupts disabled ANSEL = 0x04; // Pin RA2 is configured as an analog input TRISA = 0x04; ANSEL = 0; // Rest of pins are configured as digital Lcd_Init(); // LCD display initialization Lcd_Cmd(_LCD_CURSOR_OFF); // LCD command (cursor off) Lcd_Cmd(_LCD_CLEAR); // LCD command (clear LCD) text = "Peugeot "; // Define the first message Lcd_Out(1,1,text); // Write the first message in the first line text = ""; // Define the second message Lcd_Out(2,1,text); // Define the first message ADCON1 = 0x82; // A/D voltage reference is VCC TRISA = 0xFF; // All port A pins are configured as inputs Delay_ms(30); Lcd_Cmd(_LCD_CLEAR); // LCD command (clear LCD) while (1) { text = "KMH:"; // Define the third message Lcd_Out(1,4,text); adc_rd = ADC_Read(2) / 3,5; // A/D conversion. Pin RA2 is an input. Lcd_Out(2,4,text); // Write result in the second line Delay_us(3); } }
-----