bonjour .je suis entrain de chercher le max d une coube sinusoidale par le pic 16F877A .je fait ce code
?////////////
// Define LCD connections
sbit LCD_RS at RD0_bit;
sbit LCD_EN at RD1_bit;
sbit LCD_D4 at RD4_bit;
sbit LCD_D5 at RD5_bit;
sbit LCD_D6 at RD6_bit;
sbit LCD_D7 at RD7_bit;
sbit LCD_RS_Direction at TRISD0_bit;
sbit LCD_EN_Direction at TRISD1_bit;
sbit LCD_D4_Direction at TRISD4_bit;
sbit LCD_D5_Direction at TRISD5_bit;
sbit LCD_D6_Direction at TRISD6_bit;
sbit LCD_D7_Direction at TRISD7_bit;
// End LCD module connections
void Display1(unsigned int num){
char temp[] = "I1=00.00 A";
temp[3] = num/10000 + 48;
temp[4] = (num/1000)%10 + 48;
temp[6] = (num/100)%10 + 48;
temp[7] = (num/10)%10 + 48;
LCD_Out(1, 2, temp);
}
unsigned int max1,max2,ADC_Value1;
unsigned long temp1;
main(){
Lcd_Init();
Lcd_Cmd(_LCD_CLEAR); // CLEAR display
Lcd_Cmd(_LCD_CURSOR_OFF); // Cursor off
Factor = 35 ;
max1 = ADC_Read(0);
do {
delay_us(10);
max2 = ADC_Read(0);
delay_us(10);
}
while(max1>max2)}
ADC_Value1 = max1;
temp1 = abs((ADC_Value1-512))*Factor ;
ADC_Value1 = temp1;
Display1(ADC_Value1);
}
///////////////////////////
ce programme ne donne pas des resultat exacte
est ce que je peu utiliser l interruption ? et coment ajouter l interruption ?
merci d avance
-----