In SX Microcontrollers, SX/B Compiler and SX-Key Tool, robotworkshop wrote: Hello Kramer, Thanks for your comments! Hopefully this thread will help unravel what is going on and how to handle this issue. From everything i've read on the datasheet and Günther's book it appears that the timer register T1CNTA holds the masks to allow timer interrupts to be passed to the ISR. It looks like if bits 5 (T1CPIE), 2 (T1CMIE), and 0 (T1OVIE) are cleared (set to 0) then it should prevent any interrupts from TIMER1 being generated. I'm just wondering if I should proactively clear the same flags on TIMER2 even though I never touch that in my program. Any thoughts? Assuming I am correct about clearing the bits to disable timer interrupts I thought that right at the start of my program (after defining the pins and directions) that I can add the following code. This would be done before ever starting TIMER1 ASM MOV W,#$07 ' Select read register T1CNTA MOV M,W MOV !RB,W ' (Use !RC for T2) AND W,#$DA ' Clear bits 5, 2, and 0 MOV wrkVar,W ' move to temp variable MOV W,#$17 ' Select write register T1CNTA MOV M,W MOV W,wrkVar MOV !RB,W ' Write out the new value to config register (Use !RC for T2) ENDASM In the case above I would make sure that the wrkVar is in the current BANK so it wouldn't break. Can anyone confirm that the assembly code above looks correct? If this works is should be simple to embed in any SX/B program. If Interrupts will no longer get through in TIMER mode with the code above then that would be a valid method of turning off PWM. I won't be able to test anything on the real hardware until I get home this evening and hope to have a few new things to try by then. Robert ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=251534#m251996 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2008 (http://www.dotNetBB.com)