Page 1 of 2 12 LastLast
Results 1 to 10 of 19

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

  1. #1
    Raw Wave pierrotm777's Avatar
    Join Date
    May 2008
    Location
    Bordeaux, France
    Posts
    2,838

    Smile Need help with vb.net and inpout32.dll

    I made a new plugin around the parallel port with vb.net 2010 .
    All is ok , but i have a curious result when i try to send 10001000 or 00010001 to the parallel port.
    I obtain the same result as if i send 10001000.
    My code is:
    Code:
            If Left(LCase(CMD), 8) = "rrpp_on;" Then
                If Len(CMD) > 8 And InStr(CMD, ";") Then
                    Out(PortAddress, Convert.ToInt32(Mid(CMD, 9, 8), 2))
                    ProcessCommand = 2
                Else
                    ProcessCommand = 2
                End If
            End If
    So my RR command is : "rrpp_on;10001000"

    Where is my bug please ?

    I have other problem !
    With this command i can only change all bit in the same time .
    I should like to have one command by bit !
    How can i write that please ?

    Thanks for all help !

  2. #2
    MySQL Error
    Auto Apps:loading...

    Join Date
    Oct 2004
    Posts
    5,246
    please dont make ANY commands, VARS or or indicators, or such
    prefixed with "RR"
    this could lead to confusion, and future issues
    -Thanks
    Mitch
    www.rush2112.net

    "Did you test it in carwings??"

    Sun, Come shine my way
    May healing waters bury all my pain
    Wind, Carry me home
    The fabric of reality is tearing apart
    The piece of me that died
    Will return To live again

  3. #3
    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,616
    Quote Originally Posted by mitchjs View Post
    please dont make ANY commands, VARS or or indicators, or such
    prefixed with "RR"
    this could lead to confusion, and future issues

    What you talking about.

    All my plugins have their ommands start with rr followed by either their full plugin name or a shorted plugin name.

    This was done so we can have unique commands for each plugin and not get mixed up.

    ie

    RRFuelPrices has commands, labels, indicators, and vars start with rrfp_

    RRTrafficcams has commands, labels, indicators, and vars start with rrtc_

    RRUpd8 has commands, labels, indicators, and vars start with with rrupd8_


    etc.

  4. #4
    MySQL Error
    Auto Apps:loading...

    Join Date
    Oct 2004
    Posts
    5,246
    yea.. well... there is a higher chance that there is a collision now

    all NEW internal commands/indicators and such and such, will start RRxxxxx

    ur using a underscore... so your ok...

    but dont do... say...

    RRMyCommand



    we cant really enforce it, unless we wanted to police all plugins, and we dont...
    even though there should be some...since technically one could make a plugin, that deletes all your files...or calls home
    with personal files/data
    -Thanks
    Mitch
    www.rush2112.net

    "Did you test it in carwings??"

    Sun, Come shine my way
    May healing waters bury all my pain
    Wind, Carry me home
    The fabric of reality is tearing apart
    The piece of me that died
    Will return To live again

  5. #5
    RoadRunner Mastermind
    Auto Apps:loading...
    guino's Avatar
    Join Date
    Nov 2004
    Location
    Toronto, Canada
    Posts
    9,818
    You should READ the current data on the port (or have it previously saved in memory), then replace the bit you want to set in the data you've read, only then WRITE the resulting data to the port. That's the only way to control the output bit by bit without changing what's already there.
    Ride Runner RR's Myspace

    "Being happy is not about having what you want, it's about wanting what you have."
    "The best things in life are always free - but that doesn't mean money can't buy you good things."

  6. #6
    Raw Wave pierrotm777's Avatar
    Join Date
    May 2008
    Location
    Bordeaux, France
    Posts
    2,838
    Thanks mitchjs and Enforcer for your positives critics .
    Thanks Guino, but should like a little example code !

  7. #7
    RoadRunner Mastermind
    Auto Apps:loading...
    guino's Avatar
    Join Date
    Nov 2004
    Location
    Toronto, Canada
    Posts
    9,818
    try this with rrpp_biton;X or rrpp_bitoff;X -- X should be a bit from 0 to 7 (untested)

    Code:
            If Left(LCase(CMD), 11) = "rrpp_biton;" Then
                If Len(CMD) > 11 And InStr(CMD, ";") Then
                    CurrentValue = Inp(PortAddress)
                    CurrentValue = CurrentValue OR (Convert.ToInt32(Mid(CMD, 12, 1)^2)
                    Out(PortAddress, CurrentValue)
                End If
                ProcessCommand = 2
            End If
            If Left(LCase(CMD), 12) = "rrpp_bitoff;" Then
                If Len(CMD) > 12 And InStr(CMD, ";") Then
                    CurrentValue = Inp(PortAddress)
                    CurrentValue = CurrentValue AND (255- (Convert.ToInt32(Mid(CMD, 13, 1)^2))
                    Out(PortAddress, CurrentValue)
                End If
                ProcessCommand = 2
            End If
    Ride Runner RR's Myspace

    "Being happy is not about having what you want, it's about wanting what you have."
    "The best things in life are always free - but that doesn't mean money can't buy you good things."

  8. #8
    Raw Wave pierrotm777's Avatar
    Join Date
    May 2008
    Location
    Bordeaux, France
    Posts
    2,838
    I have done some change but i have an big issue .
    If when i run RR all bit are equal to 1:
    rrpp_bitoff;0 don't run
    rrpp_bitoff;1 put well the bit 0 to 0
    rrpp_bitoff;2 put the bit 2 to 0 and not the 1
    rrpp_bitoff;3 put the bit 0 and 3 to 0 and not the bit 2 to 0
    etc...
    if i put all the bit to 0:
    rrpp_biton;0 don't run
    rrpp_biton;1 put the bit 7 to 1 and not the bit 0 to 1
    rrpp_biton;2 put always the bit 7 to 1 and not the bit 1 to 1
    etc...

    This is your code modified !
    Code:
            If Left(LCase(CMD), 11) = "rrpp_biton;" Then
                If Len(CMD) > 11 And InStr(CMD, ";") Then
                    Datavalues = Inp(DataPort)
                    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
    An idea ?

  9. #9
    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,616
    Try


    Code:
            If Left(LCase(CMD), 11) = "rrpp_biton;" Then
                If Len(CMD) > 11 And InStr(CMD, ";") Then
                    Datavalues = Inp(DataPort)
                     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

    I think the issue is that Guino left out a close bracket (parenthesis) which meant you were trying to square a string value as opposed to the int value of the string (just my guess without testing)

  10. #10
    Raw Wave pierrotm777's Avatar
    Join Date
    May 2008
    Location
    Bordeaux, France
    Posts
    2,838
    Enforcer, thanks for your help but , that don't run well !
    If all is off, the command rrpp_biton;5 put on the bits 8,7 and 3 (B8 to B1)

Page 1 of 2 12 LastLast

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
  •