Serial Port In Delphi 7

It looks a though you are sending data and getting a response.receiveddata = SerialPort1.ReadByte You received a 21, this is Ascii decimal version of NAK (Hex 15). This indicates the device does not understand what you are sending it. To receive the reply as a hex value you can do this:receiveddata = Hex(SerialPort1.ReadByte)For sending a data string to the device I would use:SerialPort1.WriteLine(code)RegardsEditWriteLine appends a line feed to the string, so maybe not so good to use.Send each one out individually using Write.I would check on the 0x99 code, that is part of the extended ascii format and when I send that out the comport it reads something different all the rest look OK. Check the device manual again. Hello,Thanks, now i can see what is going out.But i have seen that the code that i need to give, there it seems to be the problem the code is staring with &H99 &H9C.I use also chr(&H99) + chr(&H9C)When i check the serial port monitor there are other codes 3F,3F instead of &H99 and &H9C in the code i send Chr(&H99) + chr(&H9C) but they are translated do 3F 3F so i think that is the reason why the RFID is not responding like it should be.The only question is why is it changing the codesDo you have a suggestion.ThanksBr.Didier. As I said, those are a part of the extended ASCII set and are not being interpreted correctcly.

  1. Winsoft Comport
Serial port in delphi 7 1

This from MSDN.By default, SerialPort uses ASCIIEncoding to encode the characters. ASCIIEncoding encodes all characters greater then 127 as (char)63 or '?' To support additional characters in that range, set Encoding to UTF8Encoding, UTF32Encoding, or UnicodeEncoding.Just because it is another case of MS improving my life that pisses me off, I have to figure this out because it part of my job. I'll get back to you. OK, Here it is, damn what pain. Anyway the default decoding only supports 128 character so value above 127 will be displayed as a '?' Or 3F.To change this the SerialPort encoding needs to be changed.

Your question has a better chance of being answered if you post it in the Q&A section you ask be sure to add what the error is showing, the error can provide a clue to the person who is willing to help.In the mean time I would look a the syntax of the line:myPort.write(marTxBfx,mInputLength,4);MSDN Link: short,myPort.write(arraytosend, firstbyteofarray, numberofbytestosend). When answering a question please:.

Read the question carefully. Understand that English isn't everyone's first language so be lenient of badspelling and grammar. If a question is poorly phrased then either ask for clarification, ignore it, oredit the question and fix the problem. Insults are not welcome. Don't tell someone to read the manual.

PortSerial Port In Delphi 7

Winsoft Comport

Chances are they have and don't get it.Provide an answer or move on to the next question.Let's work to help developers, not make them feel stupid.

Posted on