Flowcode A/D macro
Posted: Mon Oct 24, 2005 10:43 pm
I suppose this question/topic should be directed to Ian.
In the Flowcode A/D macro there is a loop counter that defaults to D '220' with a 20 MHz clock. I think there are five or so instructions in the loop so with a 20mHz clock that results in a setup period of at least 220 microseconds (there are also many other instructions that execute outside that loop).
The A/D should be able to do conversions about every 20 microseconds so this would seem to be an excessively long setup period and an unnecessary restriction on the A/D sampling rate. In practice, I'm able to reduce the loop count to D '10' (or even D '5') and the A/D runs happily at about one sample every 30 microseconds. To make the change in the loop count I edit the assembly code for each A/D channel after every compilation.
Why does flowcode impose such a long period and is it possible to directly edit the Flowcode macro so that the C code compiles to .asm with a lower loop count? I've tried dropping the C code for the A/D into a "code box" and then inserting that into a larger program but that doesn't seem to work. Suggestions?
In the Flowcode A/D macro there is a loop counter that defaults to D '220' with a 20 MHz clock. I think there are five or so instructions in the loop so with a 20mHz clock that results in a setup period of at least 220 microseconds (there are also many other instructions that execute outside that loop).
The A/D should be able to do conversions about every 20 microseconds so this would seem to be an excessively long setup period and an unnecessary restriction on the A/D sampling rate. In practice, I'm able to reduce the loop count to D '10' (or even D '5') and the A/D runs happily at about one sample every 30 microseconds. To make the change in the loop count I edit the assembly code for each A/D channel after every compilation.
Why does flowcode impose such a long period and is it possible to directly edit the Flowcode macro so that the C code compiles to .asm with a lower loop count? I've tried dropping the C code for the A/D into a "code box" and then inserting that into a larger program but that doesn't seem to work. Suggestions?