Hello every one,
Using Arduino Uno, I am trying to program a Samsung I2C tuner based on the SN761672A pll synthesizer ic and I need considerable help. I appreciate every bit of view, suggestions, and efforts as I am on crossroads confusion and hope your contributions are rewarded in success and relief. The code shows how far I’ve reached.
I summarize my objectives in setting the tuner to function (plug and play) like analog. The hardware is almost comprehended, but the software is complicated.
- Be able to write the read/write bytes to control the IC.
- Correctly setting the bits and bytes of registers.
- Be able to read the frequency and write it to the tuner.
I understood there are two Read Bytes: the ADB address byte and the SB status byte. I tended to adopt the default suggested in Table 3, page 9.
The Write Bytes are five:
ADV(0xC0: 11000000), DB1(0), DB2(0), CB(0xCA:11001010), and BB different.
Based on my understanding of the explanation and description of symbols in the datasheet, I set these bytes as in the code.
The I2C control part in the SN761672A is in pages 9, 10, 11.
I need some help to configure the divider byte DB1 and DB2. I understood from page 9 table 3 the default value is 0??
Programmable counter set bits N=N14…..N0 is my blackout I need help please!
If I could set the tuner to the VHF_L, read the frequency on power up, write and display the value (set /scan the frequency), then I went far well.
//Samsung TECC0949PG35A(AA40-00076A) TV\CRT tuner with SN761672A tuner IC . 21.01.2024
#include <Wire.h>
//I2C Read mode
#define ADB 0x60//Address Byte, read 1
#define SB 0xB8// Status Bit
//I2C Write mode
#define ADV 0xC0 //11000000, Address Byte, write 0
#define DB1 0x0//00000000, 0x0
#define DB2 0x0//00000000, 0x0
#define CB 0xCA//11001010
#define BBL 0x1//00000001, Band Switch, Low
#define BBH 0x2// 00000100, Band Switch, high
#define BBU 0x8//00001000, Band Switch, ultra
long frequency;//default frequency after power up
long freq_set;// set or scan +/- increment, decrement
long IF_freq = 31900000;// IF frequency 31.9MHz
//VHF_L 48-180MHz BandI
//VHF_H 160-470MHz BandII
//UHF 430-860MHz BandIII
#define L_bandbegin 48;//48 MHz
#define H_bandbegin 160;//
#define U_bandbegin 430;//
#define L_bandend 180;//
#define H_bandend 470;//
#define U_bandend 860;//
int step_rate1 = 1000000;//1MHz steps
int step_rate2 = 500;//500kHz
int step_rate3 = 100;//100kHz
void setup()
{
Serial.begin(9600);
Wire.beginTransmission(0x60);// Address Byte ADB
Wire.beginTransmission(0xB8);//SB Status bit
Serial.println(0x60);
delay(200);
Serial.println(0xB8);
delay(200);
Serial.println(" 3_Band Tuner ");
delay(200);
write_data();
}
void loop()
{
}
void scan_freq()
{
//freq_set = up_frequency + 1// increase/ decrease frequency
// while button + pressed
//if freq_set >= H_bandend;
{
//freq_set = L_bandbegin;
}
}
void write_data()
{
Wire.beginTransmission(0x60);
Wire.write(ADV);
Serial.println(ADV);
Wire.endTransmission();
}