- Prepare
- UART TTL to RS485 . communication circuit
- DB9 port
You wire as shown. Here I use S7-200 CPU226 with 2 communication ports. إلعب واربح


Here you do not need to attach the resistor. Then attach DB9 port to Port 0 of S7-200
2. Programming
Download program for Arduino
Download program for S7-200

You can change the value you want to write to the PLC, here I want to write the value 113 into the writeRegs[0] register corresponding to VW802 in the PLC. And I use register VW800 to switch LED 12 of Arduino.
writeRegs[0] = 113; // update data to be written to arduino slave
if (readRegs[0]==10)
digitalWrite(LED, 1); // constrain adc value from the arduino slave to 255
else digitalWrite(LED, 0);
Upload the code for Arduino and PLC and test

To turn Led 12 on and off, we write the value 10 to VW800

Good luck
Leave a Reply