hidroela

MrPLC Member
  • Content count

    45
  • Joined

  • Last visited

Community Reputation

0 Neutral

About hidroela

  • Rank
    Sparky

Contact Methods

  • ICQ 0
  1. Some bugs fix -write to plc -versioning add date -others Best regards Hidroilio Pérez driver_example.rar
  2. Sorry me again this is version on Visual Basic Net 2005 Framework v2.0.50727 Attach is a project with the DLL and a littler test Project Best regards Hidroilio Pérez driver_test.rar
  3. By the way I got a new version that I forgot to share (Sorry) for almost a moth this is a new concept on the software implementation (I am not a one I mean developer) take a look and drop some comments thanks Best regards Hidroilio Perez RS232_new_ver1.9.rar
  4. Another version capable to write to: the integer, Bit, Output and Input PLC-5 data table and Micrologix data table.Plus several bugs fix Best regards Hidroilio Pérez RS232v5.5.rar
  5. Another version capable to write to PLC-5 the integer table Micrologix Bit, Output, Input and Integer data table plus many bugs fix Best regards Hidroilio Pérez Is Here RS232v2.1.rar
  6. By the way Nicolas Chaillou how did you manage to write to the output table to a particular bit not the entire word for example change O:0/7 from 1 to 0 Best regards Hidroilio Pérez
  7. Make sure your comm port is not in use rslinx start up as a server when you start up your PC so probably it is using it Hope this help Best regards Hidroilio Pérez
  8. saucekorn69 go here i hope this help
  9. Use this command on pag 7-17 protected typed logical read with three address fields CommandType = 15 Functionn = 162 BiteSize = 2 CommandToSend = Chr(16) + Chr(2) + Chr(RemoteNodeAddress) + _ Chr(DHNodeAddress) + Chr(CommandType) + _ Chr(MessageStatus) + Chr(TransactionNumber) + _ Chr(0) + Chr(Functionn) + Chr(BiteSize ) + _ Chr(FileNumber(Index)) + Chr(FileType(Index)) + _ Chr(ElementNumber(Index)) + Chr$(0) + _ Chr(16) + Chr(3) Remember to attach the check sum (CRC or BCC) to the command send Your respond should end in some thing like this DLE ETX CRC CRC Your data should be on the left side of DLE two bytes I used this code to extract it from the respond DecimalValue=256 * CLng(Asc(Mid$(Respond, Len(Respond) - 4, 1))) + CLng(Asc(Mid$(Respond, Len(Respond) - 5, 1))) Your respond would be the entire word 16 bits from there you have to pick the one that you are looking for example 0000101011100000 output 0:0/5 bit is one I use this code to get it Position:Position in the word of the bit that you want to read BitValue: bit that you want to read Private Function GetData(DecimalValue As Long, Possition As Long)    On Error Resume Next    Dim counter   As Integer    Dim TempValue As Long    Dim BinValue  As Byte    Do        counter = counter + 1        TempValue = DecimalValue Mod 2        BinValue = CStr(TempValue) + BinValue        DecimalValue = DecimalValue \ 2    Loop Until counter = Possition + 1    BitValue = TempValue End Function Hope this help Best regards Hidroilio Pérez
  10. More improvements Read Binary table, Output table, Input table, Timer table and Integer now on Micrologix family of processor plus many bugs fix. Best Regards Hidroilio Perez RS232_Driver.rar
  11. check this code would get you stater Private Function GetEcoFromPlc() As Boolean    Dim EcoToSend         As String    Dim EcoRespond            As String    Dim TransactionNumber     As Integer    Dim lngCounter            As Integer    Dim NAKCount              As Integer    Dim ENQCounter            As Integer    EcofromPLC = ""    'clear buffer    Container.MSComm.InputLen = 0    EcoToSend = Container.MSComm.Input    'Create Random transaction Number every read    'Int((upperbound - lowerbound + 1) * Rnd + lowerbound)    TransactionNumber = Int((200 - 1 + 1) * Rnd + 1)    EcoToSend = Chr(16) + Chr(2)    'destination and source    EcoToSend = EcoToSend + Chr(RemoteNodeAddress) + Chr(DHNodeAddress)    'command type    EcoToSend = EcoToSend + Chr(6)    'status of the message    EcoToSend = EcoToSend + Chr(MessageStatus)    'transaction value 2 bytes long    EcoToSend = EcoToSend + Chr(TransactionNumber) + Chr(0)    'function    EcoToSend = EcoToSend + Chr(0)    EcoToSend = EcoToSend + Chr(54) + Chr(72) + Chr(53) + Chr(54)    'termination of the message    EcoToSend = EcoToSend + Chr(16) + Chr(3)    'send command    Select Case mvarCalcCheckSum        Case 1            CalcCRC EcoToSend        Case 0            CalcBCC EcoToSend    End Select    Container.MSComm.Output = EcoToSend    'wait for acknowledgment    Do        lngCounter = lngCounter + 1        Sleep 10        DoEvents    Loop While 3 > lngCounter And Container.MSComm.InBufferCount < 2    Container.MSComm.InputLen = 2    EcoRespond = Container.MSComm.Input    Timeout1 = GetTickCount&    Do        'check for good acknowledgement        If EcoRespond <> Chr$(16) + Chr$(6) Then            If EcoRespond = Chr$(16) + Chr$(21) Then                NAKCount = NAKCount + 1                If NAKCount > 3 Then                    comunicating = False                    Exit Function                Else                    Container.MSComm.Output = EcoRespond                    'wait for acknowledgment                    Do                        lngCounter = lngCounter + 1                        Sleep 10                        DoEvents                    Loop While 3 > lngCounter Or Container.MSComm.InBufferCount < 2                    'remove acknowledgment from buffer                    Container.MSComm.InputLen = 2                    EcoRespond = Container.MSComm.Input                    Timeout1 = GetTickCount&                End If            Else                Timeout2 = GetTickCount&                If (Timeout2 - Timeout1) > 20 Then                    ENQCounter = ENQCounter + 1                    If ENQCounter > 3 Then                        comunicating = False                        Exit Function                    Else                        Container.MSComm.Output = Chr$(16) + Chr$(5)                    End If                End If            End If        Else            Exit Do        End If    Loop    'send acknowledgment    With Container        .MSComm.Output = Chr(16) & Chr(6)        'get response        .MSComm.InputLen = 0        Sleep 40 '40 best results for me'play with this number        DoEvents        EcoRespond = .MSComm.Input        If Len(EcoRespond) = 0 Then            comunicating = False        End If    End With 'container    'check EcoRespond status    If Asc(Mid$(EcoRespond, 6, 1)) = 240 Then        comunicating = False        Exit Function    End If    'remove surplus 'DLE's    lngCounter = 3    Do        If Mid$(EcoRespond, lngCounter, 1) = Chr$(16) Then            EcoRespond = Left$(EcoRespond, lngCounter) & Right$(EcoRespond, Len(EcoRespond) - 1 - lngCounter)        End If        lngCounter = lngCounter + 1    Loop While lngCounter < Len(EcoRespond) - 4    Dim i    For i = 7 To 4 Step -1        EcofromPLC = EcofromPLC & "|" & _           Asc(Mid$(EcoRespond, Len(EcoRespond) - i, 1))    Next    If EcofromPLC = "|54|72|53|54" Then        GetEcoFromPlc = True    Else        GetEcoFromPlc = False    End If    GetStatusFromPlc End Function if you need the hole project go here MrPLC Best Regards Hidroilio Perez
  12. the answer is here Best Regards Hidroilio Perez
  13. Does any one know what the tag mean in the Protected typed file read command I search the entire documentation and do not find reference no where That explain what it is Best Regards Hidroilio Pérez
  14. New improvement Read Binary table, Output table, Input table, Timer table, Plus Integer table from previous version Classes Wrapped in to a DLL (with timer and MScomm) with Help File Timeout and respond incorporate Best regard Hidroilio Pérez RS232_Driver.rar
  15. Need help I trying to read on the binary file B3/10 in a plc5 when I send this command (typed read (read block)) using Checksum=CRC Command send |16|2|0|0|15|0|58|0|104|0|0|1|0|15|0|3|10|0|1|0|16|3|137|126 The respond from the plc is DLE|STX| SRC|DST| CM|STS| TNN | A | B |DLE|ETX |CRC| |16 | 2 | 0 | 0 | 79 | 0 | 58 | 0 |153|9|3|66|16|16|0 | 16 | 3 |87|88 The first byte of the type/data parameter is the flag byte, According to my finding 153 the flag byte 153 Dec converter to binary =10011001 1 Id Format Field 001 Id Value Filed 1 Size Format Field 001 Size Value Field My problem is that I can not figure it out how to read the B part 9|3|66|16|16|0 Any body help my out how to interpreter this enigma Best regard Hidroilio Pérez