DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Thread: Problem in getting data from serial port. Help!

  1. #1
    Join Date
    Aug 2006
    Posts
    23

    Problem in getting data from serial port. Help!

    i using the MSComm to communicate with the serial port. And i use the MSComm_ComEvReceive method to listen to the data receive from the serial port. The problem is how can i different the data that i have?

    For example, if i receive a string "AT ABCVFDHow are u?".
    "AT ABCVFD" is a command while "How are u" is the data. How to sort them out??? Since the command and data always have the different amount of characters and received at different time. What should i do to sort them out?

    Really need help here... thanks a lot for ur help.

  2. #2
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    AT commands are terminated with a carriage return/line feed. Set the InputSize property to 1 and store characters in a buffer until you receive a carriage return.
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  3. #3
    Join Date
    Aug 2006
    Posts
    23
    by using the following code,
    MSComm1.Input = strReceive

    let we obtain strReceive = "AT 1234(CR)How are u(CR)"
    where (CR) represent Carriage return

    what code can i use to detect the position of the (CR) and obtain the command AT 1234" and data "How are u" seperately??

    really had a hard time doing these... hope u can show some simple sample code. thank you very much.

  4. #4
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    Dim Values() As String
    Values = Split(strReceive, vbCr)
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  5. #5
    Join Date
    Aug 2006
    Posts
    23
    thanks you very much... i try to do on that. May i know is that most application involve serial communication use vbCrLf to differentiate the different type of data and command?

Similar Threads

  1. ADO and stored proc parameters data type problem
    By markus in forum VB Classic
    Replies: 13
    Last Post: 01-29-2007, 12:23 PM
  2. RS232 - Reading Serial Port
    By wence in forum .NET
    Replies: 1
    Last Post: 12-27-2006, 02:51 PM
  3. Why I can't save data in data base?
    By Kurt in forum Java
    Replies: 7
    Last Post: 10-08-2006, 08:59 AM
  4. Serial Port Communication
    By IceCubeC in forum Java
    Replies: 3
    Last Post: 04-28-2006, 04:27 PM
  5. Data bound table & frame problem
    By Michael G. in forum Web
    Replies: 1
    Last Post: 01-11-2001, 10:20 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center