delay limitations
delay limitations
I understand that the delay icon in Flowcode will not allow delays of less than 1ms to be generated and for those such as myself wishing to use microsecond delays (for servo driving) it is necessary to insert a block of C code. What I don’t understand is why this is the case and how to create the necessary C code.
Can you supply an example of a C code routine for this?
Understanding this anomaly would be of great assistance.
Tim
Can you supply an example of a C code routine for this?
Understanding this anomaly would be of great assistance.
Tim
Regards,
Tim
Tim
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: delay limitations
Hello Tim
There is a microsecond command but this has not been implemented into Flowcode as of yet as it does not work for all clock speeds.
The C code command is
A more reliable approach is to use delays of 10 microseconds as this works for all clock speeds.
Hope this helps.
There is a microsecond command but this has not been implemented into Flowcode as of yet as it does not work for all clock speeds.
The C code command is
Code: Select all
delay_us(1); //Delay for 1 microsecond
delay_us(50); //Delay for 50 microseconds
Code: Select all
delay_10us(1); //Delay for 10 microseconds
delay_10us(50); //Delay for 500 microseconds
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: delay limitations
Thanks for that Ben, it was helpful but say I want to assign a variable called DELAY in the main Flowcode prog. to the delay value how would that appear in the C code module?
Would it be something like:
delay_FCV_DELAYus(FCV_DELAY)); //Delay for DELAY variable amount
The bit in parenthesis looks dodgy.
My concern is that since it's not possible to simulate the C module within FC, the C code syntax etc. has to be spot-on before compiling to chip.
Would it be something like:
delay_FCV_DELAYus(FCV_DELAY)); //Delay for DELAY variable amount
The bit in parenthesis looks dodgy.
My concern is that since it's not possible to simulate the C module within FC, the C code syntax etc. has to be spot-on before compiling to chip.
Regards,
Tim
Tim
- Benj
- Matrix Staff
- Posts: 15312
- Joined: Mon Oct 16, 2006 10:48 am
- Location: Matrix TS Ltd
- Has thanked: 4803 times
- Been thanked: 4314 times
- Contact:
Re: delay limitations
Hello Tim
In Flowcode say you have a variable called count.
Then the C code would be,
In Flowcode say you have a variable called count.
Then the C code would be,
Code: Select all
delay_us(FCV_COUNT);
delay_10us(FCV_COUNT);
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
-
- Posts: 112
- Joined: Wed Oct 12, 2005 6:29 pm
- Location: USA
- Been thanked: 1 time
- Contact:
Re: delay limitations
Ben:
Is there a plan to add the 10 uS delay feature to the Delay component in V4 while maintaining the Sec and mSec choices? Having to pick uS delays that are multiples of 10 would be fine for my applications.
Jim
Is there a plan to add the 10 uS delay feature to the Delay component in V4 while maintaining the Sec and mSec choices? Having to pick uS delays that are multiples of 10 would be fine for my applications.
Jim
- Steve
- Matrix Staff
- Posts: 3424
- Joined: Tue Jan 03, 2006 3:59 pm
- Has thanked: 114 times
- Been thanked: 422 times
- Contact:
Re: delay limitations
Hi Jim,
Yes - we'll probably add this feature to v4.
[Hey - this is my 1000th post. Do I get a medal or something??]
Yes - we'll probably add this feature to v4.
[Hey - this is my 1000th post. Do I get a medal or something??]
-
- Posts: 112
- Joined: Wed Oct 12, 2005 6:29 pm
- Location: USA
- Been thanked: 1 time
- Contact:
Re: delay limitations
Steve:
1000 posts - you sure get a medal in my book!! This is probably a good time to thank you for all of the assistance you have given to me over the past few years in getting my application(s) going in Flowcode - it just keeps getting better!
That would be great if V4 would allow for uS delays (albeit in 10 uS increments). Somewhat off topic (now that I have buttered you up) but the next big thing for me will be availability of floating point math for the PICs. I take it that will roll out with V4 also. Any chance we could see that any sooner as a V3 update?
Jim
1000 posts - you sure get a medal in my book!! This is probably a good time to thank you for all of the assistance you have given to me over the past few years in getting my application(s) going in Flowcode - it just keeps getting better!
That would be great if V4 would allow for uS delays (albeit in 10 uS increments). Somewhat off topic (now that I have buttered you up) but the next big thing for me will be availability of floating point math for the PICs. I take it that will roll out with V4 also. Any chance we could see that any sooner as a V3 update?
Jim
- Steve
- Matrix Staff
- Posts: 3424
- Joined: Tue Jan 03, 2006 3:59 pm
- Has thanked: 114 times
- Been thanked: 422 times
- Contact:
Re: delay limitations
Consider me truly buttered-up!
It may be possible to implement fp in Flowcode PIC as an update - I'll look into it. But what I really want to do is crack on with the v4 work - there's a lot to get through!!!
It may be possible to implement fp in Flowcode PIC as an update - I'll look into it. But what I really want to do is crack on with the v4 work - there's a lot to get through!!!
-
- Posts: 112
- Joined: Wed Oct 12, 2005 6:29 pm
- Location: USA
- Been thanked: 1 time
- Contact:
-
- Posts: 112
- Joined: Wed Oct 12, 2005 6:29 pm
- Location: USA
- Been thanked: 1 time
- Contact:
Re: delay limitations
Steve,
How right you are but then again the basics will do 90% of the work!
Jim
How right you are but then again the basics will do 90% of the work!
Jim