# Clock and counter problem. User error or software bug?

**URL:** <https://forum.xod.io/t/clock-and-counter-problem-user-error-or-software-bug/74>\
**Category:** Uncategorized\
**Created:** [August 9, 2017, 5:24pm UTC](https://forum.xod.io/t/clock-and-counter-problem-user-error-or-software-bug/74 "2017-08-09T17:24:33Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![damianabaddon](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.xod.io/damianabaddon/32/42_2.png) [@damianabaddon](https://forum.xod.io/u/damianabaddon)\
**Post date:** [August 9, 2017, 5:24pm UTC](https://forum.xod.io/t/clock-and-counter-problem-user-error-or-software-bug/74/1 "2017-08-09T17:24:33Z")

</div>

I’m trying to drive a unipolar stepper motor and because there aren’t yet a loop support, I use two clocks, one for a counter that tick every 0.1 sec. and other for reset this counter but it doesn’t work. The counter never reset. Is ther a bug on XOD or I’m doing some thing wrong?

And… It’s normal that XOD use too many RAM of the PC and the atmega32 for a simple program like this?

 ![Captura de pantalla de 2017-08-09 11-53-28](https://yyz1.discourse-cdn.com/flex027/uploads/xod/original/1X/14a8b4f9f29511c024138b073b7671ca2929b239.png)

By the by, I think that is a good idea that we able to upload xodball files to the forum.

The xodball link:  
[https://drive.google.com/file/d/0BxweT3h5TRsDZjd4ZlpaRTIyb2M/view](https://drive.google.com/file/d/0BxweT3h5TRsDZjd4ZlpaRTIyb2M/view)

---

<div class="post-metadata">

**Author:** ![nkrkv](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.xod.io/nkrkv/32/8_2.png) [@nkrkv](https://forum.xod.io/u/nkrkv)\
**Post date:** [August 9, 2017, 8:35pm UTC](https://forum.xod.io/t/clock-and-counter-problem-user-error-or-software-bug/74/2 "2017-08-09T20:35:18Z")

</div>

🧐 …looks like we need to craft a standard node like `xod/common-hardware/uln-unipolar-stepper`.

I see that flip-flops could set, but they never reset (nothing at RST pin). Isn’t this is a problem? Didn’t try running it for myself, but if the problem is not in resets, I will.

BTW, there is a quick hack to monitor link values: use `xod/core/console-log` node connected to an output you’re interested in and open Serial Monitor in XOD IDE once you’d upload the program to your board.

About memory. There is a large room for relatively easy RAM optimization. AVR microcontrollers employ Harvard architecture which means they have different memory spaces for a program (flash, 32 KiB) and dynamic data (SRAM, 2 KiB). Many things that are immutable in XOD (like a program graph) are now put in the small data section although they may reside in the program section. Will do it in future releases.

---

<div class="post-metadata">

**Author:** ![damianabaddon](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.xod.io/damianabaddon/32/42_2.png) [@damianabaddon](https://forum.xod.io/u/damianabaddon)\
**Post date:** [August 10, 2017, 2:12am UTC](https://forum.xod.io/t/clock-and-counter-problem-user-error-or-software-bug/74/3 "2017-08-10T02:12:40Z")

</div>

Thank you, yes, this is the problem, I forgot that a XOD’s flip-flop is a flip-flop!

About stepper drivers, it isn’t better that you write a low level small and efficient group of booleans and other basics nodes and leave the task to build hardware specific big nodes to enthusiast users?

I’m still surprised that a little group of gates and flip-flops can fill 3/4 of all the atmega’s RAM.

---

<div class="post-metadata">

**Author:** ![nkrkv](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.xod.io/nkrkv/32/8_2.png) [@nkrkv](https://forum.xod.io/u/nkrkv)\
**Post date:** [August 10, 2017, 1:28pm UTC](https://forum.xod.io/t/clock-and-counter-problem-user-error-or-software-bug/74/4 "2017-08-10T13:28:02Z")

</div>

> [@damianabaddon](#):
>
> it isn’t better that you write a low level small and efficient group of booleans and other basics nodes and leave the task to build hardware specific big nodes to enthusiast users?

Yes, it is better starting at _some_ point. A solid basement should exist that gives many examples of how useful things could be done.

> [@damianabaddon](#):
>
> I’m still surprised that a little group of gates and flip-flops can fill 3/4

Easily if you neglect to think about some consequences in advance 😉

---

<div class="post-metadata">

**Author:** ![damianabaddon](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.xod.io/damianabaddon/32/42_2.png) [@damianabaddon](https://forum.xod.io/u/damianabaddon)\
**Post date:** [August 10, 2017, 6:51pm UTC](https://forum.xod.io/t/clock-and-counter-problem-user-error-or-software-bug/74/5 "2017-08-10T18:51:55Z")

</div>

Yes, I know, the oop, the c++ abstraction layer, etc…  
In a near future XOD will be a powerful programming tool. Pro tem, I love to play this NSFW logic puzzle 🙂

---

<div class="post-metadata">

**Author:** ![nkrkv](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.xod.io/nkrkv/32/8_2.png) [@nkrkv](https://forum.xod.io/u/nkrkv)\
**Post date:** [September 6, 2017, 9:02am UTC](https://forum.xod.io/t/clock-and-counter-problem-user-error-or-software-bug/74/6 "2017-09-06T09:02:53Z")

</div>

A significant optimization was done in [v0.13.0](https://forum.xod.io/t/xod-0-13-0-released/102/4). There’s still room to lower RAM consumption, but right at this moment, the situation is much better than before.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/1X/eb7348baa04192c2ef932d1db54d44f09f8a7888.png) [@system](https://forum.xod.io/u/system)\
**Post date:** [September 8, 2017, 9:02am UTC](https://forum.xod.io/t/clock-and-counter-problem-user-error-or-software-bug/74/7 "2017-09-08T09:02:55Z")

</div>

Closed on September 8, 2017, 9:02am UTC

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
