And we were trying to teach you.I was approaching the question more from a learning perspective...
If your sensor is on the same board as the processor and the processor has A/D inputs, use analogue. Your sensor can then be a cheap NTC thermistor and they are cheap as chips ("cheap as French fries" doesn't have same ring to it).So, coming back to my original hypothetical question, I think the answer is that under those assumptions, I could choose UART, SPI or I2C because the sensor is on the same PCB, the distance is short, and all three can provide the same temperature data. There isn't necessarily one universally correct choice.
But if the requirements change, then the choice also changes. My understanding is:
If I need a high-speed connection, I would consider SPI because it provides full-duplex communication.
If I need multiple devices on a short shared bus and want to save MCU pins, I would consider I2C because multiple devices can share the same two bus lines.
If I have a simple point-to-point connection between one device and another, I would consider UART.
And if I have multiple nodes where any node may need to initiate communication, I would consider CAN.
So I think the main thing I was trying to understand is that we don't really select a protocol just because it can transfer the required data. We select it based on the system requirements, and those requirements determine which interfaces make more sense and which ones we can reject.
Is that a fair way to look at it?
Maybe. The selection often begins with selecting a device(s) that perform the function at hand. Those devices will then dictate the interface. I know your going the 'hypothetical' route, but that is skewing your quest, and potentially your conclusions. A temp sensor can be a single analog line to wifi. Choose a device and lookup its interface. That's what will drive your design. MCU manufacturers anticipate this by giving an abundance of interface options.We select it based on the system requirements, and those requirements determine which interfaces make more sense and which ones we can reject.
Is that a fair way to look at it?
You can come up with any number of hypothetical situations and each will demand a different outcome.So I think the main thing I was trying to understand is that we don't really select a protocol just because it can transfer the required data. We select it based on the system requirements, and those requirements determine which interfaces make more sense and which ones we can reject.