I'm communicating serialy with a crystalfontz lcd display.
I need to send a command combination that appears like this.
The codes are entered in Hex, 0E means adjust the back light intensity. 32 is Hex for 50 meaning 50% intensity.
The intensity level is entered by the user. The Command is coded with a constant string in slash code mode.
When I try to combine the user entered number to the command I can't get the slash inbetween the command and the value.
I've tried concatenating the strings together and I've tried using a format into string but neither works.
If I manually add the center '\' what actually appears in slash mode is '\\'
Attached are a couple of methods I am working with but to no avail.
Solved! Go to Solution.
Have checked if all string constants is set to show '\' codes
Been there done that.....my self 😉
I don't think you want to actually transmit a slash. Do you actually want to transmit two bytes, one that is ascii code hex 0E or \0E in slash codes, and the second being ascii code hex 32, which doesn't have a slash code because it is the printable character "2". Note the control is set for U8 and is showing the decimal value of 50 which is hex 32.
Yes, all are set to slash codes display.
If I try to Concatenate a slash onto the stiring then 2 slashes are added.
If I try to format into string with the format string constant set to '\' code display when I try to add the '\' before the format specifier, the '\' is removed automatically when I click off the constant.
I do need the slash. I've wired a constant directly to the VISA Write VI in '\' mode and typed in \0E\32 and I get the correct function.
The first byte is the command to adjust the back liight intensity. The 2nd slash value is the hex representation of the percent value for the intensity. In this case 50%
If the 2nd slash is missing then the value after \0E is interpreted as ASCII and displayed on the screen exactly as typed in So \0E32 will display 32 on the screen.
Like I said, there is no such thing as a \32 because it is a printable character. As soon as you enter it, it will convert to "2".
\## will appear for most non-printable ASCII codes. For ASCII codes that are essentially non-printable, but have special meanings like space, tab, new line, return, backspace, they will show up as \character like \s \t \n \r \b. Entering \08 will cause it to convert to "\b", the slash code for backspace.
Try what I posted and see if it works.
EDIT: After your last post.
Then you don't want a \32 which is "2", but you want to send 3 bytes "\" "3" "2" after the first byte of hex 0E or \0E?
I'm not sure if I don't understand what you are getting at or if it is the other way around.
I tried your code and just as you pointed out the display has a 2 on it.
But what I think you might not understand is that to the display the '\' has meaning. When it gets a slash it uses the next byte as a command.
You suggested that \08 would be converted to a "\b" as the ASCII conversion is such. But because the '\' is there the display takes the 08 and maps it to the corresponding command. In this case \08 is the command for "Back Space (destructive)"
In the String Control set to '\' Code Display if I type 08 the display interputs ASCII and displays 08.
If I enter \08 it interprets the command associated and backs up one space deleting the letter in that space.
If I type in \0E the display gets ready to receive a value to change the back light intensity to.
If the next packet it receives starts with a '\' then it accepts the next values as the intesity. If the next packet does not start with a '\' then it will just display the characters as sent.
I can also sent a packet that contains both the back light command \0E and the intesity value \32 in the form of \0E\32 and it will change the intensity of the backlight to 50%.
Do you have a manual, or a link to the manual you can post?
If you want to send a \32 as a slash code, it will show up as a 2 in normal display, a 2 in \display and a 32 in hex display.
If you want to send a \0e as a slash code, it will show up as a box in normal display, a \0E in \display, and a 0E in hex display.
Do you actually want to send 3 bytes?
a hex 0E, a slash character "\", then a single byte value representing the intensity?
If so, use the code I posted, but in the middle of the concatenation add a slash as a string constant. It will show up as \ in normal display, \\ in \display, and as 5C in hex display. (Actually, it could be just part of the initial string constant)
It sounds like the physical display wants a real slash to tell the display the next byte as special meaning and not actually display it. Just like the \ in \codes display has a special meaning in LabVIEW. Your physical display doesn't care that LabVIEW or anything else is on the other end sending it the codes. So don't try to confuse LabVIEW slash codes with the physical display's slash codes. While they are similar in what they are trying to do, they are two different things.
The problem with your original code is that you were sending a hex 0E, a slash, a "3", then a "2". So the physical display was probably intepreting that as intensity 3% followed by a 2 on the display.
Here is the link to the manual
Click on the files tab and open the first PDF Manual. Page 13 has the slash codes.
You are right about the slashes telling the display the next byte has meaning.
you are right about the display not caring who is talking with it. It is just a dumb display. It likes talking RS-232 serial, which I'm not very familiar with.
My codes only problem is that I don't understand how to make a string show up with the appropriate characters when displayed in a string indicator in '\' Codes Display Mode.
I don't know what the VISA Write.vi converts the string to, but I do know that what is written to the VISA Write.vi has to appear as \0E\32 when displayed in the '\' Codes Display mode.
You are half right to say that \32 has no meaning. But if \0E is the byte before \32 then \32 has a lot of meaning. You have to keep in mind that the slashes have meaning to the display and they can't be forgotten.
You noticed that concatenating a \ into the string results as \\ when displayed in '\' mode. I did also, and it doesn't work. The display sees \0E\\32 and looks for the intensity after the 1st slash after the E. It doesnt find a good value so it then displays the 32. Attached is the code I'm working on that includes all of the visa VI's.
Do you know what LabView does with the slashes that appear in '\' code mode when wired to the input of the visa wirte?
If so, we can back up and create a string with the appropriate characters to imply what ever the '\' implies from the '\' codes mode.