In SX Microcontrollers, SX/B Compiler and SX-Key Tool, bean wrote: Joe, Here is a program that does what you were trying... [code] DEVICE SX48,OSCHS1 FREQ 50_000_000 ' Connect RB.6 to RC.3 to connect the output of Timer1 to the clock of Timer2 ' Should generate an interrupt every 3 seconds. AFlag VAR Bit WATCH AFlag,8,UDEC INTERRUPT GOSUB DoSomething TIMER2 CLEAR RETURNINT PROGRAM Start DoSomething: BREAK AFlag = ~AFlag ' Toggle AFlag value RETURN Start: LVL_B=%00000000 LVL_C=%00000000 PLP_B=%01000000 PLP_C=%00000111 TRIS_B=%10111111 'RB.6 is an output TRIS_C=%11111000 RC=%00000000 AFlag=1 ' Set flag initially to 1 ' Setup TIMER 2 T2CNTA=%00000100 'Interrupt on compare TIMER2 EXTERNAL 'Timer 2 external exvent mode TIMER2 R1, $08F0 'Interrupt when count is $08F0 or 2288 TIMER2 CLEAR 'Clear timer 2 ' Setup TIMER 1 TIMER1 PWM, $8000, $FFFF 'Timer1 PWM mode ON for $8000 counts, period = $FFFF counts Main: GOTO Main END [/code] Bean. ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=138101#m139103 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)