Tachometer with Interrupts


Closed Thread
Results 1 to 15 of 15

Hybrid View

  1. #1
    Join Date
    Oct 2008
    Posts
    14


    Did you find this post helpful? Yes | No

    Default

    Thanks for help.. I tried to write codes with CCS C, it's very simple.. Asm codes are difficult for me.. So it works without any problem. If someone needs I can paste the codes..

  2. #2
    Join Date
    Sep 2006
    Posts
    42


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by serkanc View Post
    Thanks for help.. I tried to write codes with CCS C, it's very simple.. Asm codes are difficult for me.. So it works without any problem. If someone needs I can paste the codes..
    Please paste the code,would love to see.. Regards.

  3. #3
    Join Date
    Oct 2008
    Posts
    14


    Did you find this post helpful? Yes | No

    Default

    #include <16F628A.h>

    #FUSES NOWDT //No Watch Dog Timer
    #FUSES HS //High speed Osc (> 4mhz for PCM/PCH) #FUSES NOPUT //No Power Up Timer
    #FUSES NOPROTECT //Code not protected from reading
    #FUSES NOBROWNOUT //No brownout reset
    #FUSES MCLR //Master Clear pin enabled
    #FUSES NOLVP //No low voltage prgming, B3(PIC16) or
    #FUSES NOCPD //No EE protection
    #use delay(clock=4000000)

    #define LCD_DATA_PORT getenv("SFR:PORTB")
    #define LCD_ENABLE_PIN PIN_A1
    #define LCD_RS_PIN PIN_A0
    #define LCD_RW_PIN PIN_A2
    #define LCD_DATA0 PIN_B4
    #define LCD_DATA1 PIN_B5
    #define LCD_DATA2 PIN_B6
    #define LCD_DATA3 PIN_B7
    #define LCD_TYPE 2
    #include <lcd.c>

    long suretmp;
    long sure;

    #int_EXT
    void EXT_isr(void)
    {
    suretmp=sure;
    sure=0;
    set_timer0(0);
    }

    #int_TIMER2
    void TIMER2_isr(void)
    {
    sure++;
    }

    void main()
    {
    long devir;
    int i;
    setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
    setup_timer_1(T1_DISABLED);
    setup_timer_2(T2_DIV_BY_1,99,1);
    setup_comparator(NC_NC_NC_NC);
    setup_vref(FALSE);
    setup_oscillator( OSC_4MHZ );
    lcd_init();
    enable_interrupts(INT_EXT);
    enable_interrupts(INT_TIMER2);
    enable_interrupts(GLOBAL);

    while(1)
    {
    for(i=0;i<250;i++)
    {
    delay_us(2);
    }
    lcd_gotoxy(1,1);
    devir=600000/suretmp;
    if((600000%suretmp)>(suretmp/2))
    devir++;

    printf(lcd_putc,"%Lu mS Passed",suretmp);
    printf(lcd_putc,"\n%Lu RPM",devir);
    }

    }

Similar Threads

  1. Continuous Interrupts when using DT_INTS and an INCLUDE file
    By jellis00 in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 15th January 2010, 21:42
  2. Tachometer with DT Interrupts?
    By DanPBP in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 17th November 2009, 19:51
  3. Clock using Instant Interrupts
    By PICpocket in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 16th February 2009, 21:43
  4. DT's Instant Interrupts trouble
    By Tomexx in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 24th November 2008, 20:48
  5. help: TMR0 interrupts disabling PORTAchange interrupts???
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 19th August 2008, 15:10

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts