dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: Serial comm in VB

  1. #1
    Join Date
    Aug 2002
    Location
    Bombay, India
    Posts
    11

    Question Serial comm in VB

    Can anyone tell me how to show rs232c reception as it is, ie 0's & 1's. I have to make a prg wherein the input is 5 bit and in iat2 format...for teleprinters...it is differen from ASCII i have to stop Mscomm from interpreting it as ASCII??

  2. #2
    Join Date
    Dec 2001
    Location
    England, UK
    Posts
    36
    I hope I've understood you correctly, if I have, this will help.

    You'll probably have to interpret the data yourself. If you are getting ASCII into the program from the comm port, then write it to an array and convert to numbers using the ASC() function i.e.

    'Write data to an array

    EDIT: sizeOf isn't VB, is it! Oh well, you need the size of your array there!!

    For i = 0 to sizeOf(InputtedData)
    DataIWant(i) = ASC(InputtedData(i)
    Next i

    The numbers you get will be the decimal representation of the Binary you want. Any interpretation and manipulation on these numbers has to be done by you, but it should be fairly straightforward.

  3. #3
    Join Date
    Apr 2000
    Location
    Southampton, UK
    Posts
    329
    You need to set the cominput mode to binary. This will allow you to do this:

    Code:
    Dim aryInput() As Byte
    aryInput = MSComm1.Input
    You can then read each byte and convert it to binary (you may well have to write your own code to do this) and you would expect to see the various bits received.
    TimCottee
    I know a little about a lot of things and a lot about very little.

    Brainbench MVP For Visual Basic
    http://www.brainbench.com

    MCP, MCSD, MCDBA, CPIM

  4. #4
    Join Date
    Sep 2002
    Location
    arizona
    Posts
    12
    Can you communicate with the Serial Port? I need some code to transfer data back and forth from there.
    BearMan04

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)