Experience recently I, using VB serial programming, get experience two, take to share with everyone,
If yes, praise himself two sentences, if not, then welcome prawns advice.
Experience 1: Output properties of the serial port:
According to the book or MSDN in the output of the data type is a string or variant type, I have the problem is that I want to send the number between 0 to 255, but in accordance with the above output data type settings, not transport such as 200,210, such as more than 125 of the number, I do not want to follow the article introduced in the post to convert, so I have a little experience: the output of the variable data type set to the array of byte, the number of array elements is 1.
Dim sendtemp (0) as Byte
Const Sendcmd = &h55
Sendtemp (0) = Sendcmd
Mscomm1.output = Sendtemp ()
Experience 2: Setting a problem with change
When your serial port is set up, once you have changed the serial port in the future, all the settings need to be reset, if you set the port number of the serial port, and do not set the input mode of the serial port, if you think that the input mode has been set up before, he will use the default mode to deal with your input. Cause unnecessary trouble, I have to debug for a while, only to find this problem, I hope you will pay attention to