Basic
12 min

Motion 02 — Index conveyor

motionencodercounterCTUconveyorindexingtimerTON

Ready to build this?

Sign up free — no credit card required. This scenario requires the Basic plan.

Sign up to play this scenario →

Already have an account? Log in

Motion 02 — Index conveyor

Briefing

An indexing belt moves product one station at a time. An encoder on the drive roller sends one ENC_PULSE for every 10 mm of belt travel. Tap START and the belt moves exactly one index, 150 mm. Then it stops and DWELL_LAMP lights for 1.5 seconds while the station works on the part. When the dwell is over the lamp goes off and the machine waits, belt stopped, for the next START. The next index must be 150 mm again, so the count has to begin from zero every time. START pressed while indexing or dwelling does nothing. STOP aborts an index or a dwell and switches everything off. The INDEXING and DWELL bits, the counter and the timer are declared for you.

Objectives

  • START runs the belt for exactly one 150 mm index
  • At 150 mm the belt stops and DWELL_LAMP lights
  • The dwell lasts 1.5 s, then the lamp goes off and the machine waits
  • The second index is also exactly 150 mm
  • START is ignored while busy; STOP aborts an index or a dwell

Hints

  • Treat one index as a small cycle with three states: idle, moving and dwelling. Say what moves the machine from each state to the next.
  • The counter should only count while the belt is moving. If it keeps its old count between indexes, the second index will be the wrong length: decide what holds it at zero when the machine is not indexing.
  • The moment the count is reached does two things at once: it ends the move and starts the dwell. The dwell timer ending is what returns the machine to rest.
  • Press START twice in quick succession, and once during the dwell. Neither press may start a second index. Then run two indexes in a row and check the second one is the same length.

I/O Table

Inputs

START_PB

Start push-button (momentary NO)

BOOL · %I0.0

STOP_PB

Stop push-button (TRUE = pressed)

BOOL · %I0.1

ENC_PULSE

Encoder: one pulse per 10 mm of belt

BOOL · %I0.2

Outputs

BELT_RUN

Belt motor run command

BOOL · %Q0.0

DWELL_LAMP

Station busy (dwell) lamp

BOOL · %Q0.1

Your program will be tested against:

All test cases run automatically when you submit. Assertions are hidden until you pass.

  1. #1Tap START → belt runs, dwell lamp off

    A momentary START begins an index

  2. #2After 2.4 s (about 120 mm) → still indexing

    The count has not reached one index yet

  3. #3After 3.5 s → belt stopped on the 150 mm mark, dwell on

    Fifteen pulses end the move and start the dwell

  4. #4After 4.2 s → still dwelling

    The dwell lasts 1.5 s

  5. #5After 5.0 s → dwell over, machine waiting

    The dwell ends by itself and nothing restarts

  6. #6STOP during the index → belt off and stays off

    STOP aborts the index

  7. #7START during the index and during the dwell → one index only

    START is only accepted when the machine is idle

  8. #8A second START → another 150 mm, ending on the 300 mm mark

    The count restarts from zero for every index

Ready to build this?

Sign up free — no credit card required. This scenario requires the Basic plan.

Sign up to play this scenario →

Already have an account? Log in