DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Thread: Fbus Protocol

  1. #1
    Join Date
    Nov 2006
    Posts
    2

    Fbus Protocol

    Hi, im newbie here

    i need a help with my vb project, im communicating with nokia phone using fbus protocol im getting the phone version mcu and ppm also the imei of the phone..

    vb code:

    Code:
    Private Sub cmdread_Click()
        If FT_Open(0, FT_HANDLE) <> FT_OK Then
            Exit Sub
        End If
        
        Dim strFirst As String
        Dim strXorFirst As String
        Dim strSecond As String
        Dim strXorSecond As String
        Dim strThird As String
        Dim strXorThird As String
            
        On Error GoTo ErrMCU
        
        MCU = ""
        PPM = ""
        IMEI = ""
        isAck = ""
        
        strFirst = ""
        strXorFirst = ""
        strSecond = ""
        strXorSecond = ""
        strThird = ""
        strXorThird = ""
    
        FT_RES = SendToDevA("5555555555", &H1)
        Sleep 0.1
        FT_RES = SendToDevA("1E0010D1000700080003000160406E9C", &H1)
    
        For i = 20 To UBound(FT_In_Buffer)
            MCU = MCU & Chr$(FT_In_Buffer(i))
            isAck = isAck & Chr$(FT_In_Buffer(i))
        Next i
        
        strFirst = "1E00107F0002D2" & "0" & iSequence1
        iSequence1 = (iSequence1 + 1) Mod 8
            strXorFirst = XorHex(strFirst)
        Sleep 0.1
        FT_RES = SendToDevA(strFirst & strXorFirst, &H1)
        Label2.Caption = strFirst & strXorFirst
        
        ConvThisText = isAck
        ConvToHex ConvThisText
        isAck = ConvThisText
        iSequence2 = Mid$(isAck, 66, 1)
        
        strFbus1 = "1E00101B0008000349070100014" & iSequence2 + 1
        iSequence2 = (iSequence2 + 1) Mod 8
            strXorFbus1 = XorHex(strFbus1)
        Sleep 0.1
        FT_RES = SendToDevA(strFbus1 & strXorFbus1, &H1)
    
        For i = 26 To UBound(FT_In_Buffer)
            PPM = PPM & Chr$(FT_In_Buffer(i))
        Next i
        
        strSecond = "1E00107F00021B" & "0" & iSequence1
        iSequence1 = (iSequence1 + 1) Mod 8
            strXorSecond = XorHex(strSecond)
        Sleep 0.1
        FT_RES = SendToDevA(strSecond & strXorSecond, &H1)
        Label3.Caption = strSecond & strXorSecond
        
        strFbus2 = "1E00101B000A0002010041000000014" & iSequence2
        iSequence2 = (iSequence2 + 1) Mod 8
            strXorFbus2 = XorHex(strFbus2)
        Sleep 0.1
        FT_RES = SendToDevA(strFbus2 & strXorFbus2, &H1)
    
        For i = 26 To UBound(FT_In_Buffer)
            IMEI = IMEI & Chr$(FT_In_Buffer(i))
        Next i
        
        strThird = "1E00107F00021B" & "0" & iSequence1
        iSequence1 = (iSequence1 + 1) Mod 8
            strXorThird = XorHex(strThird)
        Sleep 0.1
        FT_RES = SendToDevA(strThird & strXorThird, &H1)
        Label4.Caption = strThird & strXorThird
        
        Close_USB_Device
        
    ErrMCU:
        Close_USB_Device
    End Sub
    
    Private Function XorHex(ByVal sText As String) As String
        Dim N As Long, lLen As Long
        lLen = Len(Trim$(sText))
        If lLen = 0 Or (lLen Mod 4) Then Exit Function
        XorHex = Hex("&H" & Mid$(sText, 1, 4))
        For N = 5 To lLen Step 4
            XorHex = Hex("&H" & XorHex Xor "&H" & Mid$(sText, N, 4))
        Next N
    End Function
    what do you think guys with my code? sometimes its working properly it can read mcu,ppm and imei in about 2 seconds. but sometimes it reads only the mcu

    i attach date fbus protocol document.

    Thanks in advance

    Regards,
    Attached Files Attached Files

  2. #2
    Join Date
    Feb 2008
    Posts
    1
    Hello,
    I am interested to help, can you send me your sourcecode so far ?
    JaNoSh

  3. #3
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,663
    Well, considering the thread you responded to is 15 months old and the OP has not logged onto DevX since posting it, I suspect he won't be back.

  4. #4
    Join Date
    Nov 2006
    Posts
    2
    of course i'll be back to this nice forum

    @janosh

    Thanks. but i already solved my problem

    BR

  5. #5
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,663
    Thanks.

    Please post your solution as it might help someone else with the same or similiar problem.

Similar Threads

  1. can't get winsock udp protocol to work
    By rwhitfield in forum VB Classic
    Replies: 1
    Last Post: 01-10-2006, 03:58 PM
  2. SMTP Protocol
    By Alan Shiers in forum Java
    Replies: 2
    Last Post: 03-05-2005, 10:35 AM
  3. File Upload using HTTPS Protocol?
    By Ali Imran in forum ASP.NET
    Replies: 0
    Last Post: 08-13-2002, 03:30 PM
  4. The Human OS: Part II
    By Nancy Folsom in forum Talk to the Editors
    Replies: 16
    Last Post: 12-03-2000, 07:17 PM
  5. How Use PPP protocol in VB
    By Flipke in forum VB Classic
    Replies: 0
    Last Post: 06-22-2000, 01:35 PM

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