hidroela

MrPLC Member
  • Content count

    45
  • Joined

  • Last visited

Everything posted by hidroela

  1. Ok I am trying to understand The AB DF1 protocol in order to use it in a visual basic 6 Application with the objective of makes a simple 232 Serial driver that can read and write to the PLC5/30 The problem that I am facing right now is that I can not figure it out how to construct the command to send to the PLC5. According to AB this should be the format for unprotected read Now my question is? If I have a output table with this address O:031/17 and I need to read it how can I make the command to send, Note: I got this code from another forum so I am no sure if it is correct RS232PLC.InputLen = 0 QueryBuffer = RS232PLC.Input ''3:Create Query (Build the command) QueryBuffer = Chr$(16) & Chr$(2) & Chr$(DestinationNode) & _ Chr$(SourceNode) & Chr$(15) & Chr$(0) & _ Chr$(TransactionNo) & Chr$(0) & Chr$(162) & _ Chr$(Size * 2) & Chr$(FileNumber) & _ Chr$( ConvertFileType(FileType + 132)) & _ Chr$(ElementNumber) & Chr$(SubElementNumber) & _ Chr$(16) & Chr$(3) '4:Calculate Crc Check Sum and add to Query QueryBuffer = QueryBuffer & MsgCRC(QueryBuffer) '5: Send Message RS232PLC.Output = QueryBuffer If there any body that know how to deal with this and are willing to share There knowledge I will appreciated Best regard Hidroilio Perez
  2. Some bugs fix -write to plc -versioning add date -others Best regards Hidroilio Pérez driver_example.rar
  3. 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
  4. 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
  5. 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
  6. 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
  7. 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
  8. 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
  9. saucekorn69 go here i hope this help
  10. 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
  11. 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
  12. 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
  13. the answer is here Best Regards Hidroilio Perez
  14. 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
  15. 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
  16. 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
  17. Ok TechJunki the project despite the skepticism of some people is going. we are now able to read to the integer table of the plc5 and SLC-500 Note:this project is free if you want you can modified destroyed seller but if some body make improvements to it pleaseeeeeee……. Post it, so we can all benefit from it i hope you think the same way TechJunki Best regards Hidroilio Pérez New version improved AB_RS232_Driver.rar
  18. this is from another forum thanks to DaveW how to change com por settings What I’m trying to say is that you will need to use RSLogix5 to go online to the PLC using the RSLinx RS232/DF1 serial driver that is already working and change the PLC serial port (Channel 0) parameters (baud, stop, parity, BCC/CRC, etc). Once online, click the Channel Configuration branch on the project tree to the left of the screen, select the Channel 0 tab, and under Error Detect, change it from BCC to CRC. As soon as you apply this change, RSLogix5 will ask you to confirm switching the CPU from RUN to PROGRAM mode so that it can make the change. When you confirm Yes, the processor is stopped and logic is no longer scanned (your machine is stopped!) until you put it back into RUN mode. But because you change a serial port parameter, RSLinx will fail because it’s looking for BCC still. Your RSLogix5 will timeout because it needs RSLinx. You will need to reconfigure RSLinx for CRC, go back online and put the processor back into RUN mode or use the Key in front of the CPU. Best Regards Hidroilio Perez
  19. TechJunki I was wrong on my last post that’s not the device that we have I just find today that the plc5/30 o at least the one that we own the Serial port's default configuration are: • DF1 point to point • 2400 bps • No parity • One stop bit • BCC error check • No handshaking And according to what I found so far it can not be changed through switches so probably that’s why I could not read from the plc now I need a visual basic code to calculate the BCC Don’t think that I drop the project I know that we will finish Best regards Hidroilio Pérez
  20. Here is the response Just in case some body need to Best regards Hidroilio Perez
  21. This is related to this project At the end of each polling frame and each message frame, there is a one-byte BCC (block check character) field, or a two byte CRC (cyclic redundancy check) field. You select BCC or CRC through switch settings or software configuration. Either field allows you to verify the accuracy of each message frame transmission: And my question is can I send any one of them or I have to send one in specific according to some settings in the plc (through switch) Best regards Hidroilio Perez
  22. Visual Basic 6 and Ethernet

    If you own RSlinx Pro you should have RSLinxOPCAuto.dll or rsiopcauto.dll that is located in <C:\Program Files\Rockwell Software\RSCOMMON> This is and OPC DLL that you can use in your VB 6 app. To build your own OPC client A great example on how to build and OPC client is from Kepware http://www.kepware.com/Products/products_download.html]My Webpage Download the KEPServerEX OPC Server (Super Server Pack) you have to register in the pack you got some VB examples If you need help let me know Best regards Hidroilio Perez
  23. technogumbo Why not any thing that would help to develop this project (RS232 Driver) will be appreciated Thanks Best regards Hidroilio Perez
  24. TechJunki take a look at this little project that I start this week end as a base for our RS232 DF1 Driver headache Thanks Best regards Hidroilio Perez AB_RS_232_Driver.zip
  25. Which command are you using in your example (protected typed logical read with three address fields)? If it is so I got confused in your code below It is some thing that I am missing please explain that to me i try it but did not work Bad Ack Thanks Best Regards Hidroilio Perez