Elk Display Text On LCD Screen (dm)

ultrajones

Active Member
I am having a very hard time trying to get a message to display reliably on my Elk M1 keypad. I am sending the following command to the Elk, but the keypad won't display the message.

This does NOT work( line one with 8 characters and line 2 with 8 characters):
2Edm11100000Line one^1234567Line two^12345670055

This will work (sending line one with 16 characters and line 2 with 16 characters):
2Edm11100000123456789012345612345678901234560051

It seems as soon as I introduce the line terminator "^", the message won't display.

Suggestions anyone?

Regards,
Ultrajones
 
Here's a fragment of the code I used in my ELK M1 driver:

Code:
	sMsgTxt1 = this.MessageLine1
	if len(sMsgTxt1) < 16 then sMsgTxt1 = sMsgTxt1 & "^"
	
	sMsgTxt2 = this.MessageLine2
	if len(sMsgTxt2) < 16 then sMsgTxt2 = sMsgTxt2 & "^"
	
	sMsgTxt1 = left(sMsgTxt1 & string(16, "X"), 16)
	sMsgTxt2 = left(sMsgTxt2 & string(16, "X"), 16)
	
	if this.MessageBeep then sBeep = "1"
	
	sCmd = "dm" & this.MessageArea & this.MessageMode & sBeep & _
			ZeroPadLeft(this.MessageTimer, 5) & sMsgTxt1 & sMsgTxt2 
	this.Parent.SendCommand(MakePacket(sCmd))

In a nutshell, if the text line is less than 16 characters long, I append a caret ("^"). Then I append a string, containing 16 X's, to the text line and finally truncate it to 16 characters in length. This handles all cases where the text line can be empty, contains exactly 16 characters, or more than 16 characters (i.e. user-entry error). The balance of the code combines all of the elements into an M1 command, creates a packet, and transmits it.

Just for fun, replace the numeric padding ("1234567") with X's (and recalculate the checksum). It sounds lame but give it a shot. I seem to recall I ran into trouble with this as well and it had something to do with the padding.
 
To display on the LCD screen, you do not need a line terminator. If you use two lines, the second line will be alternately displayed on the bottom line after the first line.
 
To display on the LCD screen, you do not need a line terminator. If you use two lines, the second line will be alternately displayed on the bottom line after the first line.

UnltraJones and I are just following what the manual suggests. From "M1 Control RS-232 ASCII String Protocol" (R1.68) page 29:

Enter the line terminator, “^”, as the ending character of the line display if less than 16 characters are to be displayed.

Example: 2Edm11100020abc^efghijklmnopABCDEF^HIJKLMNOP00B2
Would display “abc” on the first line and “ABCDEF” on the second line
If the second line is not needed, enter a “^”as the first character of the second line. The second line will be scrolled with the first line if it is included.
 
To display on the LCD screen, you do not need a line terminator. If you use two lines, the second line will be alternately displayed on the bottom line after the first line.

UnltraJones and I are just following what the manual suggests. From "M1 Control RS-232 ASCII String Protocol" (R1.68) page 29:

Enter the line terminator, “^â€, as the ending character of the line display if less than 16 characters are to be displayed.

Example: 2Edm11100020abc^efghijklmnopABCDEF^HIJKLMNOP00B2
Would display “abc†on the first line and “ABCDEF†on the second line
If the second line is not needed, enter a “^â€as the first character of the second line. The second line will be scrolled with the first line if it is included.

Yes, I was also following what the manual stated. I was able to get it working by padding line 1 and line 2 with spaces, but if I don't have a line 2 then it displays a blank message for line 2. As I stated before,, as soon as I introduce the line terminator "^" it won't display the message at all ...
 
Does anyone have a list of valid ASCII charaters than can be displayed on the Elk M1 Keypad? I have found that sending an unsupported character (e.g. ° or %) causes the message to be discarded. I would like to build a function to strip out the characters that can't be displayed.

Regards,
Ultrajones
 
Does anyone have a list of valid ASCII charaters than can be displayed on the Elk M1 Keypad?
...
I would like to build a function to strip out the characters that can't be displayed.

Good question ... I don't believe that list is documented. My 1st guess would be the basic ASCII character set is valid but you've already proven that isn't true (i.e. % is discarded). I guess the list can be determined through trial and error ...

Your validation function can use Regular Expressions to efficiently exclude illegal characters. I don't know what programming language you're using but most of them support RegEx. The trickiest part is building the RegEx filter. A very handy (free) tool is Expresso ... it helps you interactively construct the RegEx and test-drive it with sample data. Highly recommended! Here's a good site for learning about RegEx.

Here's a function I created, for my ELK M1 driver for Premise, that ensures an object's name is compliant with VBScript's naming convention. Illegal characters are replaced with the underscore character ("_") in two passes; the 1st pass looks for illegal characters and the 2nd pass eliminates any leading numeric characters.


Code:
' Restrict text to VBscript compliant characters
function LegalName(sData)
dim re
const sSubst = "_"

   set re = new RegExp
   with re
	  .pattern = "[^a-z0-9\-_]" ' Restrict to legal characters
	  .ignoreCase = true
	  .global = true
	  sData = .Replace(sData, sSubst)
	  .pattern = "^[0-9]" ' Eliminate leading numeric character
	  Legalname = .Replace(sData, sSubst)
   end with
   set re = nothing
end function
 
Back
Top