Тема: M62446

Пожалуйста создайте скетч

2

Re: M62446

http://forum.rcl-radio.ru/uploads/images/2024/10/83262b0da4f6d3e3fc94fc9a2df7c14f.jpeg

3

Re: M62446

У Вас есть в наличии эта микросхема? Плата собрана?

4

Re: M62446

Да есть брат

5

Re: M62446

Палата собран

6

Re: M62446

Уточните у Вас M62446FP или M62446AFP?

7

Re: M62446

Тестирование, нужно проверить работает ли скетч, регулируется ли тембр, громкость по всем 6 каналам.

M62446FP

#define LATCH   2
#define DATA    3
#define CLOCK   4

void setup() {
  Serial.begin(9600);
  pinMode(LATCH, OUTPUT);
  pinMode(DATA, OUTPUT);
  pinMode(CLOCK, OUTPUT);
}

void loop() {
  byte_1(5,0b0000,5,0);// treb -5...5, port 0b0000, bass -5...5, bypass = 0
  byte_2(0,0);// 0...79 = 0...-79 dB
  byte_3(0,0);// 0...79 = 0...-79 dB
  byte_4(0,0);// 0...79 = 0...-79 dB
  delay(1000);

}

void byte_1(int treb, byte port, int bass, bool by_pass){
  // treb int -5...+5 === -10...+10 dB
  // bass int -5...+5 === -10...+10 dB
  // byte port 0b0000....0b1111
  // by_pass  === 0 TONE | 1 BYPASS 
  switch(treb){
    case -5: treb = 0b1110;break;
    case -4: treb = 0b1100;break;
    case -3: treb = 0b1011;break;
    case -2: treb = 0b1010;break;
    case -1: treb = 0b1001;break;
    case  0: treb = 0b0000;break;
    case  1: treb = 0b0001;break;
    case  2: treb = 0b0010;break;
    case  3: treb = 0b0011;break;
    case  4: treb = 0b0100;break;
    case  5: treb = 0b0110;break;
    }
  switch(bass){
    case -5: bass = 0b1110;break;
    case -4: bass = 0b1100;break;
    case -3: bass = 0b1011;break;
    case -2: bass = 0b1010;break;
    case -1: bass = 0b1001;break;
    case  0: bass = 0b0000;break;
    case  1: bass = 0b0001;break;
    case  2: bass = 0b0010;break;
    case  3: bass = 0b0011;break;
    case  4: bass = 0b0100;break;
    case  5: bass = 0b0110;break;
    }  
  unsigned int data_byte = (treb<<12)|(port<<8)|(bass<<4)|(by_pass<<2)|0b00;
  writeByte(data_byte);  
  }

void byte_2(int vol_l, int vol_r){
  // int vol 0...79 === 0...-79 dB
  unsigned int data_byte = (vol_l<<9)|(vol_r<<2)|0b01;
  writeByte(data_byte); 
  }  
void byte_3(int vol_c, int vol_sw){
  // int vol 0...79 === 0...-79 dB
  unsigned int data_byte = (vol_c<<9)|(vol_sw<<2)|0b10;
  writeByte(data_byte); 
  }  
void byte_4(int vol_sl, int vol_sr){
  // int vol 0...79 === 0...-79 dB
  unsigned int data_byte = (vol_sl<<9)|(vol_sr<<2)|0b11;
  writeByte(data_byte); 
  }    

void writeByte(uint16_t data){
  for (int i = 15; i >= 0; i--){
    digitalWrite(DATA, (data >> i) & 1);delayMicroseconds(3);
    digitalWrite(CLOCK, HIGH);delayMicroseconds(3);
    digitalWrite(CLOCK, LOW);delayMicroseconds(3);
    Serial.print((data >> i) & 1);
  } 
    Serial.println();
    digitalWrite(LATCH, HIGH);delayMicroseconds(1);
    digitalWrite(LATCH, LOW);delayMicroseconds(3);
}

8

Re: M62446

У меня M62446AFP хорошо позже буду тестировать

9

Re: M62446

http://forum.rcl-radio.ru/uploads/images/2024/10/7034cb5be3f7c56fa8a81c7ae1bbf077.png

10

Re: M62446

M62446AFP

#define LATCH   2
#define DATA    3
#define CLOCK   4

void setup() {
  Serial.begin(9600);
  pinMode(LATCH, OUTPUT);digitalWrite(LATCH, LOW);
  pinMode(DATA, OUTPUT);digitalWrite(DATA, LOW);
  pinMode(CLOCK, OUTPUT);digitalWrite(CLOCK, LOW);
}

void loop() {
  byte_1(5,0b0000,5,0);// treb -7...7, port 0b0000, bass -5...5, bypass = 0
  byte_2(0,0);// 0...95 = 0...-95 dB mute = 112
  byte_3(0,0);// 0...95 = 0...-95 dB mute = 112
  byte_4(0,0);// 0...95 = 0...-95 dB mute = 112
  delay(1000);

}

void byte_1(int treb, byte port, int bass, bool by_pass){
  // treb int -7...+7 === -14...+14 dB
  // bass int -7...+7 === -14...+14 dB
  // byte port 0b0000....0b1111
  // by_pass  === 0 TONE | 1 BYPASS 
  switch(treb){
    case -7: treb = 0b1111;break;
    case -6: treb = 0b1101;break;
    case -5: treb = 0b1110;break;
    case -4: treb = 0b1100;break;
    case -3: treb = 0b1011;break;
    case -2: treb = 0b1010;break;
    case -1: treb = 0b1001;break;
    case  0: treb = 0b0000;break;
    case  1: treb = 0b0001;break;
    case  2: treb = 0b0010;break;
    case  3: treb = 0b0011;break;
    case  4: treb = 0b0100;break;
    case  5: treb = 0b0110;break;
    case  6: treb = 0b1101;break;
    case  7: treb = 0b1111;break;
    }
  switch(bass){
    case -7: bass = 0b1111;break;
    case -6: bass = 0b1101;break;
    case -5: bass = 0b1110;break;
    case -4: bass = 0b1100;break;
    case -3: bass = 0b1011;break;
    case -2: bass = 0b1010;break;
    case -1: bass = 0b1001;break;
    case  0: bass = 0b0000;break;
    case  1: bass = 0b0001;break;
    case  2: bass = 0b0010;break;
    case  3: bass = 0b0011;break;
    case  4: bass = 0b0100;break;
    case  5: bass = 0b0110;break;
    case  6: bass = 0b1101;break;
    case  7: bass = 0b1111;break;
    }  
  unsigned int data_byte = (treb<<12)|(port<<8)|(bass<<4)|(by_pass<<2)|0b00;
  writeByte(data_byte);  
  }

void byte_2(int vol_l, int vol_r){
  // int vol 0...95 === 0...-95 dB mute=112
  if(vol_l>79){vol_l=vol_l+16;}
  if(vol_r>79){vol_r=vol_r+16;}
  unsigned int data_byte = (vol_l<<9)|(vol_r<<2)|0b01;
  writeByte(data_byte); 
  }  
void byte_3(int vol_c, int vol_sw){
  // int vol 0...95 === 0...-95 dB mute=112
  if(vol_c>79){vol_c=vol_c+16;}
  if(vol_sw>79){vol_sw=vol_sw+16;}
  unsigned int data_byte = (vol_c<<9)|(vol_sw<<2)|0b10;
  writeByte(data_byte); 
  }  
void byte_4(int vol_sl, int vol_sr){
  // int vol 0...95 === 0...-95 dB mute=112
  if(vol_sl>79){vol_sl=vol_sl+16;}
  if(vol_sr>79){vol_sr=vol_sr+16;}
  unsigned int data_byte = (vol_sl<<9)|(vol_sr<<2)|0b11;
  writeByte(data_byte); 
  }    

void writeByte(uint16_t data){
    digitalWrite(LATCH, HIGH);delayMicroseconds(1);
    digitalWrite(LATCH, LOW);delayMicroseconds(3);
  for (int i = 15; i >= 0; i--){
    digitalWrite(DATA, (data >> i) & 1);delayMicroseconds(3);
    digitalWrite(CLOCK, HIGH);delayMicroseconds(3);
    digitalWrite(CLOCK, LOW);delayMicroseconds(3);
  } 
    digitalWrite(LATCH, HIGH);delayMicroseconds(1);
    digitalWrite(LATCH, LOW);delayMicroseconds(3);
}

11 (2024-10-06 12:27:29 отредактировано shuhrat.ps)

Re: M62446

Брат у m62446afp нету регулировка тембра

12

Re: M62446

Громкость регулируется?

13

Re: M62446

Ну не знаю раньше у меня не было этих функций на даташиту есть такой функция ночью проверяю

14

Re: M62446

[видео]

15

Re: M62446

Вот такой проблема

16

Re: M62446

Опешите проблему подробнее

17

Re: M62446

Звук появляется и исчезает

18

Re: M62446

По кругу появляется и исчезает все канал

19

Re: M62446

[видео]

20

Re: M62446

Попробуйте этот код:

#define LATCH   2
#define DATA    3
#define CLOCK   4

void setup() {
  Serial.begin(9600);
  pinMode(LATCH, OUTPUT);digitalWrite(LATCH, LOW);
  pinMode(DATA, OUTPUT);digitalWrite(DATA, LOW);
  pinMode(CLOCK, OUTPUT);digitalWrite(CLOCK, LOW);
  delay(100);
}

void loop() {
  byte_1(5,0b0000,5,0);// treb -7...7, port 0b0000, bass -5...5, bypass = 0
  byte_2(0,0);// 0...95 = 0...-95 dB mute = 112
  byte_3(0,0);// 0...95 = 0...-95 dB mute = 112
  byte_4(0,0);// 0...95 = 0...-95 dB mute = 112
  delay(1000);

}

void byte_1(int treb, byte port, int bass, bool by_pass){
  // treb int -7...+7 === -14...+14 dB
  // bass int -7...+7 === -14...+14 dB
  // byte port 0b0000....0b1111
  // by_pass  === 0 TONE | 1 BYPASS 
  switch(treb){
    case -7: treb = 0b1111;break;
    case -6: treb = 0b1101;break;
    case -5: treb = 0b1110;break;
    case -4: treb = 0b1100;break;
    case -3: treb = 0b1011;break;
    case -2: treb = 0b1010;break;
    case -1: treb = 0b1001;break;
    case  0: treb = 0b0000;break;
    case  1: treb = 0b0001;break;
    case  2: treb = 0b0010;break;
    case  3: treb = 0b0011;break;
    case  4: treb = 0b0100;break;
    case  5: treb = 0b0110;break;
    case  6: treb = 0b1101;break;
    case  7: treb = 0b1111;break;
    }
  switch(bass){
    case -7: bass = 0b1111;break;
    case -6: bass = 0b1101;break;
    case -5: bass = 0b1110;break;
    case -4: bass = 0b1100;break;
    case -3: bass = 0b1011;break;
    case -2: bass = 0b1010;break;
    case -1: bass = 0b1001;break;
    case  0: bass = 0b0000;break;
    case  1: bass = 0b0001;break;
    case  2: bass = 0b0010;break;
    case  3: bass = 0b0011;break;
    case  4: bass = 0b0100;break;
    case  5: bass = 0b0110;break;
    case  6: bass = 0b1101;break;
    case  7: bass = 0b1111;break;
    }  
  unsigned int data_byte = (treb<<12)|(port<<8)|(bass<<4)|(by_pass<<2)|0b00;
  writeByte(data_byte);  
  }

void byte_2(int vol_l, int vol_r){
  // int vol 0...95 === 0...-95 dB mute=112
  if(vol_l>79){vol_l=vol_l+16;}
  if(vol_r>79){vol_r=vol_r+16;}
  unsigned int data_byte = (vol_l<<9)|(vol_r<<2)|0b01;
  writeByte(data_byte); 
  }  
void byte_3(int vol_c, int vol_sw){
  // int vol 0...95 === 0...-95 dB mute=112
  if(vol_c>79){vol_c=vol_c+16;}
  if(vol_sw>79){vol_sw=vol_sw+16;}
  unsigned int data_byte = (vol_c<<9)|(vol_sw<<2)|0b10;
  writeByte(data_byte); 
  }  
void byte_4(int vol_sl, int vol_sr){
  // int vol 0...95 === 0...-95 dB mute=112
  if(vol_sl>79){vol_sl=vol_sl+16;}
  if(vol_sr>79){vol_sr=vol_sr+16;}
  unsigned int data_byte = (vol_sl<<9)|(vol_sr<<2)|0b11;
  writeByte(data_byte); 
  }    

void writeByte(uint16_t data){
    digitalWrite(LATCH, HIGH);delayMicroseconds(3);
    digitalWrite(LATCH, LOW);delayMicroseconds(3);
  for (int i = 15; i >= 0; i--){
    digitalWrite(DATA, (data >> i) & 1);delayMicroseconds(3);
    digitalWrite(CLOCK, HIGH);delayMicroseconds(3);
    digitalWrite(DATA,LOW);digitalWrite(CLOCK, LOW);delayMicroseconds(3);
    Serial.print((data >> i) & 1);
  } Serial.println();
    digitalWrite(LATCH, HIGH);delayMicroseconds(3);
    digitalWrite(LATCH, LOW);delayMicroseconds(3);
}

21

Re: M62446

тепер работаеть стабилно

22

Re: M62446

как изменит громкости

23

Re: M62446

Проверьте регулировку громкости по 6 каналам и тембр измените для этого параметры функций:

  byte_1(5,0b0000,5,0);// treb -7...7, port 0b0000, bass -5...5, bypass = 0
  byte_2(0,0);// 0...95 = 0...-95 dB mute = 112
  byte_3(0,0);// 0...95 = 0...-95 dB mute = 112
  byte_4(0,0);// 0...95 = 0...-95 dB mute = 112

24

Re: M62446

-40 дБ на все каналы 

  byte_2(40,40);// 0...95 = 0...-95 dB mute = 112
  byte_3(40,40);// 0...95 = 0...-95 dB mute = 112
  byte_4(40,40);// 0...95 = 0...-95 dB mute = 112

25

Re: M62446

Нет нечего не меняется после отсоединения gnd из Ардуино звука нету