Pages: 1 [2] 3   Go Down
Author Topic: send command via rs232  (Read 3555 times)
0 Members and 1 Guest are viewing this topic.
Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 514
Posts: 31534
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 39
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 514
Posts: 31534
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 39
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

0
Offline Offline
Newbie
*
Karma: 0
Posts: 39
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 551
Posts: 46214
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

0
Offline Offline
Newbie
*
Karma: 0
Posts: 39
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 551
Posts: 46214
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

0
Offline Offline
Tesla Member
***
Karma: 118
Posts: 8956
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 514
Posts: 31534
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 39
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 514
Posts: 31534
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 39
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

0
Offline Offline
Newbie
*
Karma: 0
Posts: 39
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 551
Posts: 46214
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
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.
Logged

Pages: 1 [2] 3   Go Up
Jump to: