Sending a string and getting an odd result
Hi all,
I am sending a Hex string to a Projector from raw Hex characters and have to calculate the Checksum. While I have no problem with the checksum calculation, when I send it to the projector it is being changed to 0W.
for example:
SEND_STRING dvPj, "$00,$85,$00,$D0,$01,$01,$00,$57" //Status request
Checksum = 157, use lower of 57
What I see being sent is: Line 2 (07:55:44):: String To [5002:1:1]-[#0#133#0#208#1#1#0W]
Which the projector sees as an incorrect string, and sends no feedback.
Can anyone tell me why the final checksum is being changed to 0W? And what can I do to make it stay the actual character I need?
I appreciate any feedback!
Frustratedly yours,
Tim.
I am sending a Hex string to a Projector from raw Hex characters and have to calculate the Checksum. While I have no problem with the checksum calculation, when I send it to the projector it is being changed to 0W.
for example:
SEND_STRING dvPj, "$00,$85,$00,$D0,$01,$01,$00,$57" //Status request
Checksum = 157, use lower of 57
What I see being sent is: Line 2 (07:55:44):: String To [5002:1:1]-[#0#133#0#208#1#1#0W]
Which the projector sees as an incorrect string, and sends no feedback.
Can anyone tell me why the final checksum is being changed to 0W? And what can I do to make it stay the actual character I need?
I appreciate any feedback!
Frustratedly yours,
Tim.
0
Comments
Personally, I use debugging send_string 0 functions that I created for this, so I can get a more readable format in the telnet session.
///////////////////////////////////////////////////////////// // Char[1000] PrintHex(Char cString[]) // Takes an incoming ASCii string up to MAX_PRINTHEX_INPUT chars // and outputs a hex byte representation of that string. // eg- cCmd = {$23,$5A,$FF} would print as: // "23:5A:FF" ///////////////////////////////////////////////////////////// Define_Function Char[MAX_PRINTHEX_OUTPUT] PrintHex(Char cString[]) { Stack_Var Char cOutput[MAX_PRINTHEX_OUTPUT] Stack_Var Char cTempStr[MAX_PRINTHEX_INPUT]; Stack_Var Char cTmp If (Length_String(cString) AND (Length_String(cString) <= MAX_PRINTHEX_INPUT)) { cTempStr = cString; cOutput = '"'; While(Length_String(cTempStr)) { cTmp = Get_Buffer_Char(cTempStr) cOutput = "cOutput,RIGHT_STRING("'0',ItoHex(cTmp)",2)"; If(Length_String(cTempStr)) cOutput = "cOutput,':'"; } cOutput = "cOutput,'"'" } Else If(Length_String(cString)) { _debug(__LINE__,DEBUG_NOTICE,"'PrintHex incoming string length: ',Itoa(Length_String(cString)),' exceeds maximum default, increase your constant size or break up your calls.'") } Return cOutput; } DEFINE_EVENT Button_Event[dvTP,1] { Push: { Send_String dvProj,"$00,$85,$00,$D0,$01,$01,$00,$57" Send_String 0,"'Sent to dvProj: ', PrintHex("$00,$85,$00,$D0,$01,$01,$00,$57")" } }Thanks Guys!
From the sound of it, I was over reacting to what I was "Seeing" in the send string in the output bar.
I did send the string using the way you suggested Send_String dvPJ, "string,chksum" and it works for every other command that I have (inputs, power, etc.)
Thanks for the clarification, and the cool trick!