Thank Ken. Let you know the outcome tomorrow. I'm getting excited in this project. Hahaha... Thank for the encourgement. Nicholas ----- Original Message ----- From: "Ken Pergola" To: Sent: Friday, March 19, 2004 1:19 AM Subject: Re: [PIC]:I2C DAC test > Nicholas wrote: > > > Sorry for not explaining that. > > By adding the 'I2C_Address' parameter to your MAX517 function, I made it > more universal versus the way you coded it. Your code was not bad at all, > I'm just showing you a different perspective, that's all. > > In other words, you had hard-coded the I2C address so that only a MAX517 > with a slave device address of 0x2C would work. > By having your MAX517 function accept an 'I2C_Address' argument, I'm showing > you how you can accommodate up to 4 MAX517 devices on the I2C bus with one > function if you ever need future expansion. > > Be careful Nicholas, you did not use my exact example that I posted > yesterday. Somehow you changed my code. You need to add my original code > back in. > > My original reference was: > > I2C_Address &= 0xFE; // Coerce address byte to WRITE mode > > > The reference to 'I2C_Address &= 0xFE;' should have been written more > clearly as: > > I2C_Address = ( I2C_Address & 0xFE ); > > Both do the same thing -- just short-hand versus long-hand. > > The '&' is the bitwise AND operator. What this is doing is forcing your R/W > bit (bit 0) of your I2C address to be 0 without affecting the other 7 bits. > In this case, it is just defensive programming since you could have passed > in 0x59 (R/W bit = 1 = read) (correct 7-bit device address but incorrect > 8-bit I2C address). > > Nicholas, I think you are doing great so far -- keep up the good work and do > not give up. You'll be posting soon sharing your success with us. > > > Best regards, > > Ken Pergola > > P.S. Don't forget to make that change: I2C_Address = ( I2C_Address & 0xFE ); > > -- > http://www.piclist.com hint: The list server can filter out subtopics > (like ads or off topics) for you. See http://www.piclist.com/#topics > -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics