@Ariba
Tried your code and it works. Reviewed the P2 manual with the smart pin configs. your example was key to my understanding. Thanks
@Ariba said: The examples in the X-BandMotion Detector PDF just counts the frequency from the OUT pin. In Spin2 you can do something like that: CON _clkfreq = 160_000_000 XINPIN = 0 'X band input pin XENPIN = 1 'X band enable pin PUB main() | count pinstart(XINPIN, P_COUNT_RISES, clkfreq, 0) 'count input pos edeges for 1 second pinhigh(XENPIN) repeat repeat until pinr(XINPIN) 'wait until measurement period finished count := rdpin(XINPIN) 'read count debug("motion ",udec(count)," Hz") 'show result in debug terminal Andy
@Ariba said: The examples in the X-BandMotion Detector PDF just counts the frequency from the OUT pin. In Spin2 you can do something like that:
CON _clkfreq = 160_000_000 XINPIN = 0 'X band input pin XENPIN = 1 'X band enable pin PUB main() | count pinstart(XINPIN, P_COUNT_RISES, clkfreq, 0) 'count input pos edeges for 1 second pinhigh(XENPIN) repeat repeat until pinr(XINPIN) 'wait until measurement period finished count := rdpin(XINPIN) 'read count debug("motion ",udec(count)," Hz") 'show result in debug terminal
Andy
Comments
@Ariba
Tried your code and it works. Reviewed the P2 manual with the smart pin configs. your example
was key to my understanding.
Thanks