Hide minor edits - Show changes to markup
Ahora escribiremos el código para habilitar la comunicación serie. Este programa simplemente esperará un carácter que llegará por el puerto serie, luego lo transmite de vuelta en mayúsculas por el puerto serie. Esta es una buen programa general para comprobar el puerto serie, deberías ser capaz de extrapolarlo para cubrir tus necesidades de puerto serie. Carga el siguiente código en la placa Arduino:
Ahora escribiremos el código para habilitar la comunicación serie. Este programa simplemente esperará un carácter que llegará por el puerto serie, luego lo transmite de vuelta en mayúsculas por el puerto serie. Este es un buen programa general para comprobar el puerto serie, deberías ser capaz de extrapolarlo para cubrir tus necesidades de puerto serie. Carga el siguiente código en la placa Arduino:
(Diagrama de pines del conector serie DB9
(Diagrama de pines del conector serie DB9)
En este tutorial vas a aprender como comunicarte con un ordenador usando un circuito de adaptación RS-232 de un sólo canal (MAX3323) y una conexión serie por software en el Arduino. Un tutorial general sobre Software Serial se puede ver Aquí.
En este tutorial vas a aprender como comunicarte con un ordenador usando un circuito de adaptación RS-232 de un sólo canal (MAX3323) y una conexión serie por software en el Arduino. Un tutorial general sobre Puerto serie por Software se puede ver Aquí.
Abre tu programa terminal de puerto serie y configuralo a 9600 baudios, 8 bits de datos, 1 bit de stop, sin paridad y sin control de flujo. Pulsa el botón de reset de Arduino. La palabra "hi" debería aparecer en la ventana del terminal seguida de un
Open up your serial terminal program and set it to 9600 baud, 8 data bits, 1 stop bit, no parity, no hardware flow control. Press the reset button on the arduino board. The word "hi" should appear in the terminal window followed by an advancement to the next line. Here is a shot of what it should look like in Hyperterminal, the free pre-installed windows terminal application.
Abre tu programa terminal de puerto serie y configuralo a 9600 baudios, 8 bits de datos, 1 bit de stop, sin paridad y sin control de flujo. Pulsa el botón de reset de Arduino. La palabra "hi" debería aparecer en la ventana del terminal seguida de un retorno de carro (CR). Aquí puedes ver una imagen del aspecto del Hyperterminal, la aplicación terminal gratuita preinstalada en windows.
Now, try typing a lowercase character into the terminal window. You should see the letter you typed return to you in uppercase.
Ahora prueba a teclear un carácter en minúscula en la ventana del terminal. Deberías ver las letras que has tecleado devueltas en mayúsculas.
If this works, congratulations! Your serial connection is working as planned. You can now use your new serial/computer connection to print debugging statements from your code, and to send commands to your microcontroller.
code and tutorial by Heather Dewey-Hagborg, photos by Thomas Dexter
Si esto funciona, enhorabuena! tu conexión serie esta funcionada tal como querías. Ahora puedes usar tu nueva conexión serie con el ordenador para envíar estados de depuración de tu código, y envíar comandos a tu microcontrolador.
Código y tutorial de Heather Dewey-Hagborg, fotos de Thomas Dexter
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.
Conecta la línea TX de tu ordenador al pin 8 (R1IN) del MAX3323 y la línea RX al pin 7 (T1OUT). Conecta la lína de tierra (GND) de tu ordenador a la tierra de la placa de entrenamiento.
TX wires Green, RX wires Blue, +5v wires are red, GND wires are black
Now we will write the code to enable serial data communication. This program will simply wait for a character to arrive in the serial recieving port and then spit it back out in uppercase out the transmit port. This is a good general purpose serial debugging program and you should be able to extrapolate from this example to cover all your basic serial needs. Upload the following code into the Arduino microcontroller module:
Cable TX Verde, cable RX azul, cables +5V rojos, cables GND negros
Ahora escribiremos el código para habilitar la comunicación serie. Este programa simplemente esperará un carácter que llegará por el puerto serie, luego lo transmite de vuelta en mayúsculas por el puerto serie. Esta es una buen programa general para comprobar el puerto serie, deberías ser capaz de extrapolarlo para cubrir tus necesidades de puerto serie. Carga el siguiente código en la placa Arduino:
Abre tu programa terminal de puerto serie y configuralo a 9600 baudios, 8 bits de datos, 1 bit de stop, sin paridad y sin control de flujo. Pulsa el botón de reset de Arduino. La palabra "hi" debería aparecer en la ventana del terminal seguida de un
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.
Tapa el conector con una cacasa metálica para proteger la señal y permitir la conexión fácil a tu puerto serie.
Si no tienes uno hecho, necesitas hacer un cable para conectar el puerto serie (o adaptador USB-Serie) de tu ordenador a la placa de entrenamiento. Para esto, coje un conector DB9 de radioshack.
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.
Si no tienes uno hecho, necesitas hacer un cable para conectar el puerto serie (o adaptador USB-Serie) de tu ordenador a la placa de entrenamiento. Para esto, coje un conector DB9 de radioshack. Elige tres colores diferentes de cable, uno para TX, uno para RX y otro para tierra (GND). Suelda el cable TX al pin 2 del conector DB9, el cable RX al pin 3 y GND al pin 5.
Connect pins 1 and 6 to pin 4 and pin 7 to pin 8. Heatshrink the wire connections to avoid accidental shorts.
Conecta los pines 1 y 6 al pin 4 y el pin 7 al pin 8. Aisla las conexiones de los cables para evitar cortocircuitos accidentales.
Connect pins 1 and 6 to pin 4 and pin 7 to pin 8. Heatshrink the wire connections to avoid accidental shorts.
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:
En este tutorial vas a aprender como comunicarte con un ordenador usando un circuito de adaptación RS-232 de un sólo canal (MAX3323) y una conexión serie por software en el Arduino. Un tutorial general sobre Software Serial se puede ver Aquí.
Material necesario:
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.
Conecta el chip MAX3323 en la placa de entrenamiento. Conecta la alimentación de 5V y tierra (GND) de la placa de entrenamiento a los pines de 5V y GND de Arduino. Conecta el pin 15 del chip MAX3323 a tierra y los pines 16 y 14-11 a 5V. Si estas usando un LED, conéctalo entre el pin 13 y GND.
+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 1 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).
Los cables de 5V son rojos, los cables de tierra (GND) son negros
Conecta un condensador de 1 uF entre los pines 1 y 3, otro entre los pines 4 y 5, otro entre el pin 1 y GND y el último entre el pin 6 y GND. Si estás usando condensadores con polaridad asegúrate de que el terminal negativo se conecta a la parte negativa (pines 3 y 5 y GND).
+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).
Los cables de 5V son rojos, los cables de tierra (GND) son negros
Piensa que pines de Arduino quieres usar para tus líneas de transmisión (TX) y recepción (RX). En este tutorial vamos a usar el pin 6 de Arduino para recibir y el pin 7 para transmitir. Conecta tu pin TX (7) al pin 10 del MAX3323 (T1IN). Conecta tu pin RX (6) al pin 9 del MAX3323 (R1OUT)
TX wire Green, RX wire Blue, +5v wires are red, GND wires are black
Cable TX Verde, cable RX azul, cable 5V rojo, cable GND negro
(DB9 Serial Connector Pin Diagram)
(Diagrama de pines del conector serie DB9
Si no tienes uno hecho, necesitas hacer un cable para conectar el puerto serie (o adaptador USB-Serie) de tu ordenador a la placa de entrenamiento. Para esto, coje un conector DB9 de radioshack.
code and tutorial by Heather Dewey-Hagborg Photos by Thomas Dexter
code and tutorial by Heather Dewey-Hagborg, photos by Thomas Dexter
code and tutorial by Heather Dewey-Hagborg
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 http://www.arduino.cc/en/Tutorial/SoftwareSerial?.
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.
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.
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 http://www.arduino.cc/en/Tutorial/SoftwareSerial?.
TX wires Green, RX wires Blue, +5v wires are red, GND wires are black
"+5v wires are red, GND wires are black"
+5v wires are red, GND wires are black
+5v wires are red, GND wires are black
TX wire Green, RX wire Blue, +5v wires are red, GND wires are black
"+5v wires are red, GND wires are black"
Now we will write the code to enable serial data communication. This program will simply wait for a character to arrive in the serial recieving port and then spit it back out in uppercase out the transmit port. This is a good general purpose serial debugging program and you should be able to extrapolate from this example to cover all your basic serial needs. Upload the follwoing code into the Arduino microcontroller module:
Now we will write the code to enable serial data communication. This program will simply wait for a character to arrive in the serial recieving port and then spit it back out in uppercase out the transmit port. This is a good general purpose serial debugging program and you should be able to extrapolate from this example to cover all your basic serial needs. Upload the following code into the Arduino microcontroller module:








//Created August 23 2006 //Heather Dewey-Hagborg //http://www.arduino.cc
If this works, congratulations! Your serial connection is working as planned. You can now use your new serial/computer connection to print debugging statements from your code, and to send commands to your microcontroller.
If this works, congratulations! Your serial connection is working as planned. You can now use your new serial/computer connection to print debugging statements from your code, and to send commands to your microcontroller.
Photos by Thomas Dexter
DB9 Serial Connector Pin Diagram
(DB9 Serial Connector Pin Diagram)
("DB9 Serial Connector Pins")
DB9 Serial Connector Pin Diagram

("DB9 Serial Connector Pins")

PICTURE

PICTURE

PICTURE

Connect the TX line from your computer to pin 8 (R1IN) on the MAX233 and the RX line to pin 7 (T1OUT).
PICTURE
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.

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. Connect a 1uF capacitor across pins 1 and 3, another across pins 4 and 5, another between pin 1 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).
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.
Connect a 1uF capacitor across pins 1 and 3, another across pins 4 and 5, another between pin 1 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).
PICTURE
In this tutorial you will learn how to communicate with a computer using a MAX233 multichannel RS-232 driver/receiver and a software serial connection on the Arduino.
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.

Insert the MAX233 chip in the breadboard. Connect 5V power and ground from the breadboard to 5V power and ground from the microcontroller. Connect pin 6 and pin 9 on the MAX233 chip to ground and pin 7 to 5V. Connect the 1uF capacitor across pins 6 and 7 so that the negative pin connects to pin 6 and the positive pin to pin 7. Connect pin 10 to pin 16 pin 11 to pin 15 and pin 12 to pin 17 on 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. Connect a 1uF capacitor across pins 1 and 3, another across pins 4 and 5, another between pin 1 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).
The MAX233 chip has two sets of RS-232 line shifters built in and can handle two simultaneous duplex serial ports. For the purposes of this tutorial we will only being using one port, with corresponding pins referred to as T1IN, T1OUT, R1IN and R1OUT in the MAX233 schematic.
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 MAX233 pin 2 (T1IN). Connect your RX pin (6) to MAX233 pin 3 (R1OUT).
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).
Connect the TX line from your computer to pin 4 (R1IN) on the MAX233 and the RX line to pin 5 (T1OUT).
Connect the TX line from your computer to pin 8 (R1IN) on the MAX233 and the RX line to pin 7 (T1OUT).
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.

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.
PICTURE in back shell

PICTURE connector soldered,



PICTURE connector soldered, in back shell
PICTURE connector soldered, PICTURE in back shell
Open up your serial terminal program and set it to 9600 baud, 8 data bits, 1 stop bit, no parity, no hardware flow control. Press the reset button on the arduino board. The word "hi" should appear in the terminal window followed by a line feed character and/or an advancement to the next line. Here are two shots of what it might look like, one in Hyperterminal the free pre-installed windows terminal application, and one in Realterm, another free application with more advanced options.
Open up your serial terminal program and set it to 9600 baud, 8 data bits, 1 stop bit, no parity, no hardware flow control. Press the reset button on the arduino board. The word "hi" should appear in the terminal window followed by an advancement to the next line. Here is a shot of what it should look like in Hyperterminal, the free pre-installed windows terminal application.

Open up your serial terminal program and set it to 9600 baud, 8 data bits, 1 stop bit, no parity, no hardware flow control. Press the reset button on the arduino board. The word "hi" should appear in the terminal window followed by a line feed character and/or an advancement to the next line. Here are two shots of what it might look like, one in Hyperterminal the free pre-installed windows terminal application, and one in Realterm, another free application with more options.
Open up your serial terminal program and set it to 9600 baud, 8 data bits, 1 stop bit, no parity, no hardware flow control. Press the reset button on the arduino board. The word "hi" should appear in the terminal window followed by a line feed character and/or an advancement to the next line. Here are two shots of what it might look like, one in Hyperterminal the free pre-installed windows terminal application, and one in Realterm, another free application with more advanced options.
Now, try typing a lowercase character into the terminal window. You should see the letter you typed return to you in uppercase.

If this works, congratulations! Your serial connection is working as planned. You can now use your new serial/computer connection to print debugging statements from your code, and to send commands to your microcontroller.
Open up your serial terminal program and set it to 9600 baud, 8 data bits, 1 stop bit, no parity, no hardware flow control. Press the reset button on the arduino board. The word "hi" should appear in the terminal window followed by a line feed character and an advancement to the next line.
Open up your serial terminal program and set it to 9600 baud, 8 data bits, 1 stop bit, no parity, no hardware flow control. Press the reset button on the arduino board. The word "hi" should appear in the terminal window followed by a line feed character and/or an advancement to the next line. Here are two shots of what it might look like, one in Hyperterminal the free pre-installed windows terminal application, and one in Realterm, another free application with more options.


PICTURE connector soldered
PICTURE connector soldered, in back shell
@]
@]
Open up your serial terminal program and set it to 9600 baud, 8 data bits, 1 stop bit, no parity, no hardware flow control. Press the reset button on the arduino board. The word "hi" should appear in the terminal window followed by a line feed character and an advancement to the next line.
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.
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.
Now we will write the code to enable serial data communication. This program will simply wait for a character to arrive in the serial recieving port and then spit it back out in uppercase out the transmit port. This is a good general purpose serial debugging program and you should be able to extrapolate from this example to cover all your basic serial needs. Upload the follwoing code into the Arduino microcontroller module:
#include <ctype.h>
#define bit9600Delay 84
#define halfBit9600Delay 42
#define bit4800Delay 188
#define halfBit4800Delay 94
byte rx = 6;
byte tx = 7;
byte SWval;
void setup() {
pinMode(rx,INPUT);
pinMode(tx,OUTPUT);
digitalWrite(tx,HIGH);
digitalWrite(13,HIGH); //turn on debugging LED
SWprint('h'); //debugging hello
SWprint('i');
SWprint(10); //carriage return
}
void SWprint(int data)
{
byte mask;
//startbit
digitalWrite(tx,LOW);
delayMicroseconds(bit9600Delay);
for (mask = 0x01; mask>0; mask <<= 1) {
if (data & mask){ // choose bit
digitalWrite(tx,HIGH); // send 1
}
else{
digitalWrite(tx,LOW); // send 0
}
delayMicroseconds(bit9600Delay);
}
//stop bit
digitalWrite(tx, HIGH);
delayMicroseconds(bit9600Delay);
}
int SWread()
{
byte val = 0;
while (digitalRead(rx));
//wait for start bit
if (digitalRead(rx) == LOW) {
delayMicroseconds(halfBit9600Delay);
for (int offset = 0; offset < 8; offset++) {
delayMicroseconds(bit9600Delay);
val |= digitalRead(rx) << offset;
}
//wait for stop bit + extra
delayMicroseconds(bit9600Delay);
delayMicroseconds(bit9600Delay);
return val;
}
}
void loop()
{
SWval = SWread();
SWprint(toupper(SWval));
}
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. Instructions for doing this can be found .
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.

PICTURE connector soldered


PICTURE
PICTURE
Connect the TX line from your computer to pin 4 (R1IN) on the MAX233 and the RX line to pin 5 (T1OUT).
PICTURE

Insert the MAX233 chip in the breadboard. Connect 5V power and ground from the breadboard to 5V power and ground from the microcontroller. Connect pin 6 and pin 9 on the MAX233 chip to ground and pin 7 to 5V. Connect the 1uF capacitor across pins 6 and 7 so that the negative pin connects to pin 6 and the positive pin to pin 7. Connect pin 10 to pin 16 pin 11 to pin 15 and pin 12 to pin 17 on the breadboard.
The MAX233 chip has two sets of RS-232 line shifters built in and can handle two simultaneous duplex serial ports. For the purposes of this tutorial we will only being using one port, with corresponding pins referred to as T1IN, T1OUT, R1IN and R1OUT in the MAX233 schematic.
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 MAX233 pin 2 (T1IN). Connect your RX pin (6) to MAX233 pin 3 (R1OUT).
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. Instructions for doing this can be found .
* Computer with a terminal program installed (ie. HyperTerminal or RealTerm on the PC, Zterm on Mac) * MAX233 chip * 1uf polarized capacitor * Solderless breadboard * Hookup wire * Arduino Microcontroller Module * Light emitting Diode (LED) - optional, for debugging
In this tutorial you will learn how to communicate with a computer using a MAX233 multichannel RS-232 driver/receiver and a software serial connection on the Arduino.
Materials needed:
* Computer with a terminal program installed (ie. HyperTerminal or RealTerm on the PC, Zterm on Mac) * MAX233 chip * 1uf polarized capacitor * Solderless breadboard * Hookup wire * Arduino Microcontroller Module * Light emitting Diode (LED) - optional, for debugging