Tachometer project

Thread Starter

splendid-electron

Joined Jan 26, 2014
14
Hello !
Rich (BB code):
 void main()
   {
      CMCON = 0x07;   // Disable comparators configuration comparateur
      ADCON1 = 0x0F;  // Disable Analog functions
      //TRISC = 0x00;
      TRISC = 0x80;        // Port C output except RC7 RX (input)
      TRISB = 0x00;        // Configuration du portB en sortie
      PORTA = 0x00;
      TRISA = 0b00010000; // Configuration du bit 4 en entrée
      T0CON = 0b01101000; // TMR0 as 16-bit counter
      Lcd_Init();        // Initialize LCD
      Lcd_Cmd(_LCD_CLEAR);             // CLEAR display
      Lcd_Cmd(_LCD_CURSOR_OFF);        // Cursor off
      Lcd_Out(1,1,message1);            // Write message1 in 1st row
      //----
       UART1_Init(9600);                         // initialize UART1 module
       Delay_ms(100);
      //----
      do
       {
           T0CON.TMR0ON = 1; //  Run Timer
           TMR0L = 0;    //
           TMR0H = 0;
           IR_Tx = 1;
           Delay_ms(1000); // Wait for 1 sec
           IR_Tx = 0;
           T0CON.TMR0ON = 0;    // Stop the timer
           RPM_Value = (256*TMR0H + TMR0L)*60;
           Display_RPM(RPM_Value);
can you help me to understand how this code count the number of slots
 

MaxHeadRoom

Joined Jul 18, 2013
28,688
I would have though a more practical solution would be a Capture T1 etc.
I only use assembly but that is the way it appears to me.
Max.
 
Top