06 Lec Input - Output
06 Lec Input - Output
2-1
Connecting the Analog and
Digital Worlds
Cyber: Physical:
• Digital • Continuum
• Discrete in time • Continuous in time
• Sequential • Concurrent
Interfaces
• Physical Connection
• Handshake
• Multiple connections
• Timing Characteristics
?
A Typical Microcomputer Board
This board has
analog and digital
inputs and outputs.
What are they?
How do they work?
Parallel vs. Serial Digital Interfaces
Parallel
Multiple data lines transmitting data
Speed
Ex: PCI, ATA, CF cards, Bus
Serial
Single data line transmitting data
Low Power, length
Ex: USB, SATA, SD cards,
PCI-Express
Simple Digital Output: GPIO
Open collector circuits
are often used on GPIO
(general-purpose I/O) pins
of a microcontroller.
void main(void) {
int iTemp0, iTemp1;
//Setup code
while(TRUE) {
disableInterrupts();
iTemp0 = iTemperatures[0];
iTemp1 = iTemperatures[1];
enableInterrupts();
if ( iTemp0 != iTemp1 )
// Set off alarm!
}
}
Shared Data
Data consistency
Critical Section
• Need to protect portion of the code from other access
• Disable interrupts
Compiler Optimizations
• Various optimization techniques
• Volatile keyword, or turn off optimizations