Results 1 to 3 of 3

Thread: [RESOLVED] sending 16 bit data to serial port

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Apr 2010
    Posts
    30

    Resolved [RESOLVED] sending 16 bit data to serial port

    hi iam new bee to this forum.
    just learning the basics.
    i want to send 16 bit data ( 0000 0000 0000 0000) to microcontroller.
    where in first 8 bit decides the o/p channel on microcontroller , and second 8 bit vary the duty cycle of the selected pwm o/p.

    can any one tell me how to send 16 bit data from vb6, source codes to send 16 bit data.
    many thabks in advance.
    iam using vb6.
    raj

  2. #2
    Fanatic Member
    Join Date
    Sep 2009
    Location
    Lakewood, Colorado
    Posts
    621

    Re: sending 16 bit data to serial port

    You just send it in two bytes. Serial ports are 8-bit devices, so...

    Example,

    Dim Buffer(1) As Byte
    Buffer(0) = &H00
    Buffer(1) = &HFF
    MSComm1.Output = Buffer

    This will send &H00FF to your microcontroller.

    You can find lots of examples online that show how to open the port, change settings, etc.

    To receive binary data, you should set MSComm's InputMode property to comInputModeBinary, and then assign data from the Input property to a buffer of type Byte (similar to above).

    Dick
    Richard Grier, Consultant, Hard & Software
    Microsoft MVP (Visual Basic)

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Apr 2010
    Posts
    30

    Re: sending 16 bit data to serial port

    thanks dick

    raj

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width