Am 06.11.2010 17:31, schrieb Kirk Wallace: > On Sat, 2010-11-06 at 08:43 -0700, Kirk Wallace wrote: > >> Hello. I need to write a base thread component that does something based >> on the start of the servo thread (strobe AVR data lines). For example, I >> could have a base thread component that increments a counter. On the >> third count, do foobar, reset the counter and wait for the next servo >> thread start. I was thinking I could use the charge_pump component, but >> it toggles the output, so I would reset on every other servo period. I >> would also need to remember that charge_pump would need to be loaded. Is >> there a cleaner way to do this? Would having two functions, one in each >> thread, within the component add anything, compared to using >> charge_pump? Thanks. >> >> Hi Kirk Two possible solutions for you:
first: Do you run ladder logic? if so, on wich thread? if it's the servo thread, you could use ladder counters and flip a pin. else you could write a comp module running in servo_thread wich counts and emits a pin. this pin you can use "rising edge" in the base thread to start your foobar rising edge means, you compare current status to last and only do foobar if last was 0 and now it is 1 second: you could write a comp module with two functions and a global counting var. one decrements the counter each time it is called, the other returns until count is zero and then it runs foobar and resets the counter then you addf this functions to base_tread and servo_thread. bye ulf ------------------------------------------------------------------------------ The Next 800 Companies to Lead America's Growth: New Video Whitepaper David G. Thomson, author of the best-selling book "Blueprint to a Billion" shares his insights and actions to help propel your business during the next growth cycle. Listen Now! http://p.sf.net/sfu/SAP-dev2dev _______________________________________________ Emc-users mailing list Emc-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/emc-users