Alain> I don’t follow your discussion, sorry.
GioppY> Could you give more detail please?
Dave> I guess I was unclear about the use of the PIC, the PIC is not involved in the generator part.
Thanks!
Alain> I don’t follow your discussion, sorry.
GioppY> Could you give more detail please?
Dave> I guess I was unclear about the use of the PIC, the PIC is not involved in the generator part.
Thanks!
Check you PIC datasheet, some have built-in counter. This allow you to use them to count the incoming pulses for a x sampling time.
A while back i've made this one
http://www.picbasic.co.uk/forum/showthread.php?t=1044
Maybe this could be handy for you. It use TIMER0
Last edited by mister_e; - 10th November 2008 at 18:23.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
So, what you mean is that the PULSIN command is not the way to go then?
Thanks.
a 16F device running @ 20 Mhz max... so PULSIN will give you 2µs per count.And now the question; is this achievable using a 16FXXX device and the PBP PULSIN command?
PBP 16F compiler uses 16 bits ... so, 65535 counts at a maximum
Pulsin will give you a valid result from 1 to 65535 unit +/- 1 count.
@ 50% duty cycle your period can be ... 4 to 131070 µs +/- 4µs
a 16F device running @ 4Mhz ... so PULSIN will give you 10µs per count.
PBP 16F compiler uses 16 bits ... so, 65535 counts at a maximum
Pulsin will give you a valid result from 1 to 65535 unit +/- 1 count.
@ 50% duty cycle your period can be ... 20 to 655350 µs +/- 20µs
from that you can understand what precision and resolution you can get with the PULSIN command.
That's quite simple ...
Alain
PS: Gioppy gave you ... half of the answer !!! LOL
Last edited by Acetronics2; - 10th November 2008 at 18:54.
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
Have a look here:
http://www.picbasic.co.uk/forum/show...69&postcount=4
You can use this code to measure the frequency with timer1. This open the timer1 gate for exactly 1 sec. (@4MHz); so you can get a resolution of +- 1Hz. The result return in 2 words Hicntr and Locntr. Obviously you need a routine that convert the 32 bit to decimal.
With a bit less accuracy can be done in pbp.
http://www.picbasic.co.uk/forum/showthread.php?t=7828
Not very easy, but works fine.
Regards
Gianni
Thanks Guys, I think I have enough to read up on for now! I’ll let you know how it develops.
All the best!
Bookmarks