Shop OBEX P1 Docs P2 Docs Learn Events
PropBasic Counter question. — Parallax Forums

PropBasic Counter question.

How do I simply set the counters to accumulate POS pulses?

This page of the manual is blank.

Cheers!

Comments

  • kwinnkwinn Posts: 8,697
    Here is the application note and example code (AN001) for using the counters.

  • BeanBean Posts: 8,129
    Check out page 45.

    Let me know if you need more info.

    Bean
  • Thanks guys, I already have all of the above

    Do I understand this correctly?

    COUNTERA mode{, apin {, bpin{, frqx{, phsx}}}}

    mode = 80 (pos edge detection)
    apin = 7 (the pin I want to count)
    bpin =0 (not using)
    frqx = 1 (the increment value ?????)
    phsx = 0 (the initial setting of the counter???)

    So, at any time in my code, PHSA can be referenced to determine how many pulses have occurred?

  • kwinnkwinn Posts: 8,697
    Mickster wrote: »
    Thanks guys, I already have all of the above

    Do I understand this correctly?

    COUNTERA mode{, apin {, bpin{, frqx{, phsx}}}}

    mode = 80 (pos edge detection)
    apin = 7 (the pin I want to count)
    bpin =0 (not using)
    frqx = 1 (the increment value ?????)
    phsx = 0 (the initial setting of the counter???)

    So, at any time in my code, PHSA can be referenced to determine how many pulses have occurred?

    Correct.
  • Bean, where can the 1.43 executable be obtained? I've looked far and wide but can only conjure up 1.42. The 1.43 pdf you just posted is new to me and has a couple of things documented and/or new that are interesting. STACK, I2CSPEED and documentation of the SERIN timeout, label parms for example,based on a super quick speed read of said doc.
    As always, thank you for PropBasic, it's fantastic for quick, fast prototyping of ideas for sure!

    -Mike
  • I can't find a 1.43. 1.42 is the last I downloaded on 9/15/2015.
  • BeanBean Posts: 8,129
    edited 2015-11-29 18:26
    I don't think I've posted version 1.43, but there is no additional instructions.
    Only some optimizations.
    I'm actually up to version 1.44, but there are still some things I want to improve.
    Version 00.01.43
      Changed SERIN so it doesn't wait for stop bit
      Optimize Divide and remainder operation [June 27,2014]
    ----------------------------------------------------------------------------
    Version 00.01.44
      Made PAUSE a subroutine
      Made *, */, **, /, and // operators subroutine
      Optimized COUNTERx if bpin is -1 no instruction is generated
      Optimized var = -shortIntConst to NEG var,#shortIntConst
    ----------------------------------------------------------------------------  
    

    Bean
  • Thanks, Bean, I'm looking forward to your optimizations.

    -Mike
Sign In or Register to comment.