got it! i'll get a crystal as soon as i can to get pulsin to work. thanks again skimask.
jose
got it! i'll get a crystal as soon as i can to get pulsin to work. thanks again skimask.
jose
The only problem with going with a faster oscillator and using pulsin is that you might end up counting too fast and max out the pulsin statement before you actually finish counting.
If you've got an idea of the maximum pulse width that you'd ever be sampling, you should base your oscillator choice on that.
Once you've got that down and working, there are other ways to count pulse widths, using a timer, a capture, and so on...
I got the ccp interupt working on the 12f683 and i am able to count the pulse width, period, etc with it. but i need to count the pulse on 6 different pins and i could only use the ccp interupt on the ccp pin. therefore i though i should use the "pulsin" to count the pulses so i can use multiple pins.
i could use "pulsin" on any pin and as many pins i want right? the minimum pulse width is 25us and the maximum pulse is 16.5ms on the system that im trying to interface. do you have any suggestions as to what size crystal i should get? i think im gonna stick with the pic16f84A for this project. it has 13 different I/Os 6 of which are going to be input from the pulses.
You could 'steer' the different pulses to the ccp pin using a simple logic gate, something like a 2 input AND gate, one input tied to an 'enable' pin, the other input tied to the actual input pulse.
- Pulsin can be used on as many pins as can be set to inputs.
- If you used a 20Mhz oscillator, the pulsin resolution is 2us... Therefore, at 25us, you'll get either 12 (24us) or 13 (26us) counts; at 'exactly' 16.5ms (16,500 us), you'll get 8,250 counts.
(Theoretically, and if the PIC supported it, you should be able to go all the way up to 80Mhz...25us=100 counts, 16,500=33,000 counts).
PulsIn ties up the processor for the duration of the pulse. Without knowing the details of the application it's hard to say for certain but it's not a good choice if you need to count pulses on multiple pins simultaneously.
Bookmarks