Shop OBEX P1 Docs P2 Docs Learn Events
Next cog question — Parallax Forums

Next cog question

DiverBobDiverBob Posts: 1,108
edited 2008-04-12 10:47 in Propeller 1
I'm getting further along with the timer module but ran into a snag tonight. I attached the timer code (I used the Archive function this time). It is designed to run on a uOLED-96 with 3 NO buttons attached to pins 18, 19 and 20. The methods TimeLoop (the commented out version) and CheckFlags run just fine when I don't use cog2. But once I add cog2 it appears that TimeLoop is no longer running. I believe its because of how I need to address the variables in order to grab the values at the address and then make the appropriate update. I have been looking for an example but haven't run across one that seems to do the trick. edit - I just realized that cog is reading and updating the variables directly.... hmmmm, now I'm really confused, must be time to go to bed and try again tomorrow evening confused.gif

The thinking behind this setup is that cog always controls the button input and sets the flags when a button is pressed. Since this is a counter module, I want to set the counters up, move on to other displays and when I move back, just call up the current values from TimeLoop and initialize the displays. I know I haven't completed optimizing the code but my first pass is just to get everything working and then start looking for prettying it up.

Any help from the local experts is appreciated.

Bob

Comments

  • DiverBobDiverBob Posts: 1,108
    edited 2008-04-11 23:40
    I went back and re-read the manual and the forum on cogs and finally figured it out. I now have one cog dedicated to controlling button presses by setting flags that can be read by the various objects. Another cog is providing the timing for each of the timers.
    I just got in the stainless steel piezo switches (waterproof) so I will be swapping those in and seeing how well they work.

    Although no one had a direct answer for this particular question, the forum was helpful in my research for figuring out the solution.

    Thanks again!
  • Jesse DruehlJesse Druehl Posts: 25
    edited 2008-04-12 01:56
    Bob,

    Are those the ITW ActiveTouch switches? I am using those in a current work project. They work very well, I am using the npn open collector 24v version.

    - Jesse
  • DiverBobDiverBob Posts: 1,108
    edited 2008-04-12 10:47
    The switches are Schurter M-16 piezo N.O. I swapped one into the circuit last night and other than modifying the debounce code it works just like a mechanical switch. The switch is fully enclosed, only moves 0.002" for activation and is made of stainless steel so its good for water environments. Now I just have to design a water-proof housing for them and the circuitry.
Sign In or Register to comment.