Shop OBEX P1 Docs P2 Docs Learn Events
Learning spin//PASM through discovery — Parallax Forums

Learning spin//PASM through discovery

IamretiredIamretired Posts: 56
edited 2011-07-26 15:49 in General Discussion
I am gradually learning to program the Prop in part by studying the objects created and shared by others. It is only when I have a need to actually use a program that this becomes frustrating. At a minimum authors should indicate to what pins external devices attach. There is one spin program named Frequency Meter.spin that says it monitors and reports the clock on a specified pin. I can neither figure out the pin nor find to what it reports. It is another learning opportunity!
John

Comments

  • ElectricAyeElectricAye Posts: 4,561
    edited 2011-07-26 14:49
    I guess Frequency Meter.spin is not supposed to be used all by itself. Instead, it's just an object that is being called up. Look at the files that accompany Frequency Meter.spin and you will see he uses a demo called "Test - VGA.spin" which calls up Frequency Meter.spin and provides a display of the data.

    I feel your pain, though. I wish people would comment their code better.

    http://obex.parallax.com/objects/256/
  • Dave HeinDave Hein Posts: 6,347
    edited 2011-07-26 15:49
    The pin number is passed as a parameter to the report method. It returns the measured frequency in units of Hertz. This routine uses waitpeq and waitpne, so it will stall if there is no activity on the specified pin.
Sign In or Register to comment.