Hpulsin


Closed Thread
Results 1 to 6 of 6

Thread: Hpulsin

  1. #1

    Default Hpulsin

    I have a pretty good handle on getting CCP pins to work right measuring incoming signals high and low times. PBP has HWPM and its pretty handy to use. Would it be hard to make a HPULSIN command? Instead of having to learn configs for the beginner that can be quite a pain in the ass and sometimes counterintuitive, I think a nice addition to the code library would be to have a HPulseIn routine where the user sets the max frequency and then when the routine is ran, a high and low time is sent to a variable.

    This would be nice so it is running in the background and when the routine is called all it does is move the CCP times into variables.

  2. #2
    Join Date
    Feb 2012
    Location
    PERTH AUSTRALIA
    Posts
    838


    Did you find this post helpful? Yes | No

    Default Re: Hpulsin

    i agree , if i read this correct , i had a need to measure using pulsin the low to high then high to low , pulsin will measure the low pulse but not the immediate high to low to high duration

    not all PICS have Hardware PWM . so the abilty to measure 2 pulse lengths at the same time would be VERY good

    something like this command

    pulsin1 pin , state , varable1 , varable2

    pin = input port
    State = If State is zero, the width of a low pulse is measured into varable 1, the duration of the following high pulse is held in varable2
    If State is One, the width of a High pulse is measured into varable 1, the duration of the following Low pulse is held in varable2
    If the pulse edge never happens or the width of the pulse is too great to measure, Var1 and var2 is set to zero.

    Varable 1 , Varable 2

    If an 8-bit variable is used, only the LSB of the 16-bit measurement is used. Pin may be a constant, 0 - 15, or a variable that contains a number 0 - 15 (e.g. B0) or a pin name (e.g. PORTA.0). The resolution of PULSIN1 is dependent upon the oscillator frequency. If a 4MHz oscillator is used, the pulse width is returned in 10us increments. If a 20MHz oscillator is used, the pulse width will have a 2us resolution. Defining an OSC value has no effect on PULSIN1. The resolution always changes with the actual oscillator speed

    Also note chances are that you want to measure the next pulse as well and command would allow for use of pulsin looking for one state change not 2 directly preceding the above pulsin1 command



    Possible ????????????????????

    regards

    Sheldon.

  3. #3
    Join Date
    May 2004
    Location
    NW France
    Posts
    3,611


    Did you find this post helpful? Yes | No

    Default Re: Hpulsin

    Hi, Sheldon

    Do you really think adding a new library function for 3 poor PBP commands is worth the effort ???

    Alain
    ************************************************** ***********************
    Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
    ************************************************** ***********************
    IF there is the word "Problem" in your question ...
    certainly the answer is " RTFM " or " RTFDataSheet " !!!
    *****************************************

  4. #4
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default Re: Hpulsin

    PBP 3 allows you to add User Command... do it and share
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  5. #5


    Did you find this post helpful? Yes | No

    Default

    Maybe I didn't explain it well enough. In case I didn't. What I am thinking is the HPulsin would only work on CCP pins. It would be just a quick clean intuitive way for people to measure frequency, duty cycle etc. I have no idea how Pulsin works behind the scenes and why it isn't as good as using the CCP technique.

    Instead of having to set up timers, prescaling, dealing with reseting overflows etc, HPulsin would have a couple defines like Max and Min Frequency (this would set up the prescaling) Then the HPulsin would have a couple parameters like measuring hi or low, where to store the data and then the data stored is converted to real time numbers. It would work in the background and not tie up code execution speed like Pulsin either.

    Look at it this way, HPulsin would free up alot of bandwidth on this forum that is used to explain how to use CCP pins too

  6. #6
    Join Date
    Feb 2012
    Location
    PERTH AUSTRALIA
    Posts
    838


    Did you find this post helpful? Yes | No

    Default Re: Hpulsin

    probably not , so many more import ones that can be added and needed

Members who have read this thread : 1

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