Page 2 of 2 FirstFirst 12
Results 11 to 19 of 19

Thread: Need help with vb.net and inpout32.dll

  1. #11
    Confusion Master
    Auto Apps:loading...
    Enforcer's Avatar
    Join Date
    Sep 2003
    Location
    If you go down to the woods today, You're sure of
    Posts
    14,581
    Well the next steps I would take is to put some debugging code in to print out each calculation step by step.

    Code:
            If Left(LCase(CMD), 11) = "rrpp_biton;" Then
                If Len(CMD) > 11 And InStr(CMD, ";") Then
                    Datavalues = Inp(DataPort)
                   anothervariable= Convert.ToInt32(Mid(CMD, 12, 1)) ^ 2 
                    debug.print datavalues,anothervariable    
                    variable3=datavalues or anothervariable             
                     debug.print  variable3
                     Datavalues = Datavalues Or (Convert.ToInt32(Mid(CMD, 12, 1)) ^ 2)
                    Out(DataPort, Datavalues)
                    Datavalues = 0
                End If
                ProcessCommand = 2
            End If
            If Left(LCase(CMD), 12) = "rrpp_bitoff;" Then
                If Len(CMD) > 12 And InStr(CMD, ";") Then
                    Datavalues = Inp(DataPort)
                     Datavalues = Datavalues And (255 - (Convert.ToInt32(Mid(CMD, 13, 1)) ^ 2))
                    Out(DataPort, Datavalues)
                    Datavalues = 0
                End If
                ProcessCommand = 2
            End If

  2. #12
    Raw Wave pierrotm777's Avatar
    Join Date
    May 2008
    Location
    Bordeaux, France
    Posts
    2,769
    OK , i have tried your code but i don't see where to found the debug file !

  3. #13
    Confusion Master
    Auto Apps:loading...
    Enforcer's Avatar
    Join Date
    Sep 2003
    Location
    If you go down to the woods today, You're sure of
    Posts
    14,581
    The debug's will only show up in the IDE, try just running the code as a separate standalone project

  4. #14
    Raw Wave pierrotm777's Avatar
    Join Date
    May 2008
    Location
    Bordeaux, France
    Posts
    2,769
    If i understand well, i create a little .exe (without RR and out the dll) and i modify this code for a form with one button by example ?

  5. #15
    Confusion Master
    Auto Apps:loading...
    Enforcer's Avatar
    Join Date
    Sep 2003
    Location
    If you go down to the woods today, You're sure of
    Posts
    14,581
    Yes.


    I actually have a debug print subroutine bas file I add to all my applications which basically prints whatever I send to it to a text file, my debug.txt file.


    Then I just use that.

    But for now just test as a standalone exe.

  6. #16
    Raw Wave pierrotm777's Avatar
    Join Date
    May 2008
    Location
    Bordeaux, France
    Posts
    2,769
    Ok , I am ready and i understand how do do this test .
    I have made a form with this code:
    Code:
        Private Sub WrieTestCMD_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles WrieTestCMD.Click
            PortAddress = &H378S
            Value = Inp(PortAddress)
            Text2.Text = CMD
            anothervariable = Convert.ToInt32(Mid(CMD, 12, 1)) ^ 2
            'Debug.Print(Value, anothervariable)
            variable3 = Value Or anothervariable
            'Debug.Print(variable3)
            Value = Value Or (Convert.ToInt32(Mid(CMD, 12, 1)) ^ 2)
            Out(PortAddress, Value)
            Value = 0
        End Sub
    And i have an error on this line (bad format on this string)
    anothervariable = Convert.ToInt32(Mid(CMD, 12, 1)) ^ 2

    The exact error is:
    Une exception de première chance de type 'System.FormatException' s'est produite dans mscorlib.dll

  7. #17

  8. #18
    Raw Wave pierrotm777's Avatar
    Join Date
    May 2008
    Location
    Bordeaux, France
    Posts
    2,769
    Quote Originally Posted by Enforcer View Post
    What is in CMD?
    Heuuu, Text2.Text = CMD ?

    And when i run the example i put 10001000 into the text box 2

  9. #19
    Confusion Master
    Auto Apps:loading...
    Enforcer's Avatar
    Join Date
    Sep 2003
    Location
    If you go down to the woods today, You're sure of
    Posts
    14,581
    But you are not putting the contents of text2.text into CMD, you are putting the contents of CMD into text2.text.


    Change that line to

    CMD = text2.text

Page 2 of 2 FirstFirst 12

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
  •