Shop OBEX P1 Docs P2 Docs Learn Events
SX/B count function — Parallax Forums

SX/B count function

Eric REric R Posts: 225
edited 2005-06-01 03:18 in General Discussion
Is there a way to perform the COUNT function in the SX/B? If not then what is similar?

Comments

  • BeanBean Posts: 8,129
    edited 2005-06-01 02:45
    Since SX/B only supports byte variables with a maximum value of 255, COUNT would be very limited.
    If the signal is consistant you can use PULSIN which will give the width of the pulse. From that you can determine how many pulses would occur in a certain time period.
    Bean.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    "SX-Video·Module" Now available from Parallax for only $28.95 http://www.parallax.com/detail.asp?product_id=30012


    Product web site: www.sxvm.com

    "It's not getting what you want, it's wanting what you've got."
    ·
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-06-01 02:47
    As Bean suggests, you could use PULSIN to measure the high portion of the pulse, the another PULSIN to measure the low portion. From this you could derive the period and work out the count.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • Eric REric R Posts: 225
    edited 2005-06-01 03:18
    I will need to give another look at PULSIN. My count input for 100ms would never exceed 70 so count would fit well into the 255. Since my signal is linear in relationship to shaft speed, I·think that PULSIN could work. I am just not as comfortable with it as I am COUNT.

    I assume that PULSIN is the best and only way to input / calculate·shaft speed?
Sign In or Register to comment.