Examples of talking to quad I2C device?

jglenn

Senior Member
I have a need to run a DAC5573 quad D/A converter from an 18X. I2C is new to me, but am studying the data sheet of the part and the PICAXE manuals. I have some examples of driving a single I2C part, I understand each device has an address. There is an internal code that selects each of the D/A. Not asking for the solution, but if there are any similiar examples out there, would love to see them. This part only comes in TSSOP, really tiny, but got it on a Schmart board today at work with hot air and paste. Wiring up to PICAXE tomorrow then trying to run.

http://focus.ti.com/lit/ds/symlink/dac5573.pdf

WHERE IS the I2C Tutorial Data Sheet they mention, have looked in all 3 manuals for it..
 
Last edited:

inglewoodpete

Senior Member
I had a quick look at the datasheet. Each chip has 4 DACs. Each chip has 4 external address lines. This allows 16 chips to connect to 1 i2c mater: 2 i2c wires and 4 address wires controlled by additional TTL outputs of the PICAXE.

4 x 16 = 64.

I used a series of TLC5620 chips (DIP version) to get more analogue outputs from a PICAXE.
 

hippy

Ex-Staff (retired)
WHERE IS the I2C Tutorial Data Sheet they mention, have looked in all 3 manuals for it..
For Programming Editor 5.2.2, from the Menu Bar, "Help", "PICAXE-18 Datasheets", fourth one up from the bottom of the list.

That's AXE110_I2C.PDF which you should also be able to find in the datasheet directory of where the Programming Editor was installed, usually -

C:\Program Files\Programming Editor\Datasheets
 

westaust55

Moderator
i2c device control

For Programming Editor 5.2.2, from the Menu Bar, "Help", "PICAXE-18 Datasheets", fourth one up from the bottom of the list.

That's AXE110_I2C.PDF which you should also be able to find in the datasheet directory of where the Programming Editor was installed, usually -

C:\Program Files\Programming Editor\Datasheets
I found that there are datasheets not in the PE datsheet folder/directory. IN fact I have downloaded and saved several more into the relevant PE directory.
If missing then download from:
http://www.rev-ed.co.uk/docs/axe110_i2c.pdf


wrt the DAC5573, the address lines that IWP mentions are labelled A0, A1, A2 and A3 in the DAC5573 quad D/A datasheet.
Not all of these are used to select the chip in the "normal" address byte but all 4 are used.

Only pins A0 and A1 are used in the address (first) byte as usually sent to an i2c device.
The address (first) byte as used in hi2csetup commands is 1 0 0 1 1 A1 A0 R/W so if a0 and a1 are both 1 then the address is %1011110

The other two address pins A2 and A3 are used as part of the extended addressing in the control byte register in the format A3 A2 L1 L0 X Sel1 Sel0 PD0.
See datasheet page 15 for a full explanation.



@IWP: my eduaction is lacking :eek:. Did not know the PICAXE had any analogue outputs.
I used a series of TLC5620 chips (DIP version) to get more analogue outputs from a PICAXE.
 
Last edited:

jglenn

Senior Member
Thanks guys, I will check into this today. Hippy: I am running ver. 5.1.5, should I upgrade now? Will the new version of the software load over the old one, or should it be uninstalled first?
 

westaust55

Moderator
Thanks guys, I will check into this today. Hippy: I am running ver. 5.1.5, should I upgrade now? Will the new version of the software load over the old one, or should it be uninstalled first?
Since you have a version at 5.0.0 or greater, you just need to run the patch to upgrade to V5.2.0.
 

jglenn

Senior Member
Pete: that chip looks interesting, good due to DIP case, but slower to run than i2c. I may try it.

I have the DAC hooked up to the 18X, and this program must be flawed. Not really sure how to solve this, my use of writei2c must be wrong. It seems set up to output data with an address pointer, but I just want to send 3 bytes to the chip.

The DAC needs 4 things to happen:

1. address byte
2. control byte
3. msb
4. lsb

The lsb is just a space keeper, the real data is in msb. So I sort of tried to do it with "immediate" data, it downloads to the 18X and runs, but all the DAC outputs are high at 5V. Which is bad, I tried to turn on #1 about halfway, and all are supposed to reset to zero when the chip is initialized. So I guess I don't have com. I am basic illiterate at this point, any suggestions?
:confused:

Code:
'2-11-09 DAC5573 test program

setfreq	m8
i2cslave	%10011110,i2cslow,i2cbyte		'config i2c
writei2c	0,(%11010000,%00010000,%00000000)	'ctrl byte, msb, lsb

loopx:	high 5					'turn on test led
		goto loopx
 

westaust55

Moderator
Since you are increasing the PICAXE speed to 8MHz, in the line:
i2cslave %10011110,i2cslow,i2cbyte ; config i2c

you need to change the keyword i2cslow to i2cslow_8

Note that these chips can operate at 400kHz so if you have no slow devices on the i2c bus you could use: i2cfast_8

In the absence of a schematic, I take it that you have all 4 address pins (A0, A1, a2 and A3) pulled high to +5V.


Then in the writei2c program line, try removing the location byte. That is, use:

writei2c (%11010000,%00010000,%00000000)
 
Last edited:

jglenn

Senior Member
Yes, those 4 pins are pulled high. I will have to try the changes after work, have to git to day job now. Thanks for help, West.
 

jglenn

Senior Member
Tried those changes, no help. It is dead. I am 99% sure my connections are good. This chip is hard to use. Difficult to solder. Talk to. Looking at alternatives. Here is last program tried:

Code:
'2-12-09 DAC5573 test program


i2cslave	%10011110,i2cslow,i2cbyte		'config i2c
writei2c	(%11010000)
writei2c	(%00010000)
writei2c	(%00000000)

loopx:	high 5					'turn on test led
		goto loopx
Oh yeah, I had the test Rled on output 4, one of the i2c pins, it was reducing the output voltage by 50%, so moved to 5. I can see the i2c pulses on the scope, but the chip doesn't hear them.
 

jglenn

Senior Member
Correction, it might be working. I poked around the pins with a dvm, found pin 5, Vref low was high, supposed to be ground. Resoldered, now all the output pins are low except for pin 1, Vout A, which reads .31V. I wrote %00010000 to output A, maybe that is right, getting out calculator! :D

Code:
'2-11-09 DAC5573 test program

i2cslave	%10011110,i2cslow,i2cbyte		'config i2c
writei2c	(%11010000,%00010000,%00000000)	'ctrl byte, msb, lsb

loopx:	high 5					'turn on test led
		goto loopx
 
Last edited:
Top