In SX Microcontrollers, SX/B Compiler and SX-Key Tool, sirnfs wrote: Hello, I am trying to communicate with a CMOS image sensor via I2C. The image sensor uses a serial format called SCCB, which is identical to I2C as far as I can tell. The SCCB data sheet can be found here: [url=http://www.ovt.com/pdfs/ds_note.pdf]http://www.ovt.com/pdfs/ds_note.pdf[/url] I am using the SX52 as well as SX/B. I have attempted to troubleshoot the code with the Debugger using the SX Key oscillator, but I am not even sure that this is possible (timing issues?). The code is shown below. Note: (2) 4.7 kohm pull-up resistors are being used on the SDA pin (RE.0) and SCL pin (RE.1). I have also noticed what seems to be some sort of contention. When I attempt to enter Debug mode, the programming process will freeze. To get rid of this problem, i power-down the SX52 and then reapply power. I realize that there it is not possible to test this code, but I would appreciate if anyone could take a look at the code or possibly comment on a solution. Thanks, Mike ' ------------------------------------------------------------------------- ' Device Settings ' ------------------------------------------------------------------------- DEVICE SX52, OSCHS3 IRC_CAL IRC_SLOW FREQ 5000000 PROGRAM start_point ' ------------------------------------------------------------------------- ' Variables ' ------------------------------------------------------------------------- Ack CON 0 Nak CON 1 SDA CON "RE.0" Recv VAR bit tmp VAR byte tmp2 VAR byte sndcode CON $C0 regnum CON $1C sndcode2 CON $C1 ' ------------------------------------------------------------------------- ' Program Code ' ------------------------------------------------------------------------- start_point: I2CSTART SDA ' start transmission I2CSEND SDA, sndcode ' send id address I2CSEND SDA, regnum, Recv ' send sub-address I2CSTART SDA ' restart new transmission I2CSEND SDA, sndcode ' send id address again I2CRECV SDA, tmp2, Nak ' receive data from slave I2CSTOP SDA ' stop transmission __RAM($1F) = tmp2 ' store received data to RAM BREAK SLEEP ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=95603 Need assistance? Send an email to the Forum Administrator at forumadmin@parallax.com The Parallax Forums are powered by dotNetBB Forums, copyright 2002-2005 (http://www.dotNetBB.com)