Two experiences of using VB serial port

Source: Internet
Author: User
Tags array port number
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



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.