DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2010
    Posts
    1

    Problem in receving data from MS Comm Port

    hello,
    I interface a microcontroller with PC using VB6. as i transfer string from the microcontrller it is desplayed on the VB form. but when i send a float byte array from the microcontller it is showing mismatch error. i am sending a four bytes of float value from the microcontroller to com port. now i am not able to convert that 4 bytes of float value to single or double data in vb.
    Code:
    Public Function GetByt(Byt As Integer) As Single
    Dim CropL As Single
    'Dim i As Integer
    Dim crop() As Byte
    Dim buf As Byte
    Dim Str As String
    MSComm1.OutBufferCount = 0
    MSComm1.InBufferCount = 0
    MSComm1.Output = "S"
    Do While MSComm1.InBufferCount < Byt
    DoEvents
    MSComm1.Output = "R" ' ack to controller that byte is received, send next
    Loop
    crop() = MSComm1.Input
    CropL = crop()
    GetByt = CSng(CropL)
    MSComm1.Output = "D" 'ACk to controller that all bytes are received,
    End Function
    please suggest what to do..

    Best Regards.

  2. #2
    Join Date
    May 2004
    Posts
    40
    I suggest you post your question in the VB forum, not the Java forum.

Similar Threads

  1. Data Storage Problem for VB.NET
    By Ron Weller in forum .NET
    Replies: 4
    Last Post: 02-01-2010, 03:57 PM
  2. Problem with Data Adapter Update
    By max caber in forum .NET
    Replies: 4
    Last Post: 07-03-2007, 01:06 PM
  3. Data Environment - Cache Results problem
    By BernS in forum VB Classic
    Replies: 0
    Last Post: 06-20-2002, 09:27 AM
  4. Data List Control Problem
    By John in forum VB Classic
    Replies: 0
    Last Post: 10-12-2001, 05:09 PM
  5. Data import problem
    By Tim in forum Database
    Replies: 0
    Last Post: 08-14-2000, 02:07 PM

Bookmarks

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


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links