1ms square wave

Hi,

I am trying to build a square wave that has a 1 milli second period with a 5% duty cycle.
Generating the 1ms wave is not a problem, the issue happens with the duty cycle as it seems the tool is unable to handle the timing of my 5% duty cycle (50 micro seconds). Did anyone face this issue before, or maybe have a solution for it?

There was a previous discussion Maximum square wave pulse frequency

Thank you for taking the time to read my post.
I saw the discussion you are referring to, but there no one gave an appropriate answer to the true question (how shorter T and duty cycle can be) and most of the answers were around how to control a stepper motor (which im not interested in). I was afraid if i post there it will get lost within those answers.
My questions are:
-how shorter they can be?
-is there a possibility to get 50us?
-if not, did anyone find a workaround?

Adding to an old post is a good way for your question to get lost. I was pointing out where you might find additional information, not suggesting you shouldn’t have started a new topic.

How fast you can get XOD code to respond is going to depend a lot on how much code there is to execute. If the CPU is busy with something else, there will be late pulses.

Probably the only way to guarantee micro-second response time is to use interrupts, and XOD doesn’t have much (any?) support for that. XOD was developed to make programming easy, not to push Arduino boards to their limits.

That said, it should be possible to create your own nodes coded in C++ to process interrupts. It just hasn’t been a priority for anyone up to this point. There have been quite a few other posts talking about interrupts that may (but likely won’t) be of help to you. There is one library for interrupts, which also mentions xod/gpio (Libraries — XOD), but it looks like that is geared more to interrupts triggered by pin input.

Thank you again gweimer.
The patch i tried is very simple: square wave node and digital write, but the patch was not responding as intended. While i could get from the same Arduino board the expected signals for a more complex circuit.
I can understand the limitations of XOD and i am very thankful for the creators and the contributors for what they have done so far. I tried to work my way through the C++ code to edit and create a new node but can’t find a way to handle micro seconds, is available is only milli seconds level.
I will try to keep digging

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