Partial Digital PORTA?


Results 1 to 9 of 9

Threaded View

  1. #8
    Join Date
    Jul 2003
    Location
    USA - Arizona
    Posts
    156


    Did you find this post helpful? Yes | No

    Default

    Disclaimer:
    1) I have never done a tachometer...
    ... although I have done frequency counters.

    2) There is no such things as being new at something, it is only a degree of knowledge (and it varies from day-to-day, coffee anyone?). Questions are extremely good.

    First let me try the port question.
    <ul>If you are only using the RA4 pin as an input, then you have nothing to worry about (it is only if you wanted to use it as an output that you need an external pull-up).</ul>

    Next let me try your application-specific question.
    <ul>The math used is good (i.e. you will get RPMs out of the equation).
    Two things come to mind, what are you trying to measure (i.e. what are the limits of your measurements)?. For example, on a 4MHz clock, the COUNT function has a 25kHz max frequency. This should be enough to measure 150,000RPM with your 100mS gate (if I did the math correct). By the same token the minimum you could measure would be 600RPM, and your resolution would be 600RPM (or 1 count). To achieve better resolution you have to sample longer (i.e. 1s, 10s, etc.). Problem is that if your maximum RPM is very high you are quickly getting into 32bit numbers. As it is 150,000RPM (rocket anyone?) will require an 18bit number.
    Within reason, you could sample longer and get better results (since, in my mind, you may be sampling 1,000 to 20,000RPM). What other people have done is use the PULSIN function to measure one pulse (assumption made -> 50% duty cycle), you could even average a few pulses to get a more stable measurement (I would use a median-type filter/average). I've attached a few links of examples:

    http://list.picbasic.com/forum/messages/4011/4360.html
    http://list.picbasic.com/forum/messages/20/1045.html

    Now lets try to tackle your problem at hand. You say that your numbers are jumping all over the place:
    1. Do you look at the 'counts' number or the 'RPM' number? I presume you have declared both as WORDs. The 'counts' number is a better indicator of your measurement since the 'RPM' could overflow a WORD variable.
    2. How is the sensor information applied to the COUNT pin? I am sure you need some signal conditioning before applying this signal into the PIC since you may have double-counts or things of that nature (i.e. of analog nature).
    </ul>

    Hope this leads you to some answers (more likely more questions - that's almost always the case, but then how would you learn if it were not for the questions).
    Last edited by languer; - 8th March 2004 at 20:40.

Similar Threads

  1. PortA Doesn't Work
    By Melanie in forum FAQ - Frequently Asked Questions
    Replies: 11
    Last Post: - 8th September 2015, 19:41
  2. Replies: 5
    Last Post: - 16th October 2009, 19:29
  3. 16F877a PORTA ADC and digital help
    By RFsolution in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 8th February 2008, 19:44
  4. PortA analog and digital IO
    By krohtech in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 30th November 2007, 03:25
  5. Can anyone help a beginner in a struggle?
    By douglasjam in forum mel PIC BASIC
    Replies: 1
    Last Post: - 6th May 2005, 00:29

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