B&R PLC - write to serial port

M

Thread Starter

Matthias

Hi,

I have a B&R CP476 PLC with 8 sensors connected to it. What I want to do now, is to write these values to the serial port in a certain format.

Could you give me any idea on how to write to the serial port? Unfortunately I have not all documentation that came with it.

Thanks a lot!
 
S
first identify if your plc supports bit transferring protocol or byte transmitting protocol. if it is byte transfering protocol then you just have to send the hex value to serial port (Ox03F8) through outb() function in c. if it follows bit transferring protocol then you have to configure your serial port setting like baud rate, even parity, stop bit, etc...
 
Hello,
In the development sw Automation Studio...Y ou can use the DvFrame Library for the purpose. This library enables data to be transmitted and received as "frames"(Bytes).

Of corse the Port settings have to be done for CP476, serial port in Automation Studio. You can see the help of Automation Studio. There are sample codes available. Bounce back if you have any problems.
 
Hi,

Just take note that CP476 only has 1 com port, you cannot use it for monitoring/programming/debugging and for transmit/receive your custom data format at the same time.

If you want to do both at the same time, you may need to add in an IF (interface) module if there are available slots for it.

The DvFrame library is a very good resource for you to learn about B&R serial programming.
 
Hi,

Actually it is possible to use one com port to do different protocol, but at the same time.

If you open the port using the function, it will start to run your own protocol. But if you close the port, it will run B&R protocol - which means you can do programming via this port. So you can use a digital input or a key action if you have screen to toggle the protocols.

Another method: if you have a 2nd B&R PLC with CAN bus port, you can connect the CAN to the target CP476, and connect the programming PC to the 2nd PLC com port. With a simple setting in your AutomationStudio, you can "route" to the target CP476 via the 2nd PLC.

Regards,
Mark Meng
 
Top