Question about the CNT
krazyideas
Posts: 119
Hello
I am just wondering about the system counter and how it works.
It is my understanding that it counts to 4 billion and the starts back at zero again.· If that is the·case of how it works, that means that everytime that you do a waitcnt command that includes a base time that such as
var
long time
PUB count
time := cnt
· repeat
··· waitcnt (time += 50_000)
··· !outa[noparse][[/noparse]0]
You would have a major glitch in the program, because the counter would eventually reach 4 billion along with the base time. In which case the base time would eventualy become equal to·4 billion + 50_000 and the program would never toggle again because the counter will never reach that number of 4 billion + 50_000.
Which means at 80MHz the program would only operate correctly for 53 seconds before failer.· Is this True???
Or would the base time roll over back to zero as well. Adding the surplus over 4 billion to zero makeing up the difference?
Meaning that 4 billion + 50_000 = 50_000 for both the counter and the base time???
How does that work?
Any thoughts would be great
Thanks
I am just wondering about the system counter and how it works.
It is my understanding that it counts to 4 billion and the starts back at zero again.· If that is the·case of how it works, that means that everytime that you do a waitcnt command that includes a base time that such as
var
long time
PUB count
time := cnt
· repeat
··· waitcnt (time += 50_000)
··· !outa[noparse][[/noparse]0]
You would have a major glitch in the program, because the counter would eventually reach 4 billion along with the base time. In which case the base time would eventualy become equal to·4 billion + 50_000 and the program would never toggle again because the counter will never reach that number of 4 billion + 50_000.
Which means at 80MHz the program would only operate correctly for 53 seconds before failer.· Is this True???
Or would the base time roll over back to zero as well. Adding the surplus over 4 billion to zero makeing up the difference?
Meaning that 4 billion + 50_000 = 50_000 for both the counter and the base time???
How does that work?
Any thoughts would be great
Thanks
Comments
Take care all
Krazyideas