Hi Community!
I have encountered a problem sending data past x"3F" over a serial port in managed code. In the docs I read you need to set the encoding to go past the 7-Bit(??) limit. So I did the following:
set serialPort1::Encoding to type System.Text.Encoding::GetEncoding(737) *> tried other values like 1252 as suggested in different forums. But when I do:
invoke serialPort1::Write(x"FF") *> it results in 3F being sent. where is Bit 8?
Somehow I don't get the catch. Should be simple though. I hope someone has an answer.
Regards
Rainer
I found out.
You don't need to set any encoding to the port. Just define the data as i.e.
01 ReadSerialNo type Byte[] value x"04FF11EA". *> Read Transponder No.
and send it:
invoke serialPort1::Write(ReadSerialNo, 0, 4)
of course 4 is BytesToWrite.
I was confused by intellisense which explains the "Write" function with "Text as String": Should be corrected.
Thanks anyway
Rainer
Hi Community!
I have encountered a problem sending data past x"3F" over a serial port in managed code. In the docs I read you need to set the encoding to go past the 7-Bit(??) limit. So I did the following:
set serialPort1::Encoding to type System.Text.Encoding::GetEncoding(737) *> tried other values like 1252 as suggested in different forums. But when I do:
invoke serialPort1::Write(x"FF") *> it results in 3F being sent. where is Bit 8?
Somehow I don't get the catch. Should be simple though. I hope someone has an answer.
Regards
Rainer
I found out.
You don't need to set any encoding to the port. Just define the data as i.e.
01 ReadSerialNo type Byte[] value x"04FF11EA". *> Read Transponder No.
and send it:
invoke serialPort1::Write(ReadSerialNo, 0, 4)
of course 4 is BytesToWrite.
I was confused by intellisense which explains the "Write" function with "Text as String": Should be corrected.
Thanks anyway
Rainer
Hi Community!
I have encountered a problem sending data past x"3F" over a serial port in managed code. In the docs I read you need to set the encoding to go past the 7-Bit(??) limit. So I did the following:
set serialPort1::Encoding to type System.Text.Encoding::GetEncoding(737) *> tried other values like 1252 as suggested in different forums. But when I do:
invoke serialPort1::Write(x"FF") *> it results in 3F being sent. where is Bit 8?
Somehow I don't get the catch. Should be simple though. I hope someone has an answer.
Regards
Rainer
I found out.
You don't need to set any encoding to the port. Just define the data as i.e.
01 ReadSerialNo type Byte[] value x"04FF11EA". *> Read Transponder No.
and send it:
invoke serialPort1::Write(ReadSerialNo, 0, 4)
of course 4 is BytesToWrite.
I was confused by intellisense which explains the "Write" function with "Text as String": Should be corrected.
Thanks anyway
Rainer