Sending Ctrl Characters/non-text characters via serial..
Posted: Wed Dec 10, 2003 11:52 pm
How in the heck do I send something like this via a serial command:
Chr(0) + "VOL2B" + Chr(1)
(2B is actually a hex value that it is replaced via %x%)
I'm going nuts trying to figure out how to get the damn ctrl characters sent without them getting converted to ASCII.
The returned variable shows as 0VOL2B1 (wrong)
The sent data from the trace is 30 56 4f 4c 32 42 31 which = 0VOL2B1 as well...(also wrong)
I need to specifically send a combination of hex and ascii data exactly as:
&H0 (or Int[0]) VOL2B (VOL is ASCII - 2B is HEX) &H1 (or Int[1])
I've got several knots on my forehead shaped like the front of my desk from trying to get this working..
Receiving and parsing is a piece of cake.. (Incoming start/stop characters are CHR(3) and CHR(4) -- Outgoing is CHR(0) and CHR(1))
This works perfectly for incoming data:
Chr(0) + "VOL2B" + Chr(1)
(2B is actually a hex value that it is replaced via %x%)
I'm going nuts trying to figure out how to get the damn ctrl characters sent without them getting converted to ASCII.
The returned variable shows as 0VOL2B1 (wrong)
The sent data from the trace is 30 56 4f 4c 32 42 31 which = 0VOL2B1 as well...(also wrong)
I need to specifically send a combination of hex and ascii data exactly as:
&H0 (or Int[0]) VOL2B (VOL is ASCII - 2B is HEX) &H1 (or Int[1])
I've got several knots on my forehead shaped like the front of my desk from trying to get this working..
Receiving and parsing is a piece of cake.. (Incoming start/stop characters are CHR(3) and CHR(4) -- Outgoing is CHR(0) and CHR(1))
This works perfectly for incoming data:
Code: Select all
Dim szDataIn, szMsgData
szDataIn = GetPropertyValue("Kenwood_VR5700.Received Data")
szDataIn = Replace(szDataIn,Chr(3),"")
szDataIn = Replace(szDataIn,Chr(4),"")
If Left(Ucase(szDataIn),3) = "VOL" Then
szMsgData = CLng("&H" & Right(szDataIn,2))
SetPropertyValue "Kenwood_VR5700.Volume", szMsgData
End If