CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

AD5231 Dig_Pot driver

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
kmp84



Joined: 02 Feb 2010
Posts: 345

View user's profile Send private message

AD5231 Dig_Pot driver
PostPosted: Mon Nov 01, 2010 9:32 am     Reply with quote

Hi All Smile Anybody control the AD5231 dig_pot..?? Driver for it..?
kmp84



Joined: 02 Feb 2010
Posts: 345

View user's profile Send private message

Re: AD5231 Dig_Pot driver
PostPosted: Tue Nov 09, 2010 6:34 am     Reply with quote

kmp84 wrote:
Hi All Smile Anybody control the AD5231 dig_pot..?? Driver for it..?


Hi Friends! Smile This is sample driver fot AD5231 Digital Potentiometer (1024-positions). Here is implement only function (No:11)RDAC register control.
Code:
 
#define CLK PIN_A1
#define DAT PIN_A0
#define CS  PIN_A2

void set_pot(unsigned int16 data)
{
   BYTE i;
   BYTE cmd[3];

   cmd[0] = MAKE8(data,0);
   cmd[1] = MAKE8(data,1);
   cmd[2] = 0xB0;

   output_low(CLK);
   output_low(CS);

   for(i=1;i<=24;++i) {
      output_bit(DAT, shift_left(cmd,3,0));

      output_high(CLK);
      output_low(CLK);
   }
   output_high(CS);
}
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group