|
|
|||||||
| Home | Forums | Rules | Articles | Store | Gallery | Blogs | Register | Donations | FAQ | Calendar | Search | Today's Posts | Mark Forums Read | Search |
| Digital Source Digital Players and Recorders: CD , SACD , Tape, Memory Card, 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 |
|
|
|
Thread Tools | Search this Thread |
|
|
#1 |
|
diyAudio Member
Join Date: Mar 2003
Location: St. Catherine, Jamaica
|
Hello Guys,
I am building a preamp controlled by a PIC using the PGA2310 for volume. I am having some problems with my buttons. I have momentary push buttons connected directly to the PIC but I have serious debouncing issues. I have used the debounce circuit below but it does not work at all. Does anyone have any solutions to this problem? I am ripping my hair out!! Thanks Lawrence http://www.mines.edu/Academic/course...1/debounce.gif
__________________
<a href="http://www.danasoft.com"><img src="http://www.danasoft.com/sig/lawbadman.jpg" border="0"></a><div style="font-family:arial,sans-serif;font-size:11px;"><p>Sign by Danasoft - <a href="http://www.danasoft.com">For Backgrounds and Layouts</a></p></div> |
|
|
|
|
#2 |
|
diyAudio Member
|
hi Lawrence,
i hate to here a guy ripping out his own hair, maby i can point you in the right direction. its best to debounce the buttons in software, using a pull up resistor (or pull down) on each button. you will find lots of examples/ tutorials for this with google. i would do a seach with something like 'debounce buttons pic' as a starting point. regards bob
__________________
regards bob |
|
|
|
|
#3 |
|
diyAudio Member
Join Date: Oct 2006
|
Could try the very simple cap input.
Look at the first page, after the 'start' button, which feeds into the 555 timer. Depending on the size of the cap and pullup resistor, you control the pulse width. Regardless, it is a very tried and true method. You can hold the start button if you want, and will only get one pulse. If you need a specific minimum pulse width, the 555 is perfect for that. Restrikes are eliminated. |
|
|
|
|
#4 |
|
diyAudio Member
Join Date: Nov 2005
Location: Victoria
|
Honestly, I would not even contemplate hardware debouncing when using a micro. Why add extra components to a board when less will do. this is especially true of production (even small scale) items. code only costs the first time you do it, you could debounce ten buttons with virtually the same code as one, and you could use the same code for as many units as you like. hardware would require ten times the effort in each unit you assemble.
Easiest way in software is to count the button as pressed down only if two or three consecutive reads (whichever gives reliable debounce for your app) give the same state (either going from pressed to unpressed or vice versa). make readings every 5-10ms so it will seem virtually instantaneous to the user. if the debouncing is not quite good enough, use a longer time or more consecutive readings. depending on the switches, the close or open may bounce less, this can also be taken into account to give a better responce (say wait longer on press than release or vice versa). |
|
|
|
|
#5 |
|
diyAudio Member
Join Date: Mar 2003
Location: St. Catherine, Jamaica
|
I FIGURED IT OUT!!!
I didnt use hardware debouncing, I write some code for it and it works great. You should have heard me screaming when it actually worked All I did was to set a count from 0 to 255, 255 times. Then when the button was released the appropriate function was called, otherwise the counter would start again. Now that one problem is solved now there is another one. The SPI port on the PIC kicks out 8 bits at a time, the PGA2310 requires a straight 16 bits. At first I used the SSPIF bit in the PIR1 register to tell me when the transmission was done, but by the time the bit is set SSPBUF goes to 0, and the volumes go crazy. Does anyone know how to sent a steady 16 bit stream from a PIC to PDA2310????? Thanks BTW- the PIC I am using is: 16F877
__________________
<a href="http://www.danasoft.com"><img src="http://www.danasoft.com/sig/lawbadman.jpg" border="0"></a><div style="font-family:arial,sans-serif;font-size:11px;"><p>Sign by Danasoft - <a href="http://www.danasoft.com">For Backgrounds and Layouts</a></p></div> |
|
|
|
|
#6 |
|
diyAudio Member
Join Date: Mar 2004
Location: Leuven
|
why not write the bytes out manually
pull enable pin down write first byte : pull clk down write first bit pull clk up pull clk down write second bit... ... write second byte : ... pull enable pin up that's how it's being done in my version (using jal), works flawlessly and there is no problem to cascade several chips as well, just make loops while writing out the different bytes Note that 'my version' is not completely my own design/software, most credits go to Benjamin Hinrichs for that, I'm *still* in the process of modding the software to suit my needs, which involved learning jal in the first place !
__________________
A8 If 'I' knew what I was doing, life would sure be easier... |
|
|
|
|
#7 |
|
diyAudio Member
Join Date: Nov 2004
Location: Montreal
|
You can have a look at these two web site, they both make a pre-amp project with PGA2310 and PIC.
http://www.electro-dan.co.uk http://www.mhennessy.f9.co.uk |
|
|
|
|
#8 |
|
diyAudio Member
Join Date: Mar 2007
|
hope it works for you.
LABEL?L _SHIFT LOW?T _CS PAUSEUS?C 064h SHIFTDATA?T _SDI SHIFTCLOCK?T _SCLK SHIFTMODE?C 005h SHIFTOUT?WC _VOL, 010h HIGH?T _CS PAUSEUS?C 064h HIGH?T _SDI RETURN? and LABEL?L _VOLUME BUTTONPIN?T _UP BUTTONDS?C 000h BUTTONDEL?C 0FEh BUTTONRATE?C 07Fh BUTTONTS?C 001h and LABEL?L _UP CMPEQ?BCL _VOL_L, 0FFh, _MAX_LIMIT ADD?BCB _VOL_L, 001h, _VOL_L ADD?BCB _VOL_R, 001h, _VOL_R GOSUB?L _SHIFT GOSUB?L _DB_VALUE GOSUB?L _dB_LCD GOSUB?L _MUTE_LCD GOTO?L _VOLUME this is the whole trick of shifting data to a PGA, not many would share it, however, you might check the chipamp section there have been number of threads there on making a pre around PGA including two by me. Otherwise let me know and I ll try to help you out. |
|
|
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
|
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| switch-on, switch-off sequence for preamp/amp | cbutterworth | Tubes / Valves | 1 | 2nd March 2007 12:41 PM |
| Never try to switch 450V DC at 3A with a conventional mains switch... | Eva | Power Supplies | 28 | 1st November 2006 09:24 AM |
| Switch | DJ Exprice | Chip Amps | 11 | 29th June 2006 01:41 PM |
| Main on/off switch for amp using a piezo switch | using_e | Solid State | 13 | 20th June 2006 05:55 PM |
| Using a momentary switch for main power switch? | FullThrottleRic | Parts | 9 | 25th June 2002 08:23 PM |
| New To Site? | Need Help? |
| Page generated in 0.11101 seconds (81.43% PHP - 18.57% MySQL) with 11 queries |