Go Back   Home > Forums > Amplifiers > Chip Amps

Chip Amps Amplifiers based on integrated circuits

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
Old 4th January 2014, 08:35 PM   #1
diyAudio Member
Join Date: Jan 2014
Default Pga2311 pic16f877 spi interface code

Iwant to control the pga2311 with Pic16f877. Anyone have example c codes?
  Reply With Quote
Old 4th January 2014, 10:04 PM   #2
diyAudio Member
Join Date: Feb 2008
Location: Jackson,michigan
Hmmmmm....That looks much better than the LM1972's I just got !!!

Cheers !!

  Reply With Quote
Old 4th January 2014, 10:07 PM   #3
diyAudio Member
Join Date: Jan 2014
do you have any example code for spi control?
  Reply With Quote
Old 5th January 2014, 01:50 PM   #4
diyAudio Member
playOvation's Avatar
Join Date: Jan 2014
Though I don't know much about PICs (my favourites are Atmel's µCs), there's a piece of advice I can give:
have a look into the PGA's datasheet at section "serial control port".
Everything you need is in there I did the same when building my preamp and it was done in less than 1 hour.
Good luck!

  Reply With Quote
Old 10th January 2014, 09:32 PM   #5
diyAudio Member
Join Date: Jan 2014
anyone help?
with this code I can't control the pga2311.

#include <16f877A.h>

#use delay(clock=4000000)

#use rs232 (baud=9600, xmit=pin_C6, rcv=pin_C7, parity=N, stop=1)
#use spi (master, DI=pin_C2, DO=pin_C1, CLK=pin_C0 ,SAMPLE_RISE,bits=16,LSB_FIRST,IDLE=0)

#define CS PIN_C3 // CS ifadesi PIN_C2 pini yerine atanıyor

int16 N;
void main ()

{ output_low(cs);
if (input(pin_A5))

  Reply With Quote
Old 12th January 2014, 09:17 PM   #6
diyAudio Member
playOvation's Avatar
Join Date: Jan 2014
Originally Posted by kualrea
with this code I can't control the pga2311.
Obviously it isn't Where did you get that sourcecode? It looks a bit weird to communicate with a PGA2311.
Did you scope the bus already?
I suggest to build up your control word like that:
One Byte (let's call it "left") contains the volume for the left channel.
Another one (call it "right") represents the volume of the right channel.
Now you take a 16-bit variable (let's call it "volume") and do the following:
[pseudo code] volume = right*256 + left [/pseudo code]
Now you can transmit THIS variable via SPI to your PGA2311.

I hope, this short post will help you a bit
  Reply With Quote


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
PGA2311 code child1 Analog Line Level 12 27th January 2013 01:30 PM
Little USB/Digital interface box with I2S interface QA01 lxiaob Digital Source 0 2nd January 2013 04:51 AM
CS8406 SPI problem mstro Digital Line Level 11 30th August 2011 02:21 PM
Problem witht [code]blah[/code] ? elseif Forum Problems 1 17th August 2008 12:30 AM
cxa1244 SPI padamiecki Parts 0 29th March 2004 04:58 AM

New To Site? Need Help?

All times are GMT. The time now is 10:35 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