๐Ÿ“–
Code and Compile Wiki
E-Learning SchoolYouTubeLinkedIn
  • Code and Compile Wiki
  • ๐ŸŒŽQuick Links
    • ๐Ÿ“ƒGitHub
    • ๐Ÿ‘ฉโ€๐Ÿ’ปLinkedIn
    • ๐Ÿ“ธInstagram
    • ๐Ÿ‘จโ€๐Ÿ‘จโ€๐Ÿ‘งโ€๐Ÿ‘งFacebook Group
  • ๐ŸขThe Company
    • ๐Ÿ’ฅVision and Values
    • ๐Ÿ˜ŽMeet the Creator!
    • ๐Ÿ’ธDiscount: 20% OFF
  • ๐ŸญFactory Automation
    • Industrial Control
    • Digital Twin
      • FACTORY IO
        • Tasks and Solutions
        • FACTORY IO Scene
      • Simumatik
        • 01: Introduction to Simumatik
        • 02: Conveyor ON-OFF control
        • 03: Conveyor direction control
        • 04: Motor Control with Codesys
        • 05: Electro-Pneumatics with S7-1200 PLC
        • 06: Control IoT Device with MQTT
        • ๐Ÿ“šResources
    • PLC
      • Allen Bradley
        • Micro850 PLC
          • PLC Exercises - Part 1
          • PLC Exercises - Part 2
        • Micrologix 1000 PLC
        • Micrologix 1400 PLC
      • Delta Electronics
        • DVP 14SS2
        • DVP 12SE
        • DVP 10SX
        • PLC Exercises 1
      • Omron
      • PLCnext
      • Siemens
        • S7-200
        • S7-1200 (Basic)
          • ๐Ÿ“™Course Presentations
          • ๐Ÿ“„TIA Projects
        • S7-1200 (Advanced)
          • ๐Ÿ“™Course Presentation and Projects
          • ๐Ÿ“™HMI Presentations and Projects
      • Codesys
        • Exercises - Part 1
      • WAGO CC100
      • Schneider
        • PLC Exercises
    • Safety Controller
      • Banner SC10 Series
        • 1: Introduction to Safety Controller SC10
        • 2: Interfacing SC10 controller with PC
        • 3: Programming SC10 controller
        • 4: RF door switch safety circuit
        • 5: E-Stop safety circuit
        • 6: E-Stop safety circuit with ext. Reset
        • 7: Indicating fault on Manual reset button
        • 8: Interfacing S7-1200 PLC with SC10
        • 9: Reading virtual Non-safety inputs via PROFINET
        • 10: Bypassing the Magnetic switch via PROFINET
        • 11: Monitoring safety signals on Node-RED Dashboard
        • ๐Ÿ“šResources
    • AC Drives
      • Allen Bradley
        • PowerFlex 400
      • Delta Electronics
        • VFD M-Series
        • Servo Drives ASDA-B Series
    • HMI
      • Weintek
      • Delta HMI
      • Siemens KTP400
        • Error 1: Missing Panel images
    • 3D Camera
    • SCADA
      • Ignition SCADA
  • ๐ŸŒŽIIoT
    • Introduction to IIoT
      • Importance of Unified namespace
    • IIoT Devices
      • Arduino
      • ctrlX CORE
        • ๐Ÿ“น01- Using ctrlX CORE as PLC and Node-RED Server
        • ๐Ÿ“น02- Using ctrlX CORE as MQTT Broker
        • ๐Ÿ“น03- Interfacing ctrlX CORE with ctrlX I/O via EtherCAT
        • ๐Ÿ“น04- Introducing ctrlX CORE IDE App
        • ๐Ÿ“น05- Connecting OT with IT using Bosch DeviceBridge app
        • ๐Ÿ“น06- Interfacing ctrlX CORE with IO-Link master using EtherCAT
        • ๐Ÿ“น07- ctrlX CORE as HMI- Part 1
        • ๐Ÿ“น08- ctrlX CORE as HMI- Part 2
        • ๐Ÿ”—Virtual ctrlX WORKS
      • Raspberry Pi
      • Revolution Pi
      • Weintek cMT-G01
      • Banner Snap Signal
    • IIoT Tools
      • SIGNL4
      • Node-RED
        • Tips
      • OPC UA
        • ๐Ÿ–ฅ๏ธOPC UA Course
        • ๐Ÿ’กTroubleshooting
          • ๐Ÿ“ƒCertificate error in Node-RED
      • MySQL
      • MQTT
      • IO-Link
        • SICK
  • ๐Ÿ‘จโ€๐Ÿ”ฌResources
    • Yearly Subscription Guideline
    • Based on Courses
    • Books and Guides
    • Computer configuration
    • Hardware and Software
    • ๐Ÿ“‘Articles
      • ๐Ÿ‘จโ€๐Ÿ’ปModbus Addressing
  • โš™๏ธProjects
    • SmartFactory
Powered by GitBook
On this page
  • Section 1 - Series & Parallel logics
  • Section 2 - Latching and Interlocking logics using contacts
  • Section 3 - RS and SR flip-flops
  • Section 4- Use of Timers
  • Section 5- Use of Timers with Comparators
  • Section 6- Use of Counters with Comparators
  • Section 7- Use of variables with Math Operators
  • Section 8- Other operators

Was this helpful?

  1. Factory Automation
  2. PLC
  3. Codesys

Exercises - Part 1

Basic exercises on Codesys

In the following exercises, consider declaring the variables as follows.

Variable type
Data type
Variable declaration
Remarks

Input, Output

Bool

xStart, xStop, xReset, xInput, xSensor, xInductiveSensor, xMotor, xSolenoid etc.

Value

Int or Int16

iCount, iLevel, iSpeed etc.

Value

DInt or Int32

diCount, diLevel, diOrderID etc.

Value

Real

rSpeed, rLevel, rHeight etc.

Name

String

sID, sRecipe, sPassword etc.

Parameter

Time

tDelay, tTimeout etc.

Solve the following exercises in the following programming languages: - Ladder Diagram - FBD (Funcitonal Block Diagram)

Section 1 - Series & Parallel logics

  1. Write a program when bStart is TRUE, bMotor should be TRUE, and when bStart is False, bMotor should be FALSE.

  2. Write a program to fulfill the following boolean table:

xStartA :BOOL (Input)
xStartB :BOOL (Input)
xOutputX : BOOL (Output)

FALSE

FALSE

FALSE

FALSE

TRUE

FALSE

TRUE

FALSE

FALSE

TRUE

TRUE

TRUE

  1. Write a program to fulfill the following boolean table:

xStartA :BOOL (Input)
xStartB :BOOL (Input)
xOutputX : BOOL (Output)

FALSE

FALSE

FALSE

FALSE

TRUE

TRUE

TRUE

FALSE

TRUE

TRUE

TRUE

TRUE

  1. Write a program to fulfill the following boolean table:

xStartA :BOOL (Input)
xOutputX : BOOL (Output)

FALSE

TRUE

TRUE

FALSE

  1. Write a program to fulfill the following boolean table:

xStartA :BOOL (Input)
xOutputX :BOOL (OUTPUT)
xOutputY : BOOL (Output)

FALSE

TRUE

TRUE

TRUE

FALSE

FALSE

  1. Write a program to fulfill the following boolean table:

xStartA :BOOL (Input)
xOutputX :BOOL (OUTPUT)
xOutputY : BOOL (Output)

FALSE

TRUE

FALSE

TRUE

FALSE

TRUE

  1. Write a program to fulfill the following boolean table:

xStartA :BOOL (Input)
xStartB :BOOL (Input)
xOutputY : BOOL (Output)

FALSE

FALSE

FALSE

TRUE

FALSE

TRUE

FALSE

TRUE

TRUE

TRUE

TRUE

FALSE

Section 2 - Latching and Interlocking logics using contacts

  1. Write a program when xStart (Input) is pressed, xMotor (output) should be latched & when xStop is Pressed, xMotor (output) should be unlatched. In this case, consider xStart and xStop as NO Push Button.

  2. Write a program when xStart (Input) is pressed, xMotor (output) should be latched & when xStop is Pressed, xMotor (output) should be unlatched. In this case, consider xStart and xStop as NC Push Button.

  3. Write a program to interlock xSolenoidA (Output) and xSolenoidB (output). - When xStartA (Input) is pressed, xSolenoidA (output) should be latched, and xSolenoidB should be unlatched - When xStartB (Input) is pressed, xSolenoidB (output) should be latched, and xSolenoidA should be unlatched - When xStop (Input) is pressed, both solenoids should be unlatched Consider xStartA, xStartB as NO push button, and xStop as NC Push Button.

Section 3 - RS and SR flip-flops

  1. Using RS flipflop write a program when xStart (Input) is pressed, xMotor (output) should be latched & when xStop is Pressed, xMotor (output) should be unlatched.

  2. Using SR flipflop write a program when xStart (Input) is pressed, xMotor (output) should be latched & when xStop is Pressed, xMotor (output) should be unlatched.

  3. Realize the difference in operations when both the inputs xStart and xStop are TRUE. Which type of flipflop should be used ideally in this situation?

Section 4- Use of Timers

TON: On-delay timer; TOF: Off-delay timer

  1. Write a program such that when xStart (Input) is TRUE, xMotor (Output) gets TRUE after a delay of 5 secs. When xStart is FALSE, xMotor should be FALSE.

  2. Write a program when xStart (Input) is TRUE, xMotorA (Output) gets TRUE after 3 seconds delay, and then after a delay of 3 more seconds, xMotorB (Output) should get TRUE & after a delay of 3 more seconds, xMotorC (Output) should get TRUE.

  3. Write a program if xStart (Input) is TRUE xMotor (Output) is TRUE for 10 seconds, then gets FALSE.

  4. Write a program such that: - xStart (Input) latches xMotorA (Output) - After a delay of 10 seconds, xMotorB (Output) latches - xStop (Input) unlatches xMotorA - After a delay of 10 seconds, xMotorB should get unlatched.

  5. Write a program in which xMotorA (Output) latches only when xStartB (Input) is TRUE within 10 seconds just after the xStartA (Input) gets TRUE. Otherwise, if xStartB is TRUE after 10 seconds, nothing should happen. Unlatch xMotorA when xStartA is FALSE.

Section 5- Use of Timers with Comparators

EQ: Equal NE: Not equal LT: Less than LE: Less than or equals GT: Greater than GE: Greater or equals

  1. Use one push button xStart (Input) actuate xMotor (Output) in the following sequence: xMotor is TRUE for 2 seconds, then FALSE for 2 seconds, then TRUE for 3 seconds, then continuously FALSE.

  2. Use xStartA (Input) to blink xLamp (Output) such that the On-time is 0.5 seconds and Off-time is 1 second.

  3. Write a program such that: - When xStartA (Input) is TRUE, xLampA (Output) and xLampB should blink continuously with a delay of 1 second. - When xStartB (Input) is TRUE, xLampA (Output) and xLampB should blink continuously with a delay of 2 seconds.

  4. Write a simple traffic light program to fulfill the following conditions. The Timer should reset, and the cycle should repeat when the time is above 25 seconds.

Time (in seconds)
bRed (Output)
bOrange (Output)
bGreen (Output)

0 ~ 10

TRUE

FALSE

FALSE

11 ~ 12

TRUE

TRUE

FALSE

13 ~ 23

FALSE

FALSE

TRUE

24 ~ 25

FALSE

TRUE

TRUE

Section 6- Use of Counters with Comparators

CTU: Count Up CTD: Count Down

  1. Write a program such that when xStart is pressed three times, xOutput should get TRUE. And when xReset is TRUE once, the xOutput should be FALSE, and the counter should RESET.

  2. Write a program to fulfill the following conditions: - When xStart is pressed once -xOutputA should be TRUE, xOutputB and xOutputC should be FALSE - When xStart is pressed again -xOutputB should be TRUE, xOutputA and xOutputC should be FALSE - When xStart is pressed again -xOutputC should be TRUE, xOutputA and xOutputB should be FALSE - When xStart is pressed again - all the outputs should be FALSE, and the cycle should repeat itself

Section 7- Use of variables with Math Operators

ADD: Addition SUB: Subtraction MUL: Multiplication DIV: Division MOV: Move

  1. Write a program to fulfill the following conditions: - xStart (Input) should latch the lamp xLamp (output) after five seconds delay. - xStop (Input) should unlatch the xLamp - Use xTimeA (Input) to change the delay time to 10 seconds. - Use xTimeB (Input) to change the delay time to 5 seconds.

Use the Conversion command if necessary.

  1. Write the same program as the above but instead of moving the constant time of 5 and 10 seconds. Use xInc (Input) to increment the time by 100ms and xDec (Input) to decrement the time by 100ms.

  2. Add a program to the solution of Exercise 7.2 to limit the minimum and maximum time to 1 second and 3 seconds, respectively.

  3. Write a program to blink the output xLamp with a delay of 1 second when xStart is TRUE.

Section 8- Other operators

SEL: Bitwise selection MUX: Multiplexer LIMIT: Limit Conversion:

  1. Write a program using SEL such that the xAlarm (Output) should be TRUE if the iLevel (variable) is more than 80%. Take iLevel as an integer with the range of 0 to 100%. .

  2. Use the operand LIMIT in exercise 7.3 to define the limits and realize the result.

PreviousCodesysNextWAGO CC100

Last updated 1 year ago

Was this helpful?

๐Ÿญ