Chris,
There is some redundancy in this code that I was using for testing, as you will notice. I was just playing around with the brightness on this last test, which was the last I saved.
I think if you get this working you'll have an understanding of the process of writing to it. I was using a I2C display from MicroResearch which I purchased from Gravitech, using a 3 AA pack for powering the display with a common ground on the mbed.
I really like I2C now and will be using it for as much IO as possible. I really would love to find a US source for some inexpensive breakout boards for I2C stuff. It would be cool to use the SAA1064 chip for 32 individual LED's, which is possible as each it bit addressable.
Also it would be cool if I could extend the mbed I2C code because there is a lot of single byte writing and reading that makes the existing interface a bit cumbersome. With I2C, programming peripheral devices is a breeze.
-Johnnie
#include "mbed.h"
I2C i2c(p28,p27);
const char SS[10] = {63,6,91,79,102,109,125,7,127,111};
int main() {
char cmd[7];
while (1) {
int i;
for (i=1 ; i<8 ; i++) {
cmd[0] = 0; // instruction byte
cmd[1] = 0x17; // control byte 0x10,0x20,0x40 for brightness
cmd[1] = 0x77; // all segments turned on for test
cmd[1] = i * 16 + 0 + 4 + 2 + 1;
cmd[2] = SS[i]; // rightmost digit segments
cmd[3] = SS[i]; //
cmd[4] = SS[i]; //
cmd[5] = 128; // leftmost digit segments
i2c.write(0x70,cmd,6);
wait(1);
}
}
}
I have been playing around with a TMP175 using the mbed I2C read function and can easily get a temperature reading.
I would like to do some writing and reading the configuration and high and low temperature registers but cannot find an example after a long Google search.
Does anyone have an example using this device or can someone create a list of the byte codes for the following read/writes? I have the data sheet for the TMP175 so the individual bit settings are no problem, just a general example will be helpful.
config
low temp
high temp
I found some examples for I2C writing to an SAA1064 display driver so I have some familiarity with writing to I2C devices now.
-Johnnie
(enjoying the day - mbed!)