---
title: Using the counter for timeouts
description: "[PASM2](https://obex.parallax.com/code-language/pasm2/) ## Introduction Each cog has independent counters that can run in the background and support your code without overhead. The counters can perform many operations, and here we mention using them for operation timers. ## Code Snippet These code…"
url: "https://obex.parallax.com/docs/chips-tips/propeller-2/using-the-counter-for-timeouts/"
updated: "2025-01-10"
category: Propeller 2
---

# Using the counter for timeouts

[PASM2](https://obex.parallax.com/code-language/pasm2/)

## Introduction

Each cog has independent counters that can run in the background and support your code without overhead.

The counters can perform many operations, and here we mention using them for operation timers.

## Code Snippet

These code snippets show an efficient way to setup your own timeout and check them using the `pollct` instructions

1. Setup your own timeout

```spin2
getct      timeout                         ' set timeout value
addct1     timeout,          ##delay1s
```

1. Test if the timeout has been exceeded

```spin2
pollct1    wc
if_c       jmp              #timed_out
```

---

## Resources

[Parallax Propeller 2 - Spin2 Language Documentation](https://docs.google.com/document/d/16qVkmA6Co5fUNKJHF6pBfGfDupuRwDtf-wyieh_fbqw/preview)

---
