Hardware Reference
In-Depth Information
This table shows a summary, and lists the characteristics, of a few serial protocols mentioned in the topic.
Synchronous Serial Protocols
Asynchronous Serial Protocols
Asynchronous Serial bus Protocols
• Master-slave relationship between
devices
• Several devices share the same
data lines
• Needs a clock line from the master
to slaves
• Distance: 1m or less
• Various voltage ranges, commonly
5V or 3.3V
• No common clock, but agreement
on data rate
• Typically used for one-to-one
communication, not networks
• No common clock, but agreement
on data rate
• Often used for longer distances or
networks
• Typically differential signaling
• 3 to 4 wires: Data+, Data-, Ground,
Voltage (optional)
I2C/TWI
• 3 wires: Data, Clock, Ground
• Each slave gets a unique address,
sent first
TTL Serial
• Various voltage ranges, commonly
5V or 3.3V
• 3 wires: Transmit, Receive, Ground
• Logic: +V = logic 1, 0V = logic 0
• Distance: typically 1m or less
uSb
• Voltage range: 0 to 5V
• Distance: 10m or less
SPI
• 4 + n wires: Master In Slave Out
(MISO), Master Out Slave In
(MOSI), Clock, Ground, 1 Chip
Select for each slave device
• Addressing is done using chip
select lines
RS-232
• Voltage range:
±
3 to
±
15V
• Logic: -V = logic 1, +V = logic 0
• 0V has no logical meaning
• Distance: 300m or less
RS-485 (DMX-512)
• Voltage range: -7 to +12V
• Distance: 1200m or less
Plan the Physical System and
Information Flow Early
When you know your physical communications protocol
options, you can plan how things communicate before you
begin to program or configure anything. Doing so will save
you a lot of time.
To plan a project like that, you can (and should) diagram
the flow of information between all the elements, as you
saw in Figures 10-3 and 10-4, so you know what each one
needs from the others. Consider what pins of your micro-
controller are available for the various functions you need.
Decide where images and web pages are best served from,
and what links and permissions are required to make it all
happen. Consider which way data flows, and who needs to
know whose address. Decide where you'll place the server
and the camera physically, and how you will house them.
That way, you can reduce your actual production workload,
and concentrate on building only what you need in code, in
circuits, and in materials.
Consider the CatCam web server in Chapter 10. It involved
several devices:
• Microcontroller
• Ethernet controller
• SD card
• Temperature sensor
• Relay control
• IP-based camera