Page 1 of 1

Sending strings over RS232

Posted: Fri Apr 02, 2010 1:42 pm
by PPerreijn
Hi everybody,

I'm having a rather strange problem when I try to send the contents of a string variable over RS232 to a terminal. Say I want to send the text "TEST" to a terminal display; there are a couple of ways you could do that.
I've made a test program that does the following:
  • Set a string variable (stringvar) to "TEST"
  • Send a fixed string ("TEST") to a terminal using the RS232 component macro > SendRS232String
  • Send TEST as separate characters (bytes 84, 69, 83, 84) using the RS232 component macro > SendRS232Char
  • Send the variable 'stringvar' using the RS232 component macro > SendRS232String
  • Send "TEST" using the RS232 component macro > SendRS232Char
  • Each send test is separated by a carriage return byte (13)
The result of the program can be seen in the following screenshot:

Image

The tests that used the SendRS232String function give the wrong/unreadable characters. In the simulation everything's fine.
I've tried another terminal program (hyperterminal), but it gives the same result. I have attached the program to this post so you can see for yourself.

So I'm not sure if this is a bug or if I'm doing something wrong and should alter some settings. Can anybody please help me? Thanks in advance.

Paul

Re: Sending strings over RS232

Posted: Tue Apr 06, 2010 11:11 am
by Benj
Hello Paul,

I've just checked your program and its working fine here. The only addition I had to make was to add a send macro to transmit a 10 (line feed) as well as the 13 (carriage return) you were already sending.

Re: Sending strings over RS232

Posted: Tue Apr 06, 2010 11:38 am
by PPerreijn
Hello Ben,

That's strange, but you're right. Today I noticed that another Flowcode program suddenly showed the right characters in the terminal program, without having changed anything significant in Flowcode.
It would seem that terminal programs like Tera Term Pro and Hyperterminal sometimes automatically switch the character map/encoding. To give an example; the output of my hardware sometimes switches to Greek characters!
Funny, but inconvenient :lol:
I don't know how to change it in Tera Term, but resetting the hardware and restarting the terminal program seems to work. Thanks anyway for your help.

Paul

Re: Sending strings over RS232

Posted: Thu Mar 14, 2013 4:32 pm
by etillol
Hello,

I'm experiencing the same problem with sendRS232String():
I'm using a software UART on pin RC5 (RX) and RC4 (TX) of a PIC18F87k22 microcontroller.
In the attached .fcf file, I send "TEST" string as separate caracters with SendRS232Char() (the result on the TX line is OK), but when I try to do the same with SendRS232String(), it fails.
Bad caracters are out of the microcontroller with sendRS232String(), here is a logic anaylzer printscreen showing both Hex and ASCII interpretations of the frames:
SendRS232.png
(7.71 KiB) Downloaded 3451 times
I'm using Flowcode V4.5, any idea?
Thank you for your help.

Re: Sending strings over RS232

Posted: Thu Mar 14, 2013 4:52 pm
by LeighM

Re: Sending strings over RS232

Posted: Thu Mar 14, 2013 5:00 pm
by etillol
Thanks LeighM!
Disabling Extended Instruction Set did the trick.
SendRS232.png
(7.48 KiB) Downloaded 3444 times