kmp84
Joined: 02 Feb 2010 Posts: 345
|
Re: AD5231 Dig_Pot driver |
Posted: Tue Nov 09, 2010 6:34 am |
|
|
kmp84 wrote: | Hi All Anybody control the AD5231 dig_pot..?? Driver for it..? |
Hi Friends! 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);
} |
|
|