HEX char, Touch Panel. Please help! )
patriot_stv
Posts: 26
Good day!
Please tell me how to solve the following problem.
Get a string from the device and send it to the Touch Panel using the command SEND_COMMAND Panel, "'^ TXT-101,0,', data.text"
a problem in that the characters appear in a line in a different order in HEX representation which are determined by the table
How can I make the correct display of characters on the touch panel?
Example string that I get from the device "$EE$82$20 18 $EE$82$82 01:20:33"
Please tell me how to solve the following problem.
Get a string from the device and send it to the Touch Panel using the command SEND_COMMAND Panel, "'^ TXT-101,0,', data.text"
a problem in that the characters appear in a line in a different order in HEX representation which are determined by the table
How can I make the correct display of characters on the touch panel?
Example string that I get from the device "$EE$82$20 18 $EE$82$82 01:20:33"
0
Comments
The other part of you question is just simpler string parsing.
I have a thought, parse the string character by character. And sends the symbol on the touch panel to indicate what color it should be, what fills and what font.
But, for some reason, it seems to me that there must be an easier way.
If the button don't display in the same physical space as other of the special characters you could just do a simple channel button with no image in the off state and the image you want for the that channel in the on state. You could also use the ^SHO command and make them invisible when they shouldn't be displayed and visible when they should be.
I personally would just use the multi-state bargraph cuz sending levels is pretty darn easy and any button can have as many states as you feel like making and each state can have it's own text or image. If you want state 1, send level 1, state 5, send level 5, etc, etc, etc. You just gotta come up with the graphics for each state and put them into your TP design.
I solved the problem in the following way:
I know that the string can have a maximum of 80 characters (including the fact that three bytes of the special characters are converted to a single character on the screen). Therefore, the cells 80 created on the screen.
Then parse the string according to these
DEFINE_FUNCTION char[80] string_fn (char fString [100]){
stack_var integer i
stack_var integer n
stack_var razb_stroka [80]
for (i=3; i<=100; i++) {
razb_stroka = "razb_stroka,type_cast(mid_string(fString,i,1))"
n = length_string (razb_stroka)
if (find_string (razb_stroka,"$EE,$82,$80",1)) {razb_stroka = "mid_string (razb_stroka, 1, n-3),$80"}
if (find_string (razb_stroka,"$EE,$82,$82",1)) {razb_stroka = "mid_string (razb_stroka, 1, n-3),$82"}
if (find_string (razb_stroka,"$EE,$82,$97",1)) {razb_stroka = "mid_string (razb_stroka, 1, n-3),$97"}
if (find_string (razb_stroka,"$EE,$82,$85",1)) {razb_stroka = "mid_string (razb_stroka, 1, n-3),$85"}
if (find_string (razb_stroka,"$EE,$82,$84",1)) {razb_stroka = "mid_string (razb_stroka, 1, n-3),$84"}
if (find_string (razb_stroka,"$EE,$82,$92",1)) {razb_stroka = "mid_string (razb_stroka, 1, n-3),$92"}
if (find_string (razb_stroka,"$EE,$82,$87",1)) {razb_stroka = "mid_string (razb_stroka, 1, n-3),$87"}
if (find_string (razb_stroka,"$EE,$82,$8E",1)) {razb_stroka = "mid_string (razb_stroka, 1, n-3),$8E"}
if (find_string (razb_stroka,"$EE,$82,$89",1)) {razb_stroka = "mid_string (razb_stroka, 1, n-3),$89"}
if (find_string (razb_stroka,"$EE,$82,$93",1)) {razb_stroka = "mid_string (razb_stroka, 1, n-3),$93"}
if (find_string (razb_stroka,"$EE,$82,$8C",1)) {razb_stroka = "mid_string (razb_stroka, 1, n-3),$8C"}
if (find_string (razb_stroka,"$EE,$82,$8F",1)) {razb_stroka = "mid_string (razb_stroka, 1, n-3),$8F"}
if (find_string (razb_stroka,"$EE,$82,$8A",1)) {razb_stroka = "mid_string (razb_stroka, 1, n-3),$8A"}
if (find_string (razb_stroka,"$EE,$82,$8B",1)) {razb_stroka = "mid_string (razb_stroka, 1, n-3),$8B"}
if (find_string (razb_stroka,"$EE,$82,$81",1)) {razb_stroka = "mid_string (razb_stroka, 1, n-3),$81"}
if (find_string (razb_stroka,"$EE,$82,$83",1)) {razb_stroka = "mid_string (razb_stroka, 1, n-3),$83"}
if (find_string (razb_stroka,"$EE,$82,$94",1)) {razb_stroka = "mid_string (razb_stroka, 1, n-3),$94"}
if (find_string (razb_stroka,"$EE,$82,$98",1)) {razb_stroka = "mid_string (razb_stroka, 1, n-3),$98"}
if (find_string (razb_stroka,"$EE,$82,$99",1)) {razb_stroka = "mid_string (razb_stroka, 1, n-3),$99"}
if (find_string (razb_stroka,"$EE,$82,$9A",1)) {razb_stroka = "mid_string (razb_stroka, 1, n-3),$9A"}
if (find_string (razb_stroka,"$EE,$82,$88",1)) {razb_stroka = "mid_string (razb_stroka, 1, n-3),$88"}
if (find_string (razb_stroka,"$EE,$82,$95",1)) {razb_stroka = "mid_string (razb_stroka, 1, n-3),$95"}
if (find_string (razb_stroka,"$EE,$82,$96",1)) {razb_stroka = "mid_string (razb_stroka, 1, n-3),$96"}
if (find_string (razb_stroka,"$EE,$82,$90",1)) {razb_stroka = "mid_string (razb_stroka, 1, n-3),$90"}
if (find_string (razb_stroka,"$EE,$82,$91",1)) {razb_stroka = "mid_string (razb_stroka, 1, n-3),$91"}
if (find_string (razb_stroka,"$EE,$82,$8D",1)) {razb_stroka = "mid_string (razb_stroka, 1, n-3),$8D"}
if (find_string (razb_stroka,"$EE,$80,$80,$EE,$80,$81,$EE,$80,$82",1)) {razb_stroka = "mid_string (razb_stroka, 1, n-9),'END'"}
}
return razb_stroka
}
DEFINE_FUNCTION integer send_char (char fString [80]){
stack_var integer n
stack_var char schar
for (n=1; n<=80; n++) {
schar = type_cast(mid_string(fString,n,1))
switch (schar) {
case $80: SEND_COMMAND Panel,"'^BMF-',itoa(n),',0,%F19%CF00%CTBlack'"
SEND_COMMAND Panel, "'^TXT-',itoa(n),',0,T'"
case $82: SEND_COMMAND Panel,"'^BMF-',itoa(n),',0,%F34%CF255%CTWhite'" //play
SEND_COMMAND Panel, "'^UNI-',itoa(n),',0,0041'"
case $97:
case $85:SEND_COMMAND Panel,"'^BMF-',itoa(n),',0,%F19%CF00%CTBlack'"
SEND_COMMAND Panel, "'^TXT-',itoa(n),',0,A'"
case $84:SEND_COMMAND Panel,"'^BMF-',itoa(n),',0,%F19%CF00%CTBlack'"
SEND_COMMAND Panel, "'^TXT-',itoa(n),',0,C'"
case $92:SEND_COMMAND Panel,"'^BMF-',itoa(n),',0,%F19%CF00%CTBlack'"
SEND_COMMAND Panel, "'^TXT-',itoa(n),',0,F'"
case $87:SEND_COMMAND Panel,"'^BMF-',itoa(n),',0,%F19%CF00%CTBlack'"
SEND_COMMAND Panel, "'^TXT-',itoa(n),',0,G'"
case $8E:SEND_COMMAND Panel,"'^BMF-',itoa(n),',0,%F19%CF00%CTBlack'"
SEND_COMMAND Panel, "'^TXT-',itoa(n),',0,I'"
case $89:SEND_COMMAND Panel,"'^BMF-',itoa(n),',0,%F19%CF00%CTBlack'"
SEND_COMMAND Panel, "'^TXT-',itoa(n),',0,L'"
case $93:SEND_COMMAND Panel,"'^BMF-',itoa(n),',0,%F19%CF00%CTBlack'"
SEND_COMMAND Panel, "'^TXT-',itoa(n),',0,M'"
case $8C:SEND_COMMAND Panel,"'^BMF-',itoa(n),',0,%F19%CF00%CTBlack'"
SEND_COMMAND Panel, "'^TXT-',itoa(n),',0,R'"
case $8F:SEND_COMMAND Panel,"'^BMF-',itoa(n),',0,%F19%CF00%CTBlack'"
SEND_COMMAND Panel, "'^TXT-',itoa(n),',0,S'"
case $8A:
case $8B:
case $81:SEND_COMMAND Panel,"'^BMF-',itoa(n),',0,%F34%CF255%CTWhite'" //pause
SEND_COMMAND Panel, "'^UNI-',itoa(n),',0,0043'"
case $83:SEND_COMMAND Panel,"'^BMF-',itoa(n),',0,%F34%CF255%CTWhite'" //stop
SEND_COMMAND Panel, "'^UNI-',itoa(n),',0,0042'"
case $94:
case $98:
case $99:
case $9A:
case $88:
case $95:
case $96:
case $90:SEND_COMMAND Panel,"'^BMF-',itoa(n),',0,%F19%CF255%CTWhite'"
SEND_COMMAND Panel, "'^TXT-',itoa(n),',0,*'"
case $91:SEND_COMMAND Panel,"'^BMF-',itoa(n),',0,%F19%CF00%CTBlack'"
case $8D:SEND_COMMAND Panel,"'^BMF-',itoa(n),',0,%F19%CF00%CTBlack'"
SEND_COMMAND Panel, "'^TXT-',itoa(n),',0,Z'"
default: SEND_COMMAND Panel,"'^BMF-',itoa(n),',0,%F19%CF255%CTWhite'"
SEND_COMMAND Panel, "'^TXT-',itoa(n),',0,',schar"
}
}
}
DATA_EVENT [dvReciv] { string: {
if (length_string(dispalay_string) >=80 ) {
razbor_simvol = string_fn (dispalay_string)
send_char (razbor_simvol)
}
}}
Works as it should.
Only significant delay)