In SX Microcontrollers, SX/B Compiler and SX-Key Tool, JonnyMac wrote: [i]Credit where it's due: Peter Verkaik suggested this trick in the beta forum.[/i] A task gets called on a regular schedule but what if we want asymmetric output/behavior from the task? -- we can do it with [b]TASKS SUSPEND[/b]: [code]TASK FLASH_LED Led1 = ~Led1 ' toggle LED IF Led1 = IsOn THEN TASKS SUSPEND, 0, 19 ' on time is 20 ticks ELSE TASKS SUSPEND, 0, 79 ' off time is 80 ticks ENDIF ENDTASK[/code] If this task is called every 10ms then the LED on-time will be 200ms and the off-time 800ms. It takes one task tick to process the LED so the suspension value is decremented by one (I have verified this on a 'scope). ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=324389 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2009 (http://www.dotNetBB.com)