Industrial Communications

cancel
Showing results for 
Search instead for 
Did you mean: 

Communication between S7 PLC and NI Smart Camera over RS232

Hello,

 

I'd like to connect a NI Smart Camera with a S7-300 PLC over RS232.

 

I have a few questions:

 

  • Did anybody write some S7 code for the communication between the S7 and a NI Smart Camera over RS232, which I can use?
  • Does anybody know the definition of the RS232 telegrams?
    The telegram should constst of a string, which has fixed positions of the separat data values.
    For example, I let the Vision Builder calculate two angles, which should be sent send to the S7. The angle should have 3 numbers before the decimal separator and 2 digits after it.
    123.24 drgrees should be sent as "123.24" and 10.3 degrees should be sent as "010.30", both together as "1232401030" or something like that. But with defined string/byte positions.
    So that I can get the relevant information easily without "parsing" the position where I have to cut the telegram.
    Has the telegram always fixed positions of the data values?

Best regards

Matthias

0 Kudos
Message 1 of 6
(7,781 Views)

Hi Matthias H,

 

there are several possibilities how to implement the required feature: If you're using the Vision Builder to configure your SmartCamera, you could either use Modbus, TCP I/O or Shared Variables.

 

The main issue the is how to get this data connected to the PLC: I know that there's a Modbus library existing for Step7, but never worked with that. TCP I/O might work if you're PLC provides an Ethernet CP. The easiest way would be to use Shared Variables: You could create and write to this variable using the Vision Builder. You could then bind this variable to an OPC-tag defined on the PLC. The disadvantage of this method is that it requires the use of an OPC server.

 

Using RS 232 might be quite complicated, as I don't know which protocol the Siemens PLC is using.

 

Regards,
Bernd

 

0 Kudos
Message 2 of 6
(7,749 Views)

Hello Bernd,

 

I tried the Vision Builder and it work's great with RS232.

I can definie the telegram and RS232 is an industrial standard which the S7 can read.

 

Thank you for your reply.

 

Regards

Matthias

0 Kudos
Message 3 of 6
(7,746 Views)

Hi Matthias,

 

thanks for the reply, good to hear that it works.

As I did some PLC programming in my previous life, I'm curious about your implementation: Are there any FB's or FC's in Step7 so that you can easily address the serial port?

0 Kudos
Message 4 of 6
(7,744 Views)

Hi Bernd,

 

no, there are no standard FBs or FCs. You have to implement this, but the implementation is not too difficult.

 

TCP/IP would be much more difficult (but there are several TCP/IP libraries on the NI server to communicate to the S7 PLC if somebody should be interested in it).

0 Kudos
Message 5 of 6
(7,742 Views)

Thanks for the info!

 

0 Kudos
Message 6 of 6
(7,739 Views)