In SX Microcontrollers, SX/B Compiler and SX-Key Tool, Sparks-R-Fun wrote: datacps, To address your scaling question: on the low frequency end at 40Hz you are going to need 40 * 2 = 80 signal transitions per second. If you are using a square-wave signal, that will require each transition to have a duration of 1 / 80 = 0.0125 seconds or 1.25ms. The time standard for the PULSEOUT command is in microseconds so your maximum delay value will be 1.25 * 100 = 125us. A high frequency of 400Hz requires 400 * 2 = 800 signal transitions per second. Assuming a square-wave signal, that will require each transition to have a duration of 1 / 800 = 0.00125 seconds or 0.125ms. This is equal to 0.125 * 100 = 12.5us. You will have to decide whether to round to 12 or 13us with this approach. Now for the encoder handling. It looks to me like you have [B]TWO places[/B] that are trying to adjust the value of Delay based upon the encoder movement! I think that surely you should only have one. Either remove the encoder handling in the interrupt (not my first choice) or else remove the "FUNC GetEncoder1" and "SUB UpdateEncoders" sections and their references. They seem to be trying to accomplish the same task and are likely conflicting with each other. If you can get the encoder to alter the Delay value it should then be a fairly easy task to apply an appropriate scale factor to it. Let me know if this helps get the encoder working. - Sparks ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=226156#m229432 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2007 (http://www.dotNetBB.com)