Go Back   Home > Forums > Source & Line > Analog Line Level

Analog Line Level Preamplifiers , Passive Pre-amps, Crossovers, etc.

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 20th January 2010, 10:19 PM   #11
Jempie is offline Jempie  Indonesia
diyAudio Member
 
Join Date: Jan 2008
Hi,

the problem is that i already have a preamp with a normal old Alps potentiometer
the sound is good, now i want to readout the position of the pot. by turning up/down
you see on the display the volume up and down

i have a picture how can i add this.
  Reply With Quote
Old 21st January 2010, 08:54 AM   #12
Jempie is offline Jempie  Indonesia
diyAudio Member
 
Join Date: Jan 2008
Attachment 154803

source

// LCD module connections
sbit LCD_RS at RC5_bit;
sbit LCD_EN at RC4_bit;
sbit LCD_D4 at RC0_bit;
sbit LCD_D5 at RC1_bit;
sbit LCD_D6 at RC2_bit;
sbit LCD_D7 at RC3_bit;

sbit LCD_RS_Direction at TRISC5_bit;
sbit LCD_EN_Direction at TRISC4_bit;
sbit LCD_D4_Direction at TRISC0_bit;
sbit LCD_D5_Direction at TRISC1_bit;
sbit LCD_D6_Direction at TRISC2_bit;
sbit LCD_D7_Direction at TRISC3_bit;
// End LCD module connections

void initial(void);// Declaration of the initial() routine
unsigned int temp;// Used for storing the data from ADC register
unsigned char dat[5]={0X31,0X31,0X31,0X31,0X31}; // Array containg data which will be displayed on the LCD
unsigned char i=0; // Variable for counting in For loop

void initial(void) // Begning of the Initial routine
{//par
//par
TRISA=1;// Making the 1st pin out PortA as input pin
ANSEL=0X01;//Making 1st Pin of PortA as anolog
TRISC=0;// Making the PortC as Output Port
INTCON=0XC0;// Enabling all the Interrupts
PIR1.TMR1IF=0;// Clear the interrupt flag of Timer1
PIE1.TMR1IE=1;// enable the interrupt of Timer1
TMR1L=0X00; // Least significant Byte of Timer1
TMR1H=0X00; //Most significant Byte of Timer1
PIR1.ADIF=0;// Clear the flag of the ADC
PIE1.ADIE=0;// Disable the interrupt of ADC
ADCON1=0X10; // Configure the ADC register
ADCON0=0X03; // Configure the ADC register
Lcd_Init() ; // Initilize the LCD and Lcd is connected to Portc
//T1CON=0X01;
temp=0X31;// Tempraory varaible
dat[0]='-'; // 1st data Byte
} // End of Initial routine
//par
//par

void main(void)// Begning of the Main routine
{

initial(); //Calling of the Initial() routine
LCD_Cmd(_LCD_CLEAR);// Command to clear the LCD
LCD_Cmd(_LCD_CURSOR_OFF); // Command for making Cursor off
LCD_OUT(1,1,"AUDIODESIGNGUIDE"); // Sending 'AUDIODESIGNGUIDE' to fist line and fist coloum of LCD
LCD_OUT(2,2,"Volume");// Sending 'Volume' to second line and second coloum of LCD
LCD_OUT(2,13,"Db");// Sending 'Db' to second line and thirteen coloum of LCD
while(1) // Infinite loop
{
if( ADCON0.F1==0 ) //Checking if data is present in ADC register
{
temp=ADRESH; // Storing the most significant BYte of ADC register

ADCON0=0X03; //Starting the ADC again
if(temp<=40) //if input is less than 40
temp=(temp*49)/40; // Perform this calculation in order to convert it in algorithmic
else // for input is greater than 40
temp=(((temp-40)*50)/215)+49;// Perform this calculation in order to convert it in algorithmic
}
dat[1]=temp%10;// Store the unite digit of data in data array which is passed to lcd Moude for display
dat[1]+=0x30;// Convert data to its ASCII value
dat[0]=(temp/10 )%10;// // Store the tens digit of data in data array which is passed to lcd Moude for display
dat[0]+=0X30; // Convert data to its ASCII value
if(dat[0]==0X30 && dat[1]==0X30)// If data is 00
{
Lcd_Chr(2,9,' '); // Clear the negative sign because 00 value cannot be negative
}
else // Other value than OO
Lcd_Chr(2,9,'-');// Put negative Sign
// End of if and else statement
for(i=0;i<2;i++)
Lcd_chr(2,10+i,dat[i]);// Pass the data Byte by byte to LCD
}//End of While loop
}// End of Main() routine
Attached Images
File Type: gif VFD LCD.gif (24.3 KB, 101 views)
  Reply With Quote
Old 22nd January 2010, 05:15 PM   #13
diyAudio Member
 
Join Date: Jun 2004
Location: midlands
Quote:
Originally Posted by Jempie View Post
Hi,

the problem is that i already have a preamp with a normal old Alps potentiometer
the sound is good, now i want to readout the position of the pot. by turning up/down
you see on the display the volume up and down

i have a picture how can i add this.
I don't think your attachment has worked, although I can see your schematic.

I have had a few moments to think about what you want and can only see a couple of solutions, and both would need you to chuck out the alps pot and replace it with either
  1. a triple gang pot (if such a thing exists!) and use the extra gang to read a positional voltage from and to then output to a display
  2. purchase (or create) some form of digital volume control. This could be either a complete bolt-in module or you could build one up using say, a tpa joshua tree. This could have advantages of remote control as well.

You havn't mentioned what your preamp is or if you built it yourself.

There may be other options....
  Reply With Quote
Old 22nd January 2010, 05:26 PM   #14
diyAudio Member
 
Steerpike's Avatar
 
Join Date: Jan 2006
Location: Johannesburg, South Africa
Quote:
Originally Posted by MikeBarton View Post
and both would need you to chuck out the alps pot and replace it with either
  1. a triple gang pot (if such a thing exists!) and use the extra gang to read a positional voltage from and to then output to a display
  2. purchase (or create) some form of digital volume control. This could be either a complete bolt-in module or you could build one up using say, a tpa joshua tree. This could have advantages of remote control as well.
There is also the option of coupling the existing pot (assumed to be a high grade audio specialist type) to an additional 'ordinary' pot or optical rotary encoder by means of a pair or row of spur gears, or a nylon cord drive as used on the tuning dial of radio tuners.

An oddball alternative might be to measure TWO audio voltages with the A/D converter - one going into the pot, and that comming out off the wiper. Then in software, compute the ratio of the two, and hence the position. This will fail however when the audio signal is very low or absent.
__________________
Steerpike's Toybox
  Reply With Quote
Old 23rd January 2010, 11:13 PM   #15
Jempie is offline Jempie  Indonesia
diyAudio Member
 
Join Date: Jan 2008
Hi this work fine, only the read out is not stable so you see on the LCD
it toggle between 35 and 34

Regards
  Reply With Quote
Old 24th January 2010, 10:14 AM   #16
diyAudio Member
 
Join Date: Jun 2004
Location: midlands
Quote:
Originally Posted by Jempie View Post
Hi this work fine, only the read out is not stable so you see on the LCD
it toggle between 35 and 34

Regards
In that case, you could always try doing an average of the readings - say holding the last 10 (or more) readings.
  Reply With Quote
Old 25th January 2010, 10:42 PM   #17
Jempie is offline Jempie  Indonesia
diyAudio Member
 
Join Date: Jan 2008
Mike,

could you explane, witch line must i change?
  Reply With Quote
Old 27th January 2010, 08:15 AM   #18
diyAudio Member
 
Join Date: Jun 2004
Location: midlands
Quote:
Originally Posted by Jempie View Post
could you explain, which line must i change?
You could try something like the following....

in the header section:
Code:
unsigned int temp;// Used for storing the data from ADC register
#define ADC_READINGS 10  // number of samples to hold
unsigned char adc_reading[ADC_READINGS];  // array to hold last n samples
unsigned char adc_reading_count=0; // how many samples we have
then in the while loop section:

Code:
if( ADCON0.F1==0 ) //Checking if data is present in ADC register
{
  for(i=1;i<ADC_READINGS;i++) adc_reading[i]=adc_reading[i-1];  // shift 1 element right
  adc_reading[0]=ADRESH;    // Storing the most significant Byte of ADC register
  if(adc_reading_count<ADC_READINGS) adc_reading_count++;  // increment how many we have
  // now get total and calc average
  temp=0;
  for(i=0;i<adc_reading_count;i++) temp+=adc_reading[i];
  temp=temp/adc_reading_count;	// average reading

  ADCON0=0X03; //Starting the ADC again

etc
You could simplify it by removing the adc_reading_count variable and just accept that in the first few milliseconds of the program running (until the array fills up, that-is), the average won't be correct.
I havn't run the code, so there may be 'issues'

HTH
  Reply With Quote
Old 27th January 2010, 08:59 AM   #19
Jempie is offline Jempie  Indonesia
diyAudio Member
 
Join Date: Jan 2008
Mike,

On the circuit PIN3 is connect to a smal capacitor of the use on the potentiometer
this will read out the position of the pot.




thanks, this source is writen in MicroElektronika, but i want it change to Microchip
because there is a different in compiler you can not exchange both.
Attached Images
File Type: gif schema_cursus5.gif (1.4 KB, 54 views)
  Reply With Quote
Old 6th February 2010, 08:31 AM   #20
Jempie is offline Jempie  Indonesia
diyAudio Member
 
Join Date: Jan 2008
hi is there anybody how can help me converting the source from Mikroelektronika to
Microchip? a donation is possible

Regards,
  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


Similar Threads
Thread Thread Starter Forum Replies Last Post
normal X-Amp uli Pass Labs 42 19th November 2010 06:31 AM
Is it normal to think this way? gain wire Instruments and Amps 3 16th October 2008 11:09 PM
25-position switched attenuator using a pair of 5-position switches? ray_moth Tubes / Valves 1 4th May 2008 08:02 AM
threads become &quot;read&quot; before I have a chance to read them. y8s Forum Problems 2 10th February 2008 10:57 AM
Is this normal? A_Reef_Scene Multi-Way 2 7th March 2007 06:51 PM


New To Site? Need Help?

All times are GMT. The time now is 06:20 AM.


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