The code
is given.Code:DEFINE OSC 20 WHILE A <> 0 Zaehler_Byte = Zaehler_Byte + 1 WEND
Assuming that Zaehler_Byte = 60000, how long did the loop take?
The code
is given.Code:DEFINE OSC 20 WHILE A <> 0 Zaehler_Byte = Zaehler_Byte + 1 WEND
Assuming that Zaehler_Byte = 60000, how long did the loop take?
I think the following will happen. At startup all variables are cleared so A = 0. Therefore the While A <> 0 test will fail and the WHILE/WEND block will be skipped.
HTH
BrianT
Hi, ted
Supposing you use Zaeler_BYTE as a Word ( Good question ... indeed ) :
As you increment Zaeler_BYTE , you'll reach an overflow ( and return to Zero ) for Zaeler_BYTE = 65536 ...
so, you'll count from 60 000 to 60535 ...
that makes ??? loops ...
BUT ... as it is Zaeler_BYTE ...
Overflow will occur for Zaeler_BYTE = 256
And you'll count only from 96 ( 60 000 Lower Byte ) to 255 ...
that really makes ??? ... loops
Jawohl ???
Alain
PS: we suppose A is an input state ... and can be 0 or 1 ...
Last edited by Acetronics2; - 25th June 2008 at 12:30.
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
I think what Ted is actually asking is something like this ...
With a 20MHz osc, how long did it take for Zaehler_Word to reach 60,000?Code:DEFINE OSC 20 WHILE Zaehler_Word <> 60000 Zaehler_Word = Zaehler_Word + 1 WEND
Trent Jackson
Hi, Trent
Once, the littles things I raised up have been solved ... a little round in MPSIM is the next step ...
To be sure ...
Alain
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
I think that the question is very "meaningful" and not so easy to accurately answer without going into assembly routines. I say this because you need to know the number of instruction cycles needed for each mnemonic, the time taken for each cycle (around 1uS at 4MHz I think), and finally what OP codes are driving the PBP instructions. You need to have a good understanding of assembly code to be able to work it out, which I don't have, otherwise I'd provide an answer.
Trent Jackson
Hi,
I remember Darrel wrote a little bit of program to measure program parts duration ... a SEARCH through those columns will be welcome.
The second way is to use MPSIM ( part of MPLAB ) with the stopwatch : result is quite perfect !
Alain
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
I do not understand your answers.
What you need to take out of this:
If you loop a variable from zero to 60000 on a pic being driven by a 20Mhz Quartz using the pbp code WHILE without adding a Pauseus XY into the loop, what does this value tell me about the time being elapsed.
Bookmarks