In SX Microcontrollers, SX/B Compiler and SX-Key Tool, verobel wrote: Fellow sx/b coders; I am trying to learn SX/B and have run some examples by others successfully but.. I wired up a 2 digit 7 seg. lcd on the PDBoard and initially got it to count from 0 to 99 in a loop. Next I added 2 I2C chips DS1621 (no examples available) and 24LC64 (some examples available). In the current program TempDI2.SXB I am trying to display the temperature but get -5 when I expect ~22 The new code (added to the previously working program) is shown below. The full program listing is attached. Main: DO tempC = GET_TEMP tens = tempC / 10 ones = tempC // 10 ... ' Subroutine Code ' ------------------------------------------------------------------------- ' GET_TEMP ' gets temp from DS1621 using I2C commands ' USE: temp = GET_TEMP GET_TEMP: I2CSTART SDA I2CSEND SDA, addrW ' prepare for convert command I2CSEND SDA, cmdConv ' request convert 1 temp. sample I2CSEND SDA, addrR ' prepare for readTemp command I2CRECV SDA, tempIn_MSB, Ack ' read the 2 bytes I2CRECV SDA, tempIn_LSB, Nak I2CSTOP SDA RETURN tempIn_MSB ' ignore 1/2 deg LSB for now Could some one confirm if the I2C sequence of commands is good. Could some one spot any obvious error in my SX/B code that would explain the wrong output -5 on the display? I believe the wiring is good: have Ra.0=SDA 1621.1, Ra.1=SCL 1621.2 both with 4.7k pullup resistors. A0=1 (5V), A1=0,A2=0 Thanks, John ---------- End of Message ---------- You can view the post on-line at: http://forums.parallax.com/forums/default.aspx?f=7&p=1&m=224309 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)