In SX Microcontrollers, SX/B Compiler and SX-Key Tool, Zoot wrote: [quote="Peter Verkaik"]I agree with Zoot. The clockstretching compiles into lines JNB SCLPIN,$ It is easy to turn this into a loop: MOV __PARAM4,#I2CTIMEOUT :loop JB SCLPIN,@:loopend DJNZ [url=__PARAM4.@:loop]__PARAM4.@:loop[/url] :loopend [/quote] Deja vu. Had this exact same discussion w/Bean et al some months ago. I used a similar code example for timeout as what you posted. I pointed out that many, many peripherals are essentially micro based, and in my experience, I have yet to find a micro based peripheral with hardware I2C that DOES not use clock stretching. However, there is not necessarily enough __PARAM registers to loop for timeout on clock stretching, so it may not be quite that simple. The reason is that depending on the I2CSPEED setting and the clock speed of the SX, more params get used for nested loops to delay time on the IC signals. ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=333732#m361227 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2009 (http://www.dotNetBB.com)