I just ran across this today.
If you try to do the following in a String Manipulation Box: cursor = "\"
You'll get the following error when clicking on OK:
One or more string manipulation lines are invalid.
- or -
If you try to use the following in a Calculation Box: cursor[0] = '\'
You'll get this error when trying to compile:
Flowcode was unable to compile the flowchart's C code due to the following errors:
If your flowchart contains C code, please review this carefully.
If your flowchart contains no C-code or you have thoroughly reviewed the code, contact Technical Support.
In both cases this only seems to happen when trying to use the "\" character.
Any ideas or work-a-rounds?
String Character Assignment Problem
- mytekcontrols
- Posts: 95
- Joined: Sun Aug 19, 2007 6:38 pm
- Location: Santa Rosa, California
- Has thanked: 4 times
- Been thanked: 7 times
- Contact:
String Character Assignment Problem
Michael St. Pierre
FlowCode V3&V4 Pro Registered User
Manufacture: Heat Load Controllers,
and a variety of other widgets.
FlowCode V3&V4 Pro Registered User
Manufacture: Heat Load Controllers,
and a variety of other widgets.
- Steve
- Matrix Staff
- Posts: 3433
- Joined: Tue Jan 03, 2006 3:59 pm
- Has thanked: 114 times
- Been thanked: 422 times
The "\" character is used as an "escape" character to allow you to enter special characters into a string. For example:
Unfortunately, it looks like the latter does not work well with the LCD component. The simulation does not work (it displays 2 backslash characters).
It does work correctly in hardware, but the backslash character in the LCD character set is replaced with a yen symbol (I think).
Code: Select all
\n = a carriage return
\t = tab
\" = quote
\\ = backslash
It does work correctly in hardware, but the backslash character in the LCD character set is replaced with a yen symbol (I think).
- mytekcontrols
- Posts: 95
- Joined: Sun Aug 19, 2007 6:38 pm
- Location: Santa Rosa, California
- Has thanked: 4 times
- Been thanked: 7 times
- Contact:
Hi Steve,
I tried cursor = "\\" in the String Manipulation Box and it still chokes, although cursor = "\n" is accepted (but unfortunately not what I want).
Just to give you an idea of what I am trying to do, this is the actual string I wish to define: cursor = "|/-\|/-\" This will be used within a loop, where I will extract 1 character at a time (in sequence) and display it as a rotating cursor on the LCD.
Pseudo code:
Define Variables: cursor[8], ctemp[1]
String Manipulate: cursor = "|/-\|/-\" (initialize)
While 1 (main loop)
LCD Cursor: Home,0 (position cursor)
Calculation: ctemp[0] = cursor[loop]
LCD PrintString: ctemp
Calculation: loop = loop + 1 (move pointer to next character)
If loop >= 8 then loop = 0
Delay: 50ms
Wend
If the "\\" would work as you mentioned, this would be acceptable for forming the string. example String Manipulate: cursor = "|/-\\|/-\\"
Any possibility that this can be made to work in the next FlowCode update?
I tried cursor = "\\" in the String Manipulation Box and it still chokes, although cursor = "\n" is accepted (but unfortunately not what I want).
Just to give you an idea of what I am trying to do, this is the actual string I wish to define: cursor = "|/-\|/-\" This will be used within a loop, where I will extract 1 character at a time (in sequence) and display it as a rotating cursor on the LCD.
Pseudo code:
Define Variables: cursor[8], ctemp[1]
String Manipulate: cursor = "|/-\|/-\" (initialize)
While 1 (main loop)
LCD Cursor: Home,0 (position cursor)
Calculation: ctemp[0] = cursor[loop]
LCD PrintString: ctemp
Calculation: loop = loop + 1 (move pointer to next character)
If loop >= 8 then loop = 0
Delay: 50ms
Wend
If the "\\" would work as you mentioned, this would be acceptable for forming the string. example String Manipulate: cursor = "|/-\\|/-\\"
Any possibility that this can be made to work in the next FlowCode update?
Michael St. Pierre
FlowCode V3&V4 Pro Registered User
Manufacture: Heat Load Controllers,
and a variety of other widgets.
FlowCode V3&V4 Pro Registered User
Manufacture: Heat Load Controllers,
and a variety of other widgets.
- mytekcontrols
- Posts: 95
- Joined: Sun Aug 19, 2007 6:38 pm
- Location: Santa Rosa, California
- Has thanked: 4 times
- Been thanked: 7 times
- Contact:

I'll have to re-think this

However it probably would be good to have the back slash problem fixed for devices that can display it, such as a CRT terminal connected via RS232.
Michael St. Pierre
FlowCode V3&V4 Pro Registered User
Manufacture: Heat Load Controllers,
and a variety of other widgets.
FlowCode V3&V4 Pro Registered User
Manufacture: Heat Load Controllers,
and a variety of other widgets.
- mytekcontrols
- Posts: 95
- Joined: Sun Aug 19, 2007 6:38 pm
- Location: Santa Rosa, California
- Has thanked: 4 times
- Been thanked: 7 times
- Contact:
I have come up with a solution for the spinning cursor program missing a Back Slash "\" character. I found a display with an enhanced character set, that just happens to include the missing character (New Haven p/n M0216MD-162MDBR2-J). This is actually a large digit, 2 line x 16 character Vacuum Fluorescent Display that uses a standard LCD interface.
The only problem is that the "\" is not mapped into the standard ASCII position for this character, so it did require a slightly different approach as I have listed below.
Pseudo code:
Define Variables: cursor[4], ctemp[1]
Equate String to = Spinning Cursor Characters:
cursor[0] = '/'
cursor[1] = '-'
cursor[2] = 140 (140 = mapped "\" character location)
cursor[3] = '|'
While 1 (main loop)
LCD Cursor: Home,0 (position cursor)
Calculation: ctemp[0] = cursor[loop]
LCD PrintString: ctemp
Calculation: loop = loop + 1 (move pointer to next character)
If loop >= 4 then loop = 0
Delay: 50ms
Wend
In the above program I also figured out that I only needed to construct a 4 character string array to hold my animated spinning cursor characters (I don't know what I was thinking in my first example, where I had defined an 8 character array).
By the way, this will also work on a Noritake-itron CU16029ECPB-W1J Vacuum Fluorescent Display as well, although the New Haven display will cost you considerably less. The reason I decided to use a Vacuum Fluorescent Display instead of an LCD is because I really like the high contrast blue/green display. For someone that still wishes to use an LCD, I would imagine that these companies (or others) probably also manufacture an LCD with the same enhanced character set. And of course one could also make use of the CG RAM to serve up a custom character that was pre-defined as "\" as well.
End Result: It looks really cool
NewHaven 2x16 character (31mm x 108mm Actual Display Area) VFD Display ($45): http://www.newhavendisplay.com/index.cf ... prd150.htm
The only problem is that the "\" is not mapped into the standard ASCII position for this character, so it did require a slightly different approach as I have listed below.
Pseudo code:
Define Variables: cursor[4], ctemp[1]
Equate String to = Spinning Cursor Characters:
cursor[0] = '/'
cursor[1] = '-'
cursor[2] = 140 (140 = mapped "\" character location)
cursor[3] = '|'
While 1 (main loop)
LCD Cursor: Home,0 (position cursor)
Calculation: ctemp[0] = cursor[loop]
LCD PrintString: ctemp
Calculation: loop = loop + 1 (move pointer to next character)
If loop >= 4 then loop = 0
Delay: 50ms
Wend
In the above program I also figured out that I only needed to construct a 4 character string array to hold my animated spinning cursor characters (I don't know what I was thinking in my first example, where I had defined an 8 character array).
By the way, this will also work on a Noritake-itron CU16029ECPB-W1J Vacuum Fluorescent Display as well, although the New Haven display will cost you considerably less. The reason I decided to use a Vacuum Fluorescent Display instead of an LCD is because I really like the high contrast blue/green display. For someone that still wishes to use an LCD, I would imagine that these companies (or others) probably also manufacture an LCD with the same enhanced character set. And of course one could also make use of the CG RAM to serve up a custom character that was pre-defined as "\" as well.
End Result: It looks really cool

NewHaven 2x16 character (31mm x 108mm Actual Display Area) VFD Display ($45): http://www.newhavendisplay.com/index.cf ... prd150.htm
Michael St. Pierre
FlowCode V3&V4 Pro Registered User
Manufacture: Heat Load Controllers,
and a variety of other widgets.
FlowCode V3&V4 Pro Registered User
Manufacture: Heat Load Controllers,
and a variety of other widgets.