Sending strings over RS232

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
User avatar
PPerreijn
Flowcode V4 User
Posts: 7
Joined: Tue Mar 30, 2010 3:15 pm
Location: Heerlen, The Netherlands
Contact:

Sending strings over RS232

Post 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
Attachments
rs232string_problem.fcf
(6.5 KiB) Downloaded 401 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: Sending strings over RS232

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

User avatar
PPerreijn
Flowcode V4 User
Posts: 7
Joined: Tue Mar 30, 2010 3:15 pm
Location: Heerlen, The Netherlands
Contact:

Re: Sending strings over RS232

Post 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

etillol
Posts: 8
Joined: Tue Feb 12, 2013 3:31 pm
Location: Carpentras, France
Has thanked: 2 times
Been thanked: 3 times
Contact:

Re: Sending strings over RS232

Post 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.
Attachments
testSoftUART.fcf
(5.5 KiB) Downloaded 334 times

User avatar
LeighM
Matrix Staff
Posts: 2178
Joined: Tue Jan 17, 2012 10:07 am
Has thanked: 481 times
Been thanked: 699 times
Contact:

Re: Sending strings over RS232

Post by LeighM »


etillol
Posts: 8
Joined: Tue Feb 12, 2013 3:31 pm
Location: Carpentras, France
Has thanked: 2 times
Been thanked: 3 times
Contact:

Re: Sending strings over RS232

Post by etillol »

Thanks LeighM!
Disabling Extended Instruction Set did the trick.
SendRS232.png
(7.48 KiB) Downloaded 3444 times

Post Reply