I am running experiments on PGA2311 and ATmega16.
I connected ZCEN to Vcc. Then I played some tracks, ranging from speech, trance, classic, and heavy metal. I had to low/up the volume to see if there audible clicks while changing the volume, I did not hear any, I was impressed, but not convinced. I got a function generator that I sat to 1KHz, I injected that tone and started lowering and raising the volume to see, and guess what?
I HEARD THE CLICKS. They were awful, and so much audible
Now what I want to try is to make the increments in logarithmic style rather than incrementing by 2 (1 dB steps).
I wish I was not sleepy to explain all that in the first post, but I was so much tired and it was sunrise after a long night of experimenting for me.
Here is the code I wrote for PGA2311 data put function:
void PGA_put(uint16_t PGA_data)
{
uint8_t cnt;
PGA_PORT &= ~(1 << PGA_CS); //Clear CS
for(cnt = 0; cnt < 16; cnt++)
{
PGA_PORT &= ~(1 << PGA_SCLK); //Clear SCLK
if((PGA_data << cnt) & 0x8000)
{
//Don't set SDI unless it's cleared
//This means don't set an already set
//pin, this is a waste of time
if(bit_is_clear(PGA_PIN, PGA_SDI))
{
PGA_PORT |= 1 << PGA_SDI; // Set SDI
}
}
else
{
//Don't clear SDI unless it's set
//This means don't clear an already
//cleared pin, this is a waste of time
if(bit_is_set(PGA_PIN, PGA_SDI))
{
PGA_PORT &= ~(1 << PGA_SDI); // Clear SDI
}
}
//_delay_us(1);
PGA_PORT |= (1 << PGA_SCLK); //Set SCLK
//_delay_us(1);
}
PGA_PORT &= ~(1 << PGA_SCLK); //Clear SCLK
PGA_PORT &= ~(1 << PGA_SDI); //Clear SDI
PGA_PORT |= (1 << PGA_CS); //Set CS
}
ATmega16 is running at 16MHz, and I commented the couple of delays. As a matter of fact, when I uncommented them in the case of 1KHz test signal, things became so much worse. I noticed that sending the data this fast was a plus, and thanks to PGA2311 that it can handle reading the data sent at this high speed.