Pro
8 min

CCST 30 — Encoder Position Comparison

ccstmotionencoderpositioncomparison
CCST 30 — Encoder Position Comparison scenario preview

Ready to build this?

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

Sign up to play this scenario →

Already have an account? Log in

Briefing

An encoder provides POSITION_COUNTS (INT). Assert AT_TARGET when POSITION_COUNTS is within ±10 counts of TARGET_POSITION (1000).

Objectives

  • AT_TARGET := ABS(POSITION_COUNTS - 1000) <= 10
  • Implement without ABS if not available: use two comparisons

Hints

  • (POSITION_COUNTS >= 990) AND (POSITION_COUNTS <= 1010)
  • TARGET_POSITION is a constant = 1000

I/O Table

Inputs

POSITION_COUNTS

Encoder position counts

INT · %IW0

Outputs

AT_TARGET

At target position

BOOL · %Q0.0

Your program will be tested against:

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

  1. #1At target at 1000

    At target at 1000

  2. #2At target at 990

    At target at 990

  3. #3Not at target at 1011

    Not at target at 1011

Ready to build this?

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

Sign up to play this scenario →

Already have an account? Log in