Shop OBEX P1 Docs P2 Docs Learn Events
Counting Pulses — Parallax Forums

Counting Pulses

ncc1702ncc1702 Posts: 1
edited 2007-08-21 05:33 in Propeller 1
Hi to all
I'm new to the Propeller Chip, [noparse][[/noparse]Used BS-II's for years]. I need to count a string of pulses, keeping
a running total and uploading the total every of often..
Now my pulse stream can very, from 6000 to 54000 per hour. The pulses have approx. 50% duty cycle.

I would [noparse][[/noparse]maybe] like some Debounce on the input.
With the BS-II I could use the "Button" Command....

Any Help or Direction would be much appreciated

Comments

  • Martin HebelMartin Hebel Posts: 1,239
    edited 2007-08-21 05:16
    There are probably many examples of using a Cog's internal counter to perform this, but one quick reference you can use it to download "BS2_Functions" from the object exchange. In that code you will find a function for COUNT that has code to configure the counter. You may either use BS2_Functions as an object or adapt that code to you own needs.

    In the code, the counter is reset to 0 (phsa) when called, but that's not really needed, you can keep it free-running between reading the accumulated value.

    -Martin

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    StampPlot - GUI and Plotting, and XBee Wireless Adapters- Close out on Adapters!
    Southern Illinois University Carbondale, Electronic Systems Technologies
  • Mike GreenMike Green Posts: 23,101
    edited 2007-08-21 05:33
    What do you want to do for debouncing? If you didn't need to debounce, you could just use a counter (CTRA/CTRB) in edge triggered mode to count the pulses with a total capacity of about 4 billion. Check out the application note (AN001) from the download section of the main Propeller webpage.
Sign In or Register to comment.