Sparkfun 7segment display - i2c code

kolber

New Member
Hallo, i have Sparkfun 7segment Display https://www.sparkfun.com/products/11442

I have problem with communication i2c.
Have not please any experience?

Thaks Jan
 

nick12ab

Senior Member
It doesn't look like many people have interfaced this display with PICAXE before. All I found was this where a similar Sparkfun display was used in serial mode.

The i2c address to use with PICAXE is $E2.

Have you read the Basic Usage guide? Basically wherever it uses the Serial.write() command, you need to use hi2cout.

For example, this example:
Code:
Serial.write(0x01);  // Hex value for 1, will display '1'
Serial.write('2');   // ASCII value for '2', will display '2'
Serial.write(0x0A);  // Hex value for 10, will display 'A'
Serial.write('B');   // ASCII value for 'B', will display 'b'
becomes this on PICAXE:
Code:
hi2cout (0x01)        ;Hex value for 1, will display '1'
hi2cout ("2")        ;ASCII value for '2', will display '2'
hi2cout (0x0A)        ;Hex value for 10, will display 'A'
hi2cout ("B")        ;ASCII value for 'B', will display 'b'
The commands above are on individual lines to make it clearer. They can be combined onto a single line like this: hi2cout ($01,"2",$0A,"B")
Both $ and 0x mean hexadecimal.

At the beginning of your code, you need to use the hi2csetup command. Use hi2csetup i2cmaster,$E2,i2cslow,i2cbyte
 

kolber

New Member
Yes, now already it functions.
I used to work with address $71 and not with 8 bits $E2. There was error.
Thanks Nick12ab.
 

westaust55

Moderator
Many datasheets give a 7-bit slave address. When this is done, the. Slave adress is placed in the upper 7 bits of the PICAXE slave address value. The least significant bit (bit 0) is for the read /write but which the PICAXE firmware will set/clear as appropriate depending in whether you use Hi2cout or Hi2cin commands.
Occasionally a Datasheet gives two slave addresses as one for read and the second for write wherethe only different is the lsb.

Thus the $71 (%x1110001) given in the display Datasheet when inserted into the slave address becomes %1110001x or $E2.
 
Top