I recently purchased the MCP4725 breakout and I am trying to interface an MCP4725 via a linux I2C driver. The datasheet figure 6.2 shows the address as
1100 A2 A1 A0 rw.
The manual also states that A2=A1=0 for the non-custom version and I have A0 tied to ground. I am trying to do a WRITE operation. So-I would expect the first byte written should be
1100 0000 e.g an address byte of 0XC0.
I get no response when I do this. In a fit of frustration I wrote a loop to try all addresses and found that the device does respond to 0x62 and 0x63. Perhaps the address should be shifted (why?) and perhaps they ICs are not all shipped with A2,A1=00. (Does anyone know if the adafruit part has set A1 and A2 to other that 0?) Even when the device does respond I cannot set an output voltage with subsequent writes. Has someone out there written code that drives these devices so I can check my addressing and parameter byte coding? My simple code is:
buf[0] = 0x62; //set address and write mode
buf[1] = 0x40; //normal speed operation, no powerdown
buf[2] = 0xFF; //data to voltage
buf[3] = 0xF0; //data to voltage
ioc = ioctl(file, I2C_SLAVE, buf[0]);
wtrc = write(file, buf, 4);
Thanks for any ideas
Fritz
Addressing MCP4825
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: Addressing MCP4825
The adafruit module responds to 0x62 and 0x63. That is a 7-bit address. The read/write bit is the eighth (low order) bit, so you need to shift the address left by 1 bit and then set the read/write bit. So you should be using 0xC4 as your write mode address.
- fsonnichsen
- Posts: 20
- Joined: Mon Aug 26, 2013 4:44 pm
Re: Addressing MCP4825
OK and thanks. I have since found that I was not so send the address in the 4 buf bytes-apparently Linux already does this in iocntl. So I chopped off the buf[0] and send only 3 bytes. It works now with and address of 62. I guess the "write' command sets the write/zero bit in the address frame. The linux doc that I found is a little fuzzy on this. Now the code looks like so:
buf[0] = 0x40;
buf[1] = 0x00;
buf[2] = 0x00;
wtrc = write(file, buf, 3);
At any rate all is well and I appreciate your help!
thanks,
Fritz
PS-I note that you are in Buffalo NY---got my degree up there 40 years ago.
buf[0] = 0x40;
buf[1] = 0x00;
buf[2] = 0x00;
wtrc = write(file, buf, 3);
At any rate all is well and I appreciate your help!
thanks,
Fritz
PS-I note that you are in Buffalo NY---got my degree up there 40 years ago.
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: Addressing MCP4825
UB? We were there at the same time
- fsonnichsen
- Posts: 20
- Joined: Mon Aug 26, 2013 4:44 pm
Re: Addressing MCP4825
Wow! -I was there 72-75. I was a chem/physics major.
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: Addressing MCP4825
I was a Bio major, 72-77. Took an extra year after I discovered computers...
- fsonnichsen
- Posts: 20
- Joined: Mon Aug 26, 2013 4:44 pm
Re: Addressing MCP4825
Ha-so you can tell me how to interface an Arduino to a CDC6400? Viva La Control Data Corp. Every once in a while an old keypunch card falls out of one of my old physics books and flutters to the floor. Probably should send them to the Smithsonian! I can't even remember where the computer was on campus-I spent most of my time in Acheson to my recollection. There and all the joints on Bailey avenue (;->
So I have the Adafruit mounted ADC (ADS1115) working now. I am using a Technologics TS7600 and chose I2C to save pins. I hate SOT and we are lucky that ada solders up a few for us guys who have outlived their eyesight. Heck-I started on vacuum tubes when I was a kid
cheers
Fritz
So I have the Adafruit mounted ADC (ADS1115) working now. I am using a Technologics TS7600 and chose I2C to save pins. I hate SOT and we are lucky that ada solders up a few for us guys who have outlived their eyesight. Heck-I started on vacuum tubes when I was a kid
cheers
Fritz
- adafruit_support_rick
- Posts: 35092
- Joined: Tue Mar 15, 2011 11:42 am
Re: Addressing MCP4825
Ah, the 6400! 60-bit words! It was on the Ridge Lea campus. I know a guy who's now running a web business out of the same building. I pointed out where the keypunches were: it's his main office area now.
I've still got an acoustic modem someplace. Should be able to use that to interface the Arduino through a MAX232 chip. Piece of cake! Well, except I'd need a phone that would fit in the modem... Rats!
I've still got an acoustic modem someplace. Should be able to use that to interface the Arduino through a MAX232 chip. Piece of cake! Well, except I'd need a phone that would fit in the modem... Rats!
Please be positive and constructive with your questions and comments.