In SX Microcontrollers, SX/B Compiler and SX-Key Tool, Peter Van der Zee wrote: Hi Geek; To help you gain experience, and partly for fun and promoting a simple minded RTOS, I thought I would help you and write some code to do what I think you're trying to accomplish. The attached code is a schedule driven state machine that tests every 100 mSec for changing the on-time and off-time for the "heartbeat", as well as drives the beat in 100 mSec increments. Buttons rb.0, and rb.1 respectively decrease and increase the OFF duration, and buttons rb.2 and rb.3 respectively decrease and increase the ON duration. The LED drive output is rb.7 All quite simple really; the beat duration, it's on-time load value and it's off-time load value are all adjusted independently. Step through it with Guenther's simulator, and run it single step with she SX-Key to gain a full appreciation of what is going on. Then experiment to your heart's content! P.S. I have not yet run this code, but I believe it to be OK. I'll check it tomorrow when I get to my bench. Cheers, Peter (pjv) ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=88380#m104591 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2006 (http://www.dotNetBB.com)