Digitally controlled preamp/headphone amp - Page 4 - diyAudio
Go Back   Home > Forums > Amplifiers > Headphone Systems

Headphone Systems Everything to do with Headphones

Please consider donating to help us continue to serve you.

Ads on/off / Custom Title / More PMs / More album space / Advanced printing & mass image saving
Reply
 
Thread Tools Search this Thread
Old 19th September 2005, 12:32 PM   #31
diyAudio Member
 
Russ White's Avatar
 
Join Date: Jan 2005
Location: Nashville, TN, USA
Send a message via Yahoo to Russ White
Default getting closer....

Code:
#include <pic.h>


__CONFIG(INTIO & WDTDIS & PWRTEN & MCLRDIS & UNPROTECT & BORDIS);

#define POT GPIO0
#define CS GPIO1
#define Data GPIO2
#define ZCEN GPIO3
#define MUTE GPIO4
#define Clk GPIO5



int last;

writeByte(int out) {
	int b = out;
	int i;
	for (i = 8; i > 0; i--) {
		int x = 1 << (i-1);
		if (b >= x) {
			Data = 1;
			b -= x;
		} 
		else 
		{
			Data = 0;
		}
		Clk = 1;
		Clk = 0;
	}
}

writeState(int val){
	CS = 0;
	writeByte(val);
	writeByte(val);
	CS = 1;
}

int getState() {
	GODONE = 1;
	while (GODONE){
		NOP();
	}
	return ADRESH;
	
}

main() {
	int i = 0;
	ANSEL = 0b001110001;
	ADCON0 =0b000000001;
	TRIS1 = 0; // make output
	TRIS2 = 0; // make output
	TRIS3 = 0; // make output
	TRIS4 = 0; // make output
	TRIS5 = 0; // make output
	MUTE = 1; // may need to actually set the register, not use these bit vars.
	ZCEN = 1;
	CS = 1;
	for (i = 0; i <20000; i++) NOP();// mute settle
	while (1) {
		int value = getState();
		if (value != last) {
			writeState(value);
			last = value;
		}
		for (i = 0; i <2000; i++) NOP();// delay
	}
}
__________________
Less pulp more juice Twisted Pear Audio.
  Reply With Quote
Old 19th September 2005, 03:53 PM   #32
diyAudio Member
 
Join Date: Mar 2007
Hi Russ:
nice work, keep up the good job.

saltnpeppah:
could u plz P.M me, need to disscuss...?
ur contribution at the link could really add value...
High End Pre Group Design Invitation
  Reply With Quote
Old 19th September 2005, 04:03 PM   #33
diyAudio Member
 
Join Date: May 2005
Location: TN
OK. Russ

finaly mod. (calibrate offset with mute time >2mS )

main(1){

....varius

MUTE=0; // start muting & self cal.

for (i = 0; i <20000; i++) NOP();// mute settle

MUTE=1; // end self cal. & normal status recall...

while(1){.........}

simply

Ciao

Mauro
  Reply With Quote
Old 19th September 2005, 04:04 PM   #34
diyAudio Member
 
Russ White's Avatar
 
Join Date: Jan 2005
Location: Nashville, TN, USA
Send a message via Yahoo to Russ White
Hi All,

Its working. I am tweeking the C code, but it works great!!! The sound is excellent!
Attached Images
File Type: jpg pic2.jpg (98.5 KB, 3879 views)
__________________
Less pulp more juice Twisted Pear Audio.
  Reply With Quote
Old 19th September 2005, 04:10 PM   #35
diyAudio Member
 
jackinnj's Avatar
 
Join Date: Apr 2002
Location: Llanddewi Brefi, NJ
To assure complete happiness:
1) on each of the control pins of the PGA2311 (SDI, CE, SCLK) place a 10K resistor to ground.
2) on each lead from the PIC to the PGA2311 place a 50R or 100R resistor.

these two changes will result in reduced "ambiguity" -- they also decouple some of the clock noise from the PIC to the PGA.

You might be happier using LM317LZ and LM337LZ voltage regulators for the V+ and V_ supplies == 2 pairs == these are in a TO-92 case and will do about 100 ma each -- they will also give you better noise performance.

not a bad idea to decouple the Digital Power from the supply -- or provide it with its own LM317LZ or 78L05.
  Reply With Quote
Old 19th September 2005, 05:47 PM   #36
diyAudio Member
 
Russ White's Avatar
 
Join Date: Jan 2005
Location: Nashville, TN, USA
Send a message via Yahoo to Russ White
Well folks, I could'nt be happier today. I programmed the PIC and plugged it in and it worked on the first try. Talk about about a good feeling, that does not often happen for me.

Here is the code as it is now, and it works great..

Volume transition is smooth. I can't detect any noise from the digital pot changing volume at all.

Here is the code.

I am working on a REV 2 of the PCB. Stay tuned.
Attached Files
File Type: txt main.txt (1.2 KB, 557 views)
__________________
Less pulp more juice Twisted Pear Audio.
  Reply With Quote
Old 19th September 2005, 06:08 PM   #37
diyAudio Member
 
Russ White's Avatar
 
Join Date: Jan 2005
Location: Nashville, TN, USA
Send a message via Yahoo to Russ White
Default hex file

Here is the hex file should anyone else want to try it.

Rename it .hex to use it.
Attached Files
File Type: txt prempa_hex.txt (1.2 KB, 306 views)
__________________
Less pulp more juice Twisted Pear Audio.
  Reply With Quote
Old 19th September 2005, 06:14 PM   #38
diyAudio Member
 
Join Date: Mar 2004
Location: Bangalore, India.
Quote:
Originally posted by Russ White
Well folks, I could'nt be happier today. I programmed the PIC and plugged it in and it worked on the first try.
Looks like you beat me to it...



nyways, congrats...

if your rev2 includes a remote and all that pizzaz, PUH-LEEZE look me up.

~m.
  Reply With Quote
Old 21st September 2005, 01:50 AM   #39
diyAudio Member
 
Russ White's Avatar
 
Join Date: Jan 2005
Location: Nashville, TN, USA
Send a message via Yahoo to Russ White
Default code tweaks

Ok, I have listened to this thing for two days now.

The only quirk I found was that every once in a while (say 1 out of 4 times) when I turn the power off and turned it back on only one channel would come up to the correct volume until I moved the pot. Well.. this revision of the code fixes it...

Now both channels come up correctly every time.

Cheers!
Russ
Attached Files
File Type: txt main.txt (1.3 KB, 310 views)
__________________
Less pulp more juice Twisted Pear Audio.
  Reply With Quote
Old 23rd September 2005, 09:30 PM   #40
diyAudio Member
 
Russ White's Avatar
 
Join Date: Jan 2005
Location: Nashville, TN, USA
Send a message via Yahoo to Russ White
Default Question...

OK, this preamp sounds awesome, but I have noticed something odd.

When I turn off the pre, but leave the source on as well as the power amp a very small about of sign leaks through. This only happen when the power is off. Well this makes some sense looking at the PGA2311 datasheet it appears that at power off state the digital pot resets to about halfway.

Soo... I wonder how to prevent it.

I have a couple of theories:

1) make the impedance to the opamp(or rather from the PGA2311) lower by adding a resistor from the output of the volume control to GND.

2) Isolate the opamp from the PGA2311 by adding a 1K resistor in series with the output to the input of the AD8620.


3) both of the above.(the attached schematic is what I propose to do)

4) I could add a relay or a didgtally controlled switch, but I don't really want to do that.

Anyone got any ideas?

Other than that small quirk the thing sounds amazing.

Thanks,
Russ
Attached Images
File Type: png pic.png (29.8 KB, 3505 views)
__________________
Less pulp more juice Twisted Pear Audio.
  Reply With Quote

Reply


Hide this!Advertise here!
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



New To Site? Need Help?

All times are GMT. The time now is 11:32 PM.


vBulletin Optimisation provided by vB Optimise (Pro) - vBulletin Mods & Addons Copyright © 2014 DragonByte Technologies Ltd.
Copyright 1999-2014 diyAudio

Content Relevant URLs by vBSEO 3.3.2