In SX Microcontrollers, SX/B Compiler and SX-Key Tool, bean wrote: If you are using the SX48 you can use one of the 16-bit counters. Otherwise an interrupt is probably the easiest. '-------------------------------- OutPin PIN RA.0 OUTPUT counter VAR Byte INTERRUPT 20000 ' 20000 = 50uSec INC counter IF counter = 40 THEN OutPin = 1 counter = 0 ELSE OutPin = 0 ENDIF RETURNINT ' ---------------------- or with the SX48 '----------------------- OutPin PIN RB.6 OUTPUT ' Must use pin RB.6 for Timer1 output TIMER1 PRESCALE, 1 ' 1:2 Prescale (timer counts @ 25Mhz) TIMER1 PWM, 1250, 50000 '----------------------- Bean. ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=157491#m157496 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)