# Is anyone ever used ADCS7476?

Status
Not open for further replies.

#### satria02

##### Junior Member level 2
Hi...

I have searched for information from datasheet and internet about how to access this device, but i do not get enough clear information about it....

thanks...

#### grieblm

##### Member level 4
Give us a hint? Who is the manufacturer and what does it do?

#### alexan_e

Give us a hint? Who is the manufacturer and what does it do?

You can use google to find the datasheet

12bit AD converter with serial interface.

Alex

#### grieblm

##### Member level 4
It seems to have a simple SPI-bus interface. Your controller may have a SPI port built-in -- if not you can "bit bang" the necessary signals through a standard I/O port (see Bit Bang for details).

#### satria02

##### Junior Member level 2
actually i access ADCS7476 by using some trick....
i make clock signal manually and then take data ADC bit by bit until i get 16 bits data of ADCS7476....
when using this trick,i think that it's too slow....to take 16 bits data of ADC, it need 25us...

this is my code...

CS_LOW();
i=1;
dataI = 0x0000;
dataQ = 0x0000;
while(i<16)
{
SCL_LOW();
//_delay_us(0.02);
dataI<<=1;
dataQ<<=1;
geserI = (PINB&0b00000100); //0b10000000
geserQ = (PIND&0b00010000);
i++;
SCL_HIGH();
geserI>>=2;//7
geserQ>>=4;
dataI |=geserI;
dataQ |=geserQ;

}
CS_HIGH();
_delay_us(0.05);

I0 = dataI;
Q0 = dataQ;

can you help me to make this program more fast on taking data of 16 bits ADC.....

i get an idea to combine assembler code and C code, but i confuse to realize that....
any one can help me?

thank you very much....

#### alexan_e

Can you try this

Code C - [expand]1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
CS_LOW();
i=0;
dataI = 0x0000;
dataQ = 0x0000;
while(i<16)
{
SCL_LOW();
//_delay_us(0.02);
dataI |= ((PINB&0b00000100)>>2)<<i;
dataQ |= ((PIND&0b00010000)>>4)<<i;
i++;
SCL_HIGH();
}
CS_HIGH();
_delay_us(0.05);

I0 = dataI;
Q0 = dataQ;

or

Code C - [expand]1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
CS_LOW();
i=0;
dataI = 0x0000;
dataQ = 0x0000;
while(i<16)
{
SCL_LOW();
//_delay_us(0.02);
if (PINB&0b00000100) dataI |= (1<<i);
if (PIND&0b00010000) dataQ |= (1<<i);
i++;
SCL_HIGH();
}
CS_HIGH();
_delay_us(0.05);

I0 = dataI;
Q0 = dataQ;

the second way may be faster

An alternative would be to use an external shift register to get the 8bit result and provide ir with one read in the parallel port, and then do that again for the remaining 8bits.

Alex

---------- Post added at 15:57 ---------- Previous post was at 15:32 ----------

I have tested your way with the two ways I have provided, the execution time is exactly the same so I guess the compiler does a good job an the result is the same.
So that leaves only the alternative solution with the external shift register, unless someone can optimize your code to execute faster.

Another question is why do you read 16bits when the ADC provides just 12bit result?
Did you try with the mcu SPI, was it slower?

Alex

Last edited:

#### satria02

##### Junior Member level 2
because this ADC provides 16 bits data, whereas 4 bits are zero bit, and 12 bits data....and this ADC cycle clock are 16 clock....

i didn't try with mcu SPI because i need to get data of ADC on the same time or on the same clock (on the same condition)....
another reason is i used mcu SPI pin to access the other device....

#### alexan_e

i didn't try with mcu SPI because i need to get data of ADC on the same time or on the same clock (on the same condition)....
I don't understand what you mean.

You can use two devices in the same spi link and then enable the one you want to use.
Even if you do it your way (one using spi and one using simple port pin) you are still using either the SPI link device either the connection to the ADC, you can't use them both at the same time because the mcu can't do multitasking.

Alex

Status
Not open for further replies.