help with pic coding for digital multimeter

Discussion in 'Programmer's Corner' started by Spence, Sep 29, 2010.

  1. Spence

    Thread Starter Member

    Apr 23, 2010
    49
    3
    I've got a frequency counter with 6 * 7 segment display, which seems to work fine. What I would like to do is interface this with my pic 16f690 so that it displays frequency (Hz). To do this I am thinking of setting the pic microcontroller to detect a leading edge input on RA1 and then output a pulse to the frequency counter via RC0. This process then has to stop after 1 second so that the stable frequency can be read. Then after 1 second repeat....

    So I just need the pic code lol. I'm not having a lot of success through google and I'm puzzled about the interrupt prescaler which I believe can give me a 1.1 second interrupt, how could I code a 1 second interrupt?

    I'm only interested in reading frequencies from 20kHz to 50kHz. Any help appreciated.
     
  2. Spence

    Thread Starter Member

    Apr 23, 2010
    49
    3
    Should read digital Frequency Meter (not multimeter)
     
  3. Markd77

    Senior Member

    Sep 7, 2009
    2,803
    594
    This may help a little: It does things differently to your plan and I'm not known for good commenting.
    http://forum.allaboutcircuits.com/showthread.php?t=40875

    If you just want your interrupts to happen at 1 second intervals you can preset the timer while interrupts are disabled eg
    movlw 0x12 ;change as required
    movwf TMR1H
    movlw 0x33 ;change as required
    movwf TMR1L
    will reduce the time until the next timer1 interrupt. This has to be done every time the timer is reset and you will have to work out the correct values.
     
Loading...