Alternate method of creating a timer??
James Long
Posts: 1,181
Ok....so I know I could use the waitcnt command to create a timer.
Is there an alternate method that I don't have to pause a cog to get a accurate time with.
I'm looking for seconds.....
I really don't want to pause a whole cog for time retrieval.
anyone with any ideas??
Could I use a CNTR to get a time result??
Thanks for any suggestions,
James L
Is there an alternate method that I don't have to pause a cog to get a accurate time with.
I'm looking for seconds.....
I really don't want to pause a whole cog for time retrieval.
anyone with any ideas??
Could I use a CNTR to get a time result??
Thanks for any suggestions,
James L
Comments
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
Must I use a pin to use the CTR's?
If I must i can....not a problem.....
Now to figure out how to configure them.
James L
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Paul Baker
Propeller Applications Engineer
Parallax, Inc.
c·:= 80_000_000··· 'how about once·a second at 80MHz?
t := cnt·········· 'get the initial cnt value
repeat············ 'here's·your loop
· <normal code here>
· if·cnt - t·=>·c· 'has the critical amount of time elapsed?
··· t += c······· 'yes, update target
··· <timer code here>
This will be a little jittery, but will have no cumulative error. So, you could even use it for timekeeping.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chip Gracey
Parallax, Inc.
Post Edited (Chip Gracey (Parallax)) : 4/9/2007 8:44:04 PM GMT
Wouldn't the last line actually read:
t += c
Think the t1 was a typo.
But I think that would work....without using the ctr command........
Thanks......
James L
Edit: I had something similar.......but I think I was doing something weird causing it not to ever pass the if statement.
Post Edited (James Long) : 4/9/2007 7:16:33 PM GMT
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chip Gracey
Parallax, Inc.