In SX Microcontrollers, SX/B Compiler and SX-Key Tool, Hollov wrote: Hi Bean, Here is my code: ' ------------------------------------------------------------------------- ' Device Settings ' ------------------------------------------------------------------------- DEVICE SX52, OSCXT2 FREQ 4_000_000 ID "SX_MFG" ' ------------------------------------------------------------------------- ' IO Pins ' ------------------------------------------------------------------------- PLL_IN VAR RB.6 ' Clock for PLL input SQR_IN VAR RC.3 ' Square wave input from wave form gen. MUL_OUT VAR RC.2 ' Multiplyer output for PLL ' ------------------------------------------------------------------------- ' Constants ' ------------------------------------------------------------------------- ' ------------------------------------------------------------------------- ' Variables ' ------------------------------------------------------------------------- ' ------------------------------------------------------------------------- INTERRUPT ' ------------------------------------------------------------------------- ISR_Start: ' ISR code here ISR_Exit: RETURNINT ' {cycles} ' ========================================================================= PROGRAM Start ' ========================================================================= ' ------------------------------------------------------------------------- ' Subroutine Declarations ' ------------------------------------------------------------------------- ' ------------------------------------------------------------------------- ' Program Code ' ------------------------------------------------------------------------- Start: ' initialization code here TIMER1 CLEAR TIMER2 CLEAR OUTPUT PLL_IN ' Set PLL_IN output INPUT SQR_IN ' Set Square wave input OUTPUT MUL_OUT ' Set Multiplyer output TIMER2 EXTERNAL ' Set TIMER2 into external mode Main: ' main code here TIMER1 PWM,2000,4000 ' Set 1kHz onto PLL_IN output ' Set 500Hz onto MUL_OUT TIMER2 R2,1 ' Set loop counter value 1 TIMER2 R1,1 ' Set loop counter value 1 END It is very interesting, I got pulses on the RC.2 if I wait about 1 minutes. I got the 500Hz square wave on this output but it has a very stange slip after some periods. I checked the input singnal onto the RC.3 pin, it has no any slip. Can it be coding problem? Or my HW is bad? I will attach the sreen shot of this 500Hz signal in a new topic. Regards Spiller ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=215089#m215232 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)