Go Down

Topic: send command via rs232 (Read 5095 times) previous topic - next topic

Grumpy_Mike

Quote
connect your TX and RX together...?

Take a wire from the RS232 TX output and connect it to the RS232 TX input.

Then send a byte out, read a byte back and print it out so you can see it on the serial monitor. If everything is working and wired up correctly you should get the same byte back as you sent out.
If you get nothing then it is wired up wrong, broken or something else.
If you get back what you sent then your problem is with the connection between your device and the RS232.
http://en.wikipedia.org/wiki/Loopback

amjlopez

thank you.
I have done the following:
I have connected Arduino to another PC through rs232 and I send data from Arduino and the PC receive and respond.
I'm using a serial program DataViewer (like Hyperterminal) .
Do you know What I am doing wrong with my Extron devices?
many thanks

Grumpy_Mike

You are not testing your external rs232 converter through the pins you have it wired up to using the software serial. That is what you need to test.

amjlopez

excuse me but I don't understand. Is my first time doing this.
thanks again

amjlopez

How can I Take a wire from the RS232 TX output and connect it to the RS232 TX input?

PaulS

Darn. I need to get a new Arduino. None of mine have a smiley face pin to use with NewSoftSerial.

amjlopez

Thank you.
I have read in somewhere that I can use pin0 and pin 1 to send data to an external device with rs232 is that true?
If yes, maybe I have not to use newSoftSerial.

PaulS

Quote
I have read in somewhere that I can use pin0 and pin 1 to send data to an external device

True.

Quote
with rs232

False. You can't send RS232 signals with a TTL chip. You can send TTL level data to a MAX232 chip, which can then output RS232 levels to the device.

You can't talk to two devices using the same set of pins. You can't read from the Serial Monitor and send to your external device on the same set of pins.

zoomkat

Quote
You can't talk to two devices using the same set of pins.


You can send data to numerous devices connected in parallel to the serial pins. Receiving data can have issues.
Google forum search: Use Google Advanced Search and use Http://forum.arduino.cc/index in the "site or domain:" box.

Grumpy_Mike

Quote
How can I Take a wire from the RS232 TX output and connect it to the RS232 TX input?

Why are you having trouble with concept?
You use wire, you solder it from pin 2 to pin 3 on the 9 way D-type connector on your TTL to RS232 converter.
You connect the other pins of this converter to the pins you had before. You then can test if you are talking to this converter or not.

amjlopez

I only want to comunnicate with external device and control it. I don't care what method to use. I'am looking in some books, Google and forums and I cannot comunnicate yet with the device.

Grumpy_Mike

Quote
I only want to comunnicate with external device and control it.

Yes and you have implemented something that if you have actually wired it up like you say should work. What we are trying to do is to help you test it to see where you have gone wrong.

One way to do this is a loop back test but you have trouble in doing what was asked of you.
Your DFROBOT RS232-TTL Converter should be connected to some pins other than 0 & 1. This should be being driven by new software serial. You say it is not working so a loop back test would rule out wiring problems and software problems.
The DFROBOT RS232-TTL Converter has a 9 pin D-type socket on the end I am asking you to connect pin 2 & pin 3, You might need to have a plug to put the wires on or you can do it on the PCB side.

When you have confirmed that this setup is working you can then go on to investigate other things that could go wrong like a miss match in the baud rate or data format between your  DFROBOT and the thing you want to connect it to.

amjlopez

Thank you very much. I'll tried and I'll tell you.

amjlopez

I'm here again.
I have connected pin 2 to 3 to make a loopback. And when I test it I don't get response.
I have changed cables and not work.
This is the code I'm trying to test:

#include <SoftwareSerial.h>
SoftwareSerial MyDevice(7,8);  //  I don't know which is TX and RX...
void setup() {
// begin serial:
Serial.begin(9600);
MyDevice.begin(9600);
}
void loop() {
  if (Serial.available() > 0) {
   
    switch (Serial.read()) {
    case 'a':   
      MyDevice.print("1!");
      Serial.println("sent 1"); //to test in S.Monitor
      break;
    case 'b':   
      MyDevice.print("5!");
      Serial.println("sent 5"); //to test in S.Monitor
      break;
    default:
      break;
      }
}
}

thank you very much.

PaulS

Code: [Select]
SoftwareSerial MyDevice(7,8);  //  I don't know which is TX and RX...
Then, why the hell don't you try to find that out? Look at the source code!

Quote
I have connected pin 2 to 3 to make a loopback. And when I test it I don't get response.

Hardly surprising, since your code does not use pins 2 and 3.

Go Up