Saturday, September 19, 2020

PLC sub program in LDMicro

In the PLC ladder diagram program, we can group and name a set of rungs that's often used in the program. This's called sub program. It's similar to the sub program or function in any other computer programming language. Using the sub program could reduce the time and line number of any repeated rungs. It could also make the program more effective.

These instructions relate to the sub program.

To make a sub program in the ladder diagram,

  1. Define SUBPROG name
  2. Add the rungs containing ladder diagram instructions that defines the sub program
  3. Define ENDSUB name
By using the CALLSUB the sub program will activated. The CALLSUB instruction is just like a switch that connect to the SUBPROG instruction.


Look at this introductory example, 

  • A sub program (SUB1) display a counting value from 0 to F
  • An input contact use to activate the CALLSUB instruction. When it's true, the sub program will activated.
PLC sub program in LDMicro
sub program example

PLC sub program in LDMicro
Schematic Diagram



Click here to download the zip file of this project.


No comments:

Post a Comment

Labels

ADC (10) Analog (14) Arduino (12) Atmega16 (19) Audio (2) AVR (20) Charger (1) Cortex-M0 (1) Counter (10) CPLD (25) Digital I/O (22) Display (34) EEPROM (2) Environment Sensor (1) esp8266 (2) Experiment Board (10) I2C (4) Interrupt (7) LCD (1) LDmicro (29) measurement and instrumentation (7) Microchip Studio (3) MikroC (1) One-Shot (3) OpAmp (1) PCB (31) PIC16 Microcontrollers (16) PIC16F877A (2) PIC16F887 MikroC (22) PLC (35) PWM (11) Regulator (1) RTC (2) Sensor (8) Shift Registers (5) SPI (5) Timer (34) UART (2) ultra-sonic sensor (1) USB (1) VHDL (21) xc8 (1) XC95108 (9) XC9536 (15) XC9572 (1) Xilinx (23) Xilinx ISE (22)