I’ve been trying during a couple days to communicate via I2C with this device, in order to control a 4-digit seven-segment module , but i have to recognise that I´m totally lost.
I’ve made a simple counter to check the communication, but it doesn’t work::
`local Segment = [63, 6, 91, 79, 102, 109, 125, 7, 127, 111];//7Segment leds [0 to 9]
local Dig1=0;
local Dig2=0;
local Dig3=0;
//CONFIGURE Address Y BITs Control
local Add =0x70; //[70,72,74,76]
local SubAd =0; //Sub Adress
local Ctrl_B= 0x76; //Control Bits
function Counter(){
Dig1++;
if (Dig1==10){
Dig1=0;
Dig2++;
if (Dig2==10){
Dig2=0;
Dig3++;
if (Dig3==10) Dig3=0;
}}
}
function Write(){
local SubAd_Data=format("%x %x %x %x %x",SubAd, Ctrl_B, Segment[Dig1], Segment[Dig2], Segment[Dig3]);
hardware.i2c12.write(0x70,SubAd_Data);
Counter();
imp.wakeup(1.0,Write);
}
hardware.i2c12.configure(CLOCK_SPEED_100_KHZ);
//MAIN
imp.configure(“Imp Contador”, [], []);
Write();`
I also tried other code, and doesn’t work neither:
hardware.i2c12.write(0x70,"\\x00\\x77");//turns on all the segments
But while I was changing the lenght of the data I could check with the oscilloscope that the lenght of the signal wasn´t changing. Why could be happening this?
I have to mark that the SAA1064 works at 5V, but I think that I have adaptated correctly the voltage logic of the IMP with the 4050B converter.
Do you find any mistake or know what could be happening?
The datasheet for the SAA1064 can be found here.