PLC Programming


Thread Starter

Jovial K Jayan

Can somebody explain the difference between

1. Function Block
2. Function
3. Type
4. Structure
5. Enum

in TwinCAT PLC Control
It's all more or less same in whole PLCs world.

1. Piece of code which can be called from within other function blocks or programs, having own retentive (between calls) memory, can have inputs, outputs (passing variables by value) or inputs-outputs (passing variables by pointer), needs an instance;

2. Same as above, but without retentive memory and does not need an instance to be called, it can return data ie. function can have type (int, real or much complex like array or structure);

3. Describes interpretation and size of data - there are predefined/basic types like int, byte or data_and_time and user/derived types (structures and arrays);

4. Structure is a type which contains set of other types inside (including other structures) - similar to record in databases.

5. Enum stands for enumerational data type - it is a set of names with underlying dint (or udint, can't remember right now) values, those values can be assigned implicitly (by a compiler) or explicitly (by a programmer).

I hope your homework is done.