RS232 issue

Hi,
I try to get the software logview (www.logview.info) reading my output and showin it on the screen graphically.

I started by sending a “$” which is the first thing to submit.
I did it with the code:

void setup()   {                
 Serial.begin(9600);      // open the serial port at 9600 bps:    
 }

 void loop(){
Serial.print("$");  //$
delay(500);
  }

Looking to the debugging of Logiview the system only shows:

Daten als ASCII = '<NUL>??'
Daten als HEX = '008080'

:-/

The .ini file explains the adjustments in Logview:

[Gerät]
Name                            = test
Hersteller                      = faust
Gruppe                          = 09
Device_ID                       = ID_OPENFORMAT
Used                            = 1
Abbildung                       = OpenFormat.jpg
ChangeSettings                  = 1
HerstellerLink1                 = 
HerstellerLink2                 = 
LogViewLink                     = www.logview.info
TimeStep_ms                     = 1000
TimeGiven                       = 0
KanalAnzahl                     = 1
WerteFormat                     = ASCII
Prüfsummenberechnung            = keine
PrüfsummenFormat                = ASCII

[Stati]
StatiAnzahl                     = 1
001                             = test

[serielle Schnittstelle]
Port                            = COM1
Baudrate                        = 9600
Datenbits                       = 8
Stopbits                        = 1
Parität                         = 0
Flusskontrolle                  = 0
ClusterSize                     = -10
SetDTR                          = 0
SetRTS                          = 0

[Schnittstelle TimeOuts]
RTOCharDelayTime                = 290
RTOExtraDelayTime               = 100
WTOCharDelayTime                = 290
WTOExtraDelayTime               = 100

[Anzeige Einstellungen Kanal 01]
Zeitbasis                       = Zeit
Einheit                         = s
Symbol                          = t
WerteAnzahl                     = 2

Messgröße1                      = voltager
Einheit1                        = vgt
Symbol1                         = 
Faktor1                         = 1.0
OffsetWert1                     = 0.0
OffsetSumme1                    = 0.0

What did I do wrong?

Your code looks ok, but your subject suggests that you may not know the difference between TTL serial (as used by Arduino) and RS-232 serial (as used by standard PC com ports). The signal levels are not compatible as the PC will use +/- 12V and the Arduino will use 0 and 5V. Not only will it not work, but it is also a high risk that you damage your Arduino as you will exceed the maximum allowed voltage on the IO pins.

If above applies, the solution is to put a level converter in between that can communicate with the PC on one side and the Arduino on the other side.

BenF,
thanks for the unerstanding. I connected the board via USB to the PC. So I used TTL serial...

I connected the board via USB to the PC. So I used TTL serial...

That doesn't follow. Most USB / serial cables generate RS232 voltages NOT TTL voltages.

RS232 is +12 to -12V, TTL is +5V to 0V

To make matters worse the signal level represented by +5V on TTL is represented by -12V on RS232 so it is logically inverted as well.

I connected the board via USB to the PC. So I used TTL serial...

In your Logview config file, port is specified as COM1 and low numbered COM ports are typically reserved for physical RS-232 ports. If your board (e.g. a Duemillanove) is connected via USB it will typically be mapped to COM4 (or higher) on a Windows PC. Logview should be configured to use the same port as you use for uploading sketches.

Please bear in mind that I do receive data but:

  • Arduino shows what I expect
  • Logview is showing strange things

I suspect I did not really understand the Terminal part of both programs or the coding does not work. :-[

I think Logview is a very valuable tool as it shows all measurement data and can record it very easy! ;D

I need help to understand why those strange data are received by Logview and not in Arduino…heeeeelp!

I need help to understand why those strange data are received by Logview

My guess is as I said before:-

the signal level represented by +5V on TTL is represented by -12V on RS232 so it is logically inverted as well.

You have a logic inversion, when this happens you receive rubbish, strange symbols and characters.

You need to check what you are actually feeding into what.

Grumpy_Mike,
I hope I can answer that question properly as I am not a real expert on that.

I connected the Arduino via USB to my Laptop (the laptop does not have a 9 PIN RS232). I did not use any Arduino pin. So I suspect I have 5V TTL.

My understanding (and please correct me if I am wrong) is that the FTDI chip is taking the serial data and converts is to a USB "readable" format- that's why I can read the data in the Arduino programmning software. So I thought the data where in the correct form to be read by other software.

[serielle Schnittstelle]
Port = COM1
Baudrate = 9600
Datenbits = 8
Stopbits = 1

Above is the information you provided. If you connected your Arduino to COM1 then what Mike and I said applies - you need a level converter.

If your Arduino is connected to a different port - you must change the above file so that "PORT = ????" matches the COM port you use when uploading programs to the Arduino.

So I thought the data where in the correct form to be read by other software

Are you reading the $ characters when you use the arduino's monitor window? Then you close that and try an read things with your logging software? So there is no difference in any hardware connection?

If this is true....
Then if you are sending a series of $ so that is 0x24 but you are getting back 0x00, 0x80, 0x80.
The only thing that could account for that is a gross miss match in baud rate. The $ has two logic ones in it and the 0x80,0x80 has two ones in it.

Are you reading the $ characters when you use the arduino’s monitor window? Then you close that and try an read things with your logging software? So there is no difference in any hardware connection?

That is exactly what I have done.

But I only send ONE time the “$” and I receive

Daten als ASCII = '<NUL>??'
Daten als HEX = '008080'

Your problem is with the logview software. Unfortunately while my German is good enough to order a round of drinks it is not up to reading the site. :frowning:

Check again and see if it needs any formatting of the data. By that I mean does it need to be ASCII data or hex values and does it need to be terminated by a CR or LF (or both). It look to me as if your software is not recognising what is being sent and is just reporting some junk in the buffer.

If this is true....
The only thing that could account for that is a gross miss match in baud rate.

Not so - if he's PC software reads from a different port.

Not so - if he's PC software reads from a different port.

OK so lets ask the question. When you select the port to upload the code into the Arduino do you select COM1?
If so you are using the same port as you are specifying for the logview software. If not then use the same COM port number in logview as you know works for the arduino.

Before debugging logview, try setting hyperterminal to receive on the com port in question to capture everything coming to the port.

use device manager to figure out which com port. As stated above, if it's the USB/Com? it will be a port number higher than 4. Make sure the port metrics in hyperterm match the arduino.

I have some similar problems in VB until I disabled RTS and handshaking in my VB app.