most common beginner mistakes while programming a PLC and possible solutions.

most common beginner mistakes while programming a PLC and possible solutions.


1- Simple hardware mistakes.

  • The PLC does not work.

possible solutions :

-- there is not memory card inserted inside the PLC.

No alt text provided for this image

(please don't ever format this memory card)



-- The PLC in stop mode (only on s7 300/400).

No alt text provided for this image







  • This is an RS485 Serial port not RS232.
No alt text provided for this image







-- what is RS232 standard ?

The RS-232 interface complies with the interface standard for serial data communication established by the Electronic Industries Alliance (EIA). The original number is EIA-RS-232 (232, RS232 for short). It is widely used for computer serial interface peripheral connections. Connect cables and mechanical, electrical, signal, and transfer processes.

The data transmission rate specified by the RS-232-C standard is 50, 75, 100, 150, 300, 600, 1200, 2400, 4800, 9600, 19200 baud per second.

It is one of the mainstream serial communication interfaces. Due to the early appearance of the RS232 interface standard, it is inevitable that there are deficiencies, mainly the following four points:

(1) The signal level of the interface is high, which is easy to damage the chip of the interface circuit.

(2) The transmission rate is low compared to RS485.

(3) the noise immunity is weak.

(4) The transmission distance is limited. The maximum transmission distance is 50 feet. In fact, it can only be used at about 15 meters.

Example :

Universal Asynchronous Data Receiver &Transmitter (UART) used in connection with RS232 for transferring data between printer and computer. The microcontrollers are not able to handle such kind of voltage levels(RS232 also used as ground & 5V level), connectors are connected between RS232 signals. These connectors are known as the DB-9 Connector as a serial port and they are of two type’s Male connector (DTE) & Female connector (DCE).

---- what is RS485 standard ?

The RS-485 serial bus is widely used when the communication distance is required to be several tens of meters to several kilometers. RS-485 uses balanced transmit and differential receive, so it has the ability to reject common-mode interference. In addition to the high sensitivity of the bus transceiver, it can detect voltages as low as 200mV, so the transmitted signal can be recovered beyond the kilometer.RS-485 uses a half-duplex mode of operation, and only one point can be sent at any time. Therefore, the transmitting circuit must be controlled by an enable signal.(note : it works half duplex on 2-wires mode and full duplex in 4-wire mode so basically it can work both half duplex and full duplex).

Some features:

(1) Electrical characteristics of RS-485: The logic “1” is represented by the voltage difference between the two lines +2V~+6V, and the logic “0” is represented by the voltage difference between the two lines -6V~-2V. The interface signal level is lower than RS-232-C, and it is not easy to damage the interface circuit chip, and the level is compatible with the TTL level, which is convenient for connection with the TTL circuit.

(2) The highest data transmission rate is: 10Mbps

(3) The maximum transmission distance of the RS-485 interface is 4000 feet, which is actually up to 3000 meters.

(4) The RS-232-C interface allows only one transceiver to be connected to the bus, ie single-station capability; while the RS-485 interface allows only up to 128 transceivers to be connected on the bus, ie multi-station capability, so that the user The device network can be easily established using a single RS-485 interface.

note : i will require an RS485 repeater if :

--- More than 32 stations are connected to the bus

--- If there is to be isolated operation of the bus segments on the bus, i.e. the bus segments connected to the RS485 repeater are electrically separated

--- The maximum line length of a segment is exceeded.

It's information that has no direct relationship to the title of the article, but I think it has a major role in maintenance and trying to troubleshoot faults, but in short let me show you the differences between the electrical standard used by different communication protocols.

No alt text provided for this image
  • why my I/O module does not work ?!

There is an extension inside every I/O module some people remove it and connect cables to to it and reinserted again , the problem is when they inserted again they forget to screwdriver which wont make a connection to the module internal processor.

2- Improper use of memory bits.

when you are writing you program some of you probably do stuff like this when assigning memory bits first memory address will be M0.0 and the second M10.0 which is wrong you MUST use them in order.

what if you lost your track and now you dont know which memory bits ,byts , words and double worlds you used ?

well, there is an incredible tool inside Siemens softwares called Assignment list and make sure there is not an overwrite of your memory bits.

No alt text provided for this image






3- Wrong usage of clock Byte.

No alt text provided for this image

so if we made our clock memory to be the byte 100 we should reserve MW100 and MD100 so that no body use memory overlapping the clock byte.

No alt text provided for this image

4- using uninitialized temp.

No alt text provided for this image

5- not compiling each time a changed occur in a DB or tags table.

you should compile each time to make some addresses appear and apply changes.




要查看或添加评论,请登录

Ali Ibrahim的更多文章

  • Indirect addressing and Pointers in Siemens PLCs

    Indirect addressing and Pointers in Siemens PLCs

    lets start by explaining the meaning of pointers not only in industrial automation but in all programming languages…

    2 条评论
  • ISO-OSI

    ISO-OSI

    what is ISO-OSI ? the main idea between computer networks is the communication between different systems. the purpose…

  • best practices

    best practices

    this is my favorite programming structure in programming small applications ( it would increase the flexibility and the…

社区洞察

其他会员也浏览了