slt tout le monde,
je vous présente mon projet qui permet la
détermination de la fréquence d'un signal d'entrée analogique par un pic 16f877,
le résultat s' affiche sur un écran lcd 2x16,
lors de la compilation avec le mikro C il me demande la délaration des timers et des interruptions,Code:const char TIMER_START_VALUE = 8; const char TIMER_RELOAD_VALUE = 125; char sec, updateDisplay, reload; long bat; char bat_str [] = " "; // LCD module connections sbit LCD_RW at RB2_bit; sbit LCD_RS at RB1_bit; sbit LCD_EN at RD3_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_RW_Direction at TRISB2_bit; sbit LCD_RS_Direction at TRISB1_bit; sbit LCD_EN_Direction at TRISB3_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 main() { TrisA = 0xFF; TrisC = 0; PortC = 0; TrisD = 0; PortD = 0; ADCON0 = 0; ADCON1 = 0x0F; Lcd_Init(); // Initialize LCD Lcd_Cmd(_LCD_CLEAR); // Clear display Lcd_Cmd(_LCD_CURSOR_OFF);// Cursor off Lcd_Out(1,1,"Wireless ECG"); delay_ms(4000); Lcd_Cmd(_LCD_CLEAR); // Clear display Lcd_Cmd(_LCD_CURSOR_OFF); LCD_Out(1,1,"Heartbeats :"); // Write text in first row updateDisplay = 0; sec = 0; reload = 0; bat = 0; INTCON = 0xC0; // Set GIE, PEIE INT0IE_bit = 1; TMR0ON_bit = 0; // turn off the timer during setup TMR0IE_bit = 1; // Enable TMRO interrupt T08BIT_bit = 1; // Enable 8 bit control (as opposed to 16-bit) T0CS_bit = 0; // use internal clock to trigger timer to count PSA_bit = 0; // Use the prescaler to slow the timer down T0PS0_bit = 1; T0PS1_bit = 0; T0PS2_bit = 1; TMR0L = TIMER_START_VALUE; reload = TIMER_RELOAD_VALUE; TMR0ON_bit = 1; // start the timer while (1) { if (UpdateDisplay == 1) { UpdateDisplay = 0; WordToStr (bat, bat_str); bat = 0; LCD_Out(2,1,bat_str); } } } void Interrupt (void) { if (INTCON.TMR0IF) { TMR0L = TIMER_START_VALUE; T0IF_bit = 0; if(reload == 0) { reload = TIMER_RELOAD_VALUE + 1; sec = sec + 1; if (sec == 15) { updateDisplay = 1; sec = 0; } } reload = reload - 1; } if (INTCON.INT0IF) { bat = bat + 1; INT0IF_bit = 0; } }
comment corriger ce probleme?
-----