hidroela
Member
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
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