In SX Microcontrollers, SX/B Compiler and SX-Key Tool, Peter Van der Zee wrote: Hi Bebop; You are wiggling the port bit by alternately making it an input and then an output. That is not the correct way to do things. Write your code to make port ra.1 an output only once, and the make that output alternately be high or low. There are many ways to accomplish that, one simple way (not the best way) is included. SetDir mov m,#$0f ;set mode to access tris direction registers mov w,#%1111_1101 ;port bit 1 mov !ra,w ;make port ra.1 be an output, all others remain input Waves setb ra.1 ;set port a.1 high mov w,#$10 ;delay value mov Delay,w ;load the delay counter Delay1 decsz Delay ;loop until jmp Delay1 ;delay is done nop ;time adjust for end of cycle "jump" nop ;time adjust for end of cycle "jump" nop ;time adjust for end of cycle "jump" clrb ra.1 ;reset port a.1 mov w,#$10 ;delay value mov Delay,w ;load the delay counter; can be same variable as before because only one is running at a time Delay2 decsz Delay ;loop until jmp Delay2 ;delay is done jmp Waves ;the jump consumes 3 instruction cycles Hope this helps. Cheers, Peter (pjv) ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=107862#m107978 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)