FLPROG+Qwen2,5-Max

Brand2
Лейтенант
Сообщения: 450
Зарегистрирован: 26 фев 2018, 21:27
Откуда: Haifa
Имя: Alex
Благодарил (а): 2 раза
Поблагодарили: 5 раз

Re: FLPROG+Qwen2,5-Max

Сообщение Brand2 »

Naladchik,я скинул ему описание регистра и вот ответ
The table you provided appears to describe the Control Register for a device with a slave address of 82H . This register is used to configure or control specific functionalities of the device. Let's break down the information:

Control Register Table (SLAVE ADDRESS = 82H)
Function
Volume (bits 7-2)
MUTE (bit 1)
AGC (bit 0)

Explanation of Each Bit:
Bits 7-2: Volume
These bits control the volume level of the device.
The volume is represented by a 6-bit value, meaning it can take values from 0 to 63 (binary 000000 to 111111).
Higher values correspond to higher volume levels.
Bit 1: MUTE
This bit controls the mute functionality :
0: Mute is disabled (audio output is active).
1: Mute is enabled (audio output is silenced).
Bit 0: AGC
This bit controls the Automatic Gain Control (AGC) :
0: AGC is disabled (manual gain control is used).
1: AGC is enabled (automatic adjustment of gain based on input signal).
How to Use the Control Register:
To configure the device, you would write an 8-bit value to the control register at the slave address 82H. Here's how you can construct the value:

Volume (bits 7-2):
Decide the desired volume level (0–63).
Shift this value left by 2 bits to position it in bits 7-2.
MUTE (bit 1):
Set this bit to 1 if you want to mute the audio, or 0 otherwise.
AGC (bit 0):
Set this bit to 1 to enable AGC, or 0 to disable it.
Example Calculations:
Example 1: Set Volume to 30, Enable MUTE, Disable AGC
Volume = 30 → Binary: 011110
MUTE = 1 → Binary: 1
AGC = 0 → Binary: 0
Combine these into an 8-bit value:


#include <Wire.h>

#define SLAVE_ADDRESS 0x82 // Slave address in hexadecimal

void setup() {
Wire.begin(); // Initialize I2C communication
}

// Function to write to the control register
void writeToControlRegister(byte volume, bool mute, bool agc) {
byte controlValue = 0;

// Construct the control value
controlValue |= (volume << 2); // Shift volume to bits 7-2
controlValue |= (mute << 1); // Set MUTE bit
controlValue |= agc; // Set AGC bit

// Write the value to the control register
Wire.beginTransmission(SLAVE_ADDRESS);
Wire.write(controlValue);
Wire.endTransmission();
}

void loop() {
// Example: Set volume to 30, enable MUTE, disable AGC
writeToControlRegister(30, true, false);

delay(1000); // Wait for 1 second
}



Key Notes:
I2C Communication:
Ensure that the device is connected correctly to the I2C bus (SDA and SCL pins).
Use the correct pull-up resistors (typically 4.7kΩ) on the I2C lines.
Volume Range:
The volume range is limited to 6 bits (0–63). Values outside this range will cause incorrect behavior.
Testing:
Test different configurations (e.g., enabling/disabling MUTE and AGC) to ensure the device behaves as expected.
Naladchik
Капитан
Сообщения: 908
Зарегистрирован: 04 окт 2015, 19:10
Откуда: Новосибирск
Имя: Павел
Благодарил (а): 20 раз
Поблагодарили: 22 раза

Re: FLPROG+Qwen2,5-Max

Сообщение Naladchik »

Brand2 писал(а): 03 фев 2025, 15:50 Naladchik,я скинул ему описание регистра и вот ответ...
Теперь если собрать в кучу предыдущий код и этот то в теории может даже и получится поуправлять громкостью.
Только полноценный код для управления этой микрухой таким способом получить, на мой взгляд, если и вероятно то весьма не скоро. Быстрее самому разобраться.
Win10-64. FLProg Portable.
Изображение
Ответить

Вернуться в «А что так можно было, да?»

Кто сейчас на конференции

Сейчас этот форум просматривают: нет зарегистрированных пользователей и 3 гостя