# Using output compare on an XBee ZB Programmable S2B

**URL:** <https://forums.digi.com/t/using-output-compare-on-an-xbee-zb-programmable-s2b/11242>\
**Category:** XBee Programamble (S2C & 900 HP)\
**Created:** [October 29, 2012, 4:10pm UTC](https://forums.digi.com/t/using-output-compare-on-an-xbee-zb-programmable-s2b/11242 "2012-10-29T16:10:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![wz2b](https://avatars.discourse-cdn.com/v4/letter/w/e274bd/32.png) [@wz2b](https://forums.digi.com/u/wz2b)\
**Post date:** [October 29, 2012, 4:10pm UTC](https://forums.digi.com/t/using-output-compare-on-an-xbee-zb-programmable-s2b/11242/1 "2012-10-29T16:10:09Z")

</div>

I’m having trouble using the output compare function of the xbee library. I’m setting a timeout of 10 uS like this:

```auto
ocompare_config(ocompare0, 10, 10, OCCOMPARE_TOGGLE);

```

but the edges that come out aren’t 10 uS apart, they are 2.7 msec. The xbee programmable is the 32K variety, and I have the clock set to 48 MHz in the project configuration.

It’s not clear to me from the documentation whether or not I need to keep resetting the timer in the interrupt service routine, so I tried:

```auto
void ocompare0_irq(void)
{
   occompare_set_timeout(occompare0, 10);
   /* toggle a GPIO pin to make sure it's working */
}

```

but that had no effect at all (still 2.7 msec) other than proving to me that the interrupt service routine does indeed fire.

What am I doing wrong?
