Arduino SoftwareRS232.pdf

(298 KB) Pobierz
Arduino Software
RS-232
In this tutorial you will learn how to communicate with a computer using
a MAX3323 single channel RS-232 driver/receiver and a software serial connection on
the Arduino. A general purpose software serial tutorial can be found
here.
Materials needed:








Computer with a terminal program installed (ie. HyperTerminal or
RealTerm on the PC, Zterm on Mac)
Serial-Breadboard cable
MAX3323 chip (or similar)
4 1uf capacitors
Solderless breadboard
Hookup wire
Arduino Microcontroller Module
Light emitting Diode (LED) - optional, for debugging
Prepare the breadboard
Insert the MAX3323 chip in the breadboard. Connect 5V power and ground from the
breadboard to 5V power and ground from the microcontroller. Connect pin 15 on
the MAX233 chip to ground and pins 16 and 14 - 11 to 5V. If you are using an LED
connect it between pin 13 and ground
.
+5v wires are red, GND wires are black
Connect a 1uF capacitor across pins 1 and 3, another across pins 4 and 5, another
between pin 2 and ground, and the last between pin 6 and ground. If you are using
polarized capacitors make sure the negative pins connect to the negative sides (pins 3
and 5 and ground).
+5v wires are red, GND wires are black
Determine which Arduino pins you want to use for your transmit (TX) and recieve (RX)
lines. In this tutorial we will be using Arduino pin 6 for receiving and pin 7 for
transmitting. Connect your TX pin (7) to MAX3323 pin 10 (T1IN). Connect your RX pin
(6) to MAX3323 pin 9 (R1OUT).
TX wire Green, RX wire Blue, +5v wires are red, GND wires are black
Cables
(DB9 Serial Connector Pin Diagram)
If you do not have one already, you need to make a cable to
connect from the serial port (or USB-serial adapter) on your
computer and the breadboard. To do this, pick up a
female DB9 connector from radioshack. Pick three different colors
of wire, one for TX, one for RX, and one for ground. Solder your TX wire to pin 2 of
the DB9 connector, RX wire to pin 3 and Ground to pin 5.
Connect pins 1 and 6 to pin 4 and pin 7 to pin 8. Heatshrink the wire connections to
avoid accidental shorts.
Enclose the connector in a backshell to further protect the signal and enable easy
unplugging from your serial port.
Connect the TX line from your computer to pin 8 (R1IN) on the MAX233 and the RX
line to pin 7 (T1OUT). Connect the ground line from your computer to ground on the
breadboard.
TX wires Green, RX wires Blue, +5v wires are red, GND wires are black
Zgłoś jeśli naruszono regulamin