Maker Pro
Maker Pro

SPI ADC/DAC with 8051

vead

Nov 27, 2011
473
Joined
Nov 27, 2011
Messages
473
Hello everyone

I have small confusen on SPI ADC/DAC with 8051. I think SPI is serial communication protocol and ADCs (analog-to-digital converters), DACs (digital-to-analog converters) is circuity. when we need to read the data from sensor we have to use ADC chip. we have to set up ADC so we write program on SPI program. I am not sure it happen Does it happen?
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
12,880
Joined
Nov 17, 2011
Messages
12,880
You sure seem to be confused.

SPI is a serial protocol to communicate with any kind of circuit that supports this protocol.
You need to set up:
  1. The SPI master (controller) on the microcontroller you are using. This can be either a dedicated SPI controller or a subroutine that controls the required I/O-pins to emulate the SPI protocol.This setup insofar depends on the slave chip (ADC) you want to control as you need to find the correct signals as there are a few variants of SPI. YOu need to set up the controller such that it "speaks" the same variant as the slave chip.
  2. Once the Master has been set up, use SPI to communicate with the chip (e.g.. ADC) to set up the chip for operation according to the manual/datasheet (e.g. input range, sampling frequency etc.), to read data etc.
    Note that this setup is not SPI specific. SPI is only used to send the required commands to the chip.
 

vead

Nov 27, 2011
473
Joined
Nov 27, 2011
Messages
473
You sure seem to be confused.
SPI is serial communication protocol commonly used to send data between microcontrollers and small peripherals such as sensors. ie. interfacing of temperature sensor to microcontroller. ADC chip will convert temperature value into digital value. We will write program to read the temperature value on sensor using SPI
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,506
Joined
Jan 21, 2010
Messages
25,506
Vead, I'm not confident you understand.

Your statement only makes sense if your ADC has an SPI interface, a fact that is not a given.

You also used "i.e" when "e.g." would be appropriate.

"e.g." tells us you are giving an example, one of many that could possibly be given. For example, "Apples come in several colours, e.g. red."

"i.e." tells us you are restating something, which requires you give the general case. For example, "apples come in several colours, i.e. the skin of different types of apples may have different pigmentation."

So when I say "I'm not confident you understand", what I mean is that what you have written is incorrect. If that is what you really understand, then you don't understand.
 

vead

Nov 27, 2011
473
Joined
Nov 27, 2011
Messages
473
Vead, I'm not confident you understand.
So when I say "I'm not confident you understand", what I mean is that what you have written is incorrect. If that is what you really understand, then you don't understand.

I don't know where you got me wrong. What I understand is that ADC is a hardware chip that convert analog signals into digital signals. ADC support SPI communication protocol. communication protocol is program that control ADC chip. whenever we need to read temperature on sensor we need to use ADC because microcontroller only understand digital signal (logic low 0 v and logic High 5v ). ADC take data from sensor and send to microcontroller. microcontroller read that value and store it in somewhere. ADC can be inbuilt in mircontroller or microcontroller don't have ADC then e we can add external ADC chip to controller.

I think this is what I have read in book
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,506
Joined
Jan 21, 2010
Messages
25,506
Your answer is asking to me saying:

A car has two doors and is red.

This defines a subset of cars, not all cars. Likewise your description of an ADC describes a small subset of them.
 

vead

Nov 27, 2011
473
Joined
Nov 27, 2011
Messages
473
Your answer is asking to me saying: A car has two doors and is red. This defines a subset of cars, not all cars. Likewise your description of an ADC describes a small subset of them.
I did some searching and studied about ADC/DAC and SPI

Microcontrollers usually have general purpose input/output pins. these pins are software configurable to either an input or an output state. When pins are configured to an input state, they are often used to read external signals like sensors. Microcontrollers only understand 5v and 0 v signal microcontroller can't read the analog signal So the analog to digital converter is used to convert the incoming data into a form that the micro controller can recognize. many Many microcontrollers have built-in SPI circuit that support SPI protocol. that handle all the details of sending and receiving data, In SPI protocol we can write our own routines to manipulate the I/O lines in the proper sequence to transfer data.

If we don't have inbuilt ADC in microcontroller then we use SPI protocol. We write software program in proper sequence to transfer data. this process is called software ADC.

If we have inbuilt ADC in microcontroller we configure the pin of ADC chip to transfer data using program

I don't have deep understanding about controller architecture but I think this happen for software and hardware ADC but I am not sure
 
Last edited:

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,506
Joined
Jan 21, 2010
Messages
25,506
You are still taking a specific case and assuming it is general.

The first sentence of your second paragraph is great.

The second sentence generalizes enough to be wrong.

The third sentence is a truism, but at least it's not wrong

.the next sentence is wrong (and doesn't have a full stop)

Then you define what an A2D does.

Sentence 6 is ok

Paragraph 3 is wrong. There lack of an internal A2D does not imply SPI that to be used.

Paragraph 4 is mangled, but is true at some level.

In paragraph 5 you extend your mangled description, and invent a software A2D. Whilst there are many ways to implement an A2D, I'm not aware of any that don't require at least some hardware.
 

vead

Nov 27, 2011
473
Joined
Nov 27, 2011
Messages
473
I'm not aware of any that don't require at least some hardware.
i asked this question because i was confuse with SPI and (ADC /DAC). I tried two times to understand difference between them.

I am sorry but your answer is also too confusing for me because you are not telling me what's the wrong I am thinking. you are just telling what's the wrong in paragraph..

SPI Protocol need circuit to perform communication. Generally microcontroller has SPI features. In SPI protocol we write our own routines to manipulate the I/O lines in the proper sequence to transfer data.

ADC/DAC is circuit that support SPI protocols.

For example : if we want to read temperature then i will have to connect ADC with sensor to Microcontroller. microcontroller is master device and ADC is slave device. both device support SPI protocol we can transfer data from master to slave.
 

BobK

Jan 5, 2010
7,682
Joined
Jan 5, 2010
Messages
7,682
The difference between SPI and an ADC is like the difference between a highway and the two cities at each end of it.

The highway gets you from one city to the other.
SPI gets data from one device to the other.

Note that all of these are analogous:

There isn't necessarily a highway between the cities, maybe you can get from one to the other by airplane, or via a hiking trail.
A micro and and ADC might communicate by RS-232 or a parallel port or through a microwave link.

The highway might connect other cities as well.
A SPI bus can have multiple senders and receivers of data.

Maybe one end of the highway is not a city, but a military base or a manufacturing plant.
Maybe the device on the end of your SPI bus is not an ADC but is a flash memory, or a graphics screen.

Bob
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
12,880
Joined
Nov 17, 2011
Messages
12,880
ADC/DAC is circuit that support SPI protocols.
There are ADCs that do.
But there are are also ADCs with I²C interface, parallel interface...

As in post #2: SPI is a protocol (one out of many others possible).
ADC is a function (convert analog value to digital value).
The two of them are not necessarily intertwined. There are ADCs with other protocols and there are SPI circuits with functions other than ADC.
 
Top