Shop OBEX P1 Docs P2 Docs Learn Events
How can I use waitpeq to achieve this? or is there another way? — Parallax Forums

How can I use waitpeq to achieve this? or is there another way?

ElectricAyeElectricAye Posts: 4,561
edited 2012-08-01 11:33 in Propeller 1
I'm trying to reduce power consumption by using waitpeq to pause code execution until either one of two pins goes low. But it seems that waitpeq AND's the pins, so what's the best way to go about doing this?

Basically I want something that kinda works like this:

waitpeq(Pin 27 goes low) OR waitpeq(Pin 28 goes low)

It seems like it should be easy to do, but I'm stumped this morning. Senility creeping in, I guess.

Comments

  • ElectricAyeElectricAye Posts: 4,561
    edited 2012-08-01 08:32
    Well, Electricaye, the best way to achieve what you want is to use waitpne. Duh!
  • Mark_TMark_T Posts: 1,981
    edited 2012-08-01 10:16
    Of course you only reduce the power consumption of the cog that's waiting - other running cogs take power (perhaps there's a way to stop them and restart them, perhaps there are no other cogs running). Also there is power consumed just because the clock is running fast (presume using crystal/pll?). The latter can be reduced greatly by switching to the RCSLOW clock source (however code runs very slowly until the clocks switch back). So if you want microsecond responsiveness this won't be possible, but if several milliseconds latency is permissible you can reduce power consumption to microamps this way if nothing else in the circuit uses power...
  • ElectricAyeElectricAye Posts: 4,561
    edited 2012-08-01 11:33
    Mark_T wrote: »
    ... Also there is power consumed just because the clock is running fast (presume using crystal/pll?). The latter can be reduced greatly by switching to the RCSLOW clock source ...

    Yes, excellent suggestion. That is next on my to-do list. Thanks!
Sign In or Register to comment.