Nope,
It didn't work. I did catch a few mistakes as soon as I posted that. Like needing to comment my assembly stuff with ";" for example. And never flipping "FirstCapt" back after looking for the second pulse. And I had to play with the TMR0prescaler some more. The code I posted before this was running at 120Hz instead of 60Hz.
I think I would have to find a way to keep proper order and timing of when my interrupts fire. When I corrected the above mistakes and ran that code, my output varibles would lock onto a certain value and stay that way. Almost as if the CCPs were firing as soon as their interrupts were enabled. I tried all sorts of stuff and never had any luck with getting it to all work together.
I ended up using what Henrik had come up with for the 16F648A, I just got it to work on the 18F2320 and rolled in capturing with the CCP modules instead of the port B pins. It samples both CCPs 5 times, averages the results and breaks one of them out into 16 discrete "levels" before outputing via HSER.
I need to tweak some things yet. But I'll post what I came up with soon and explain what it's for.




Bookmarks