Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
ADC DAC
Analog and Digital Converter
Input and Output Requirements
12-Bits for the ADC
& 8-Bits for the DAC
=> 20 total Bits
micro
ADC DAC
2 1/2 PORTS
of total I/O
How can we reduce the number
of I/O port pins required?
If you Remember…
• Way back at the beginning of the class
– Discussed the I/O of the microcontroller
– 8-Bit PARALLEL ports used for I/O
– 2-Bit SERIAL port that was used to
communicate with the PC
• Actually send 10-bits of data
– 1 start bit
– 1 stop bit
– 8 data bits
If you Remember…
• Way back at the beginning of the class
– Discussed the I/O of the microcontroller
– 8-Bit PARALLEL ports used for I/O
– 2-Bit SERIAL port that was used to
communicate with the PC
• Actually send 10-bits of data
– 1 start bit
– 1 stop bit
– 8 data bits
Serial Port Communications
• Two basic types of serial communications
– Asynchronous serial communications
• Based on baud rate ( 1 / bit time )
• Requires both devices to be set to the same rate
– Synchronous serial communications
• Based on an external clock signal
• Clock signal “syncs” the two devices
Synchronous Serial
micro
DAC
Digital to Analog Converter
micro
DAC
Digital to Analog Converter
micro
DAC
micro
ADC
Analog to Digital Converter
micro
ADC
Analog to Digital Converter
micro
ADC
7 6 5 4 3 2 1 0
Reading Serial Data
• When Reading Serial Data, it is very
common to use a “shifting” operation
– Get the 1st bit of data
– Shift the data (inside a variable)
– Get the 2nd bit of data
– Shift the data
– …
Reading Serial Data (MSB 1st)
7
7 6
7 6 5
7 6 5 4
7 6 5 4 3 2 1 0
Reading Serial Data (LSB 1st)
0
1 0
2 1 0
3 2 1 0
7 6 5 4 3 2 1 0
Reading Serial Data
}
• If the bit of data is “set” use a Bitwise OR
to set the corresponding bit in the variable
Reading Serial Data (MSB 1st)