[quote:666f54c901="MWS"][quote:666f54c901="philm"]here are some snips of code.[/quote:666f54c901]
Not sure about the value of incomplete code missing all its variable definitions. Also one of your code's problems is it's unhandled race-condition, when the overflow int occurs, while execution of the icp int is on it's way.
Potential is wasted by resetting the counter, instead of pushing the icp simply into a 16 bit unsigned variable and do it by subtraction. No mechanism also to protect the result from being modified, while it's being output.
And finally I'm wondering, whether you get what you ask for, as the Bascom syntax does not require to have NOSAVE separated by a comma:
[quote:666f54c901][code:1:666f54c901]On Icp1 Nt , Nosave[/code:1:666f54c901][/quote:666f54c901]
Did you disassemble your code at least one time, to check how the isr's actually get compiled?[/quote:666f54c901]
The value of the code can be decided by the OP. He can get some ideas from it or not. It's up to him (or her).
It's pretty obvious that bits are missing, and it won't compile. Blah Blah blah is not a Bascom key word. The missing bits are for the OP and his application.
If the "potential" is not required in the application, why implement it
.
There can never be a "race condition", if I understand what you mean by "race condition". It either measures a capture or overflow, never both.
Bascon doesn't throw up a syntax error, and yes, it does what I expect.
And I don't know why you do subtraction from the old tcnt value to get the current real capture, when zeroing tcnt and reading the values directly would do the same thing.
I'll assume there is a good reason for it, that I don't understand.
↧