Alright, you caught me!
I wrote that, or rather pieced it together when I should have been going to bed for the evening. It does have the typical “noob” mistakes of not turning the analog inputs off and setting TRIS for my output pins and probably a few more mistakes!
I have a bad habit of tackling this stuff right before bed, figuring I can get things off my mind before trying to sleep with ideas bouncing around in there. Then I start racing the clock and trip myself up. I’m an electronics technician by profession, but it’s actually mostly high voltage and tubes for me. I don’t get to do as much programming unless it’s my own stuff, after work.
Another problem is that, as you can see by my forum join date, I’ve been using PicBasic Pro a few years now. But I only work on PIC based projects once every few months, sometimes longer. And as they say: if you don’t use it…
But that said I’ve done all sorts of complex projects with PicBasic Pro, from thermostats with one-wire sensors and LCD readouts to all kinds of PWM motor and lighting controllers, robots, etc. I’ve just always found ways around using scary interrupts and timers. But I guess that’s what separates the men from the boys.
I tend to use SEROUT over HSEROUT because it doesn’t require outside help to communicate directly with the serial port on my PC. And I did remember that when trying to run your code the first time and gibberish was appearing in hyperterminal . I just inverted it with a 4049 and all was well. So a “hello world” I can handle.... I hope! 
I’ll start again and try to work on a bit at a time (smaller bytes
) and maybe get it working. But I think I’m having trouble wrapping my little brain around Interrupts. I mean I understand the basics of it. Like: when pin 1 sees signal X, jump to Y routine without regard to what the program was doing, and then return to that point in the program when the ISR is satisfied. But in the context of actual code, I’m clueless.
Like:
Code:
Capture:
Measure = 1
While Measure = 1 : WEND ' Wait until ISR has created the rising edge and started the timer
@ INT_ENABLE CCP1_INT ; Start new capture
Measure = 1
While Measure = 1 : WEND ' Wait until ISR has created the rising edge and started the timer
@ INT_ENABLE CCP2_INT ; Start new capture
RETURN
Isn’t this the same as polling kind of sort of? Why would I want to do that? Am I even supposed to be doing that?! Does it really matter if CCP2 gets a read of the counter before CCP1? On and on…
Anyway, I’ll play around with it until I either figure it out or get tired and go back to hiding from the hard stuff!
Thanks Again!
Ryan
Bookmarks