Hi Jes, Interesting project.
Attached you find a first prototype which does do something. I tested it with a frequency range of 2500 - 25000 Hz but it is not - yet - accurate. A frequency of 8000 Hz is displayed as 8237 Hz on the dispaly but at least it is something to get you going. This version uses indeed the OLED display so if you want to compile this program make sure you use the latest bee package since there you find the driver for the SSD1306. I wil continue with making it more accurate and 'auto-ranging' to measure lower frequencies. Kind regards, Rob ________________________________ Van: [email protected] <[email protected]> namens Jes <[email protected]> Verzonden: zaterdag 5 september 2020 12:08 Aan: [email protected] <[email protected]> Onderwerp: Re: [jallib] Some help needed to measure pulse length Thanks Rob. I'm not in a hurry, just learning and trying to get profit from what I learn. My project is a simple shutter speed meter for old film cameras (which I collect and repair). There is a little led laser pointing to a phototransistor sitting on the film plane and going through the lens socket. Max shutter "speeds" (the term is used in photography) are of 1/8000 of sec. On the other end, time can be a long exposure of minutes or even hours, but normally measuring up to 5 sec should be enough to certify the accuracy of the shutter. Most pictures are taken in a range between 1/30 sec and 1/500 sec. Many old cameras have a restricted range, not beyond 1/250 sec. I would like to have an autonomous unit (not tied to a, computer) so I would need only a few pins, just one for the signal and two for an small I2C display, like the ones powered by the SSD1306 :O) I was following the thread because that. Now I have to find out if one of the small 12F units is able to do that. Would be a perfect fit for my needs. Kind regards. Jes. El sáb., 5 sept. 2020 10:17, Rob CJ <[email protected]<mailto:[email protected]>> escribió: Hi Jes, Since my previous project was finished I was thinking of prototyping this frequency counter in JAL. My idea is to use it in combination with an SSD1306 display and test it using the library I created for the Si5351 although the range will be limited of this frequency counter. I think of making it 'auto ranging' as to increase the frequency range indeed by changing prescaler values as you mentioned to measure lower frequencies. I do not yet know how low it can measure. I might even post it on Instructables as prototype. I saw some examples there based on Arduino but most of them are very simple, that is no auto-ranging and so limited in the range it can handle. I started today, not sure how long it wil take but when it is done I will post the source file on Jallib or on Instructables. BTW I will base it on a PIC16F1823 since that is the one I often use in my projects but you can use other PICs as long as it has the capture function. As said I do not know how long it will take so don't wait for it 🙂. Kind regards, Rob ________________________________ Van: [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>> namens Jesito's μFabLab <[email protected]<mailto:[email protected]>> Verzonden: zaterdag 5 september 2020 09:55 Aan: jallib <[email protected]<mailto:[email protected]>> Onderwerp: Re: [jallib] Some help needed to measure pulse length Many thanks Rob. I have to figure out how to do it. Is the timer working at the MCU clock speed?. If so the 16 bit value might be too small to hold the pulse length for i.e. a 5 sec pulse, isn't it?. I suppose some prescaling should be done there... Have to investigate and read more on that. Kind regards. Jes. El jueves, 3 de septiembre de 2020 a las 18:51:51 UTC+2, [email protected]<mailto:[email protected]> escribió: Hi Jes, I just checked but I was mistaken, there is a procedure that calculates a value for the timer based on a frequency. If you want to measure the length of a pulse you can use the capture mode of a timer which is available in many PICs, for example the 16F1823.From the datasheet: Capture mode makes use of the 16-bit Timer1 resource. When an event occurs on the CCP1 pin, the 16-bit CCPR1H:CCPR1L register pair captures and stores the 16-bit value of the TMR1H:TMR1L register pair, respectively. An event is defined as one of the following and is configured by the CCP1M<3:0> bits of the CCP1CON register: • Every falling edge • Every rising edge • Every 4th rising edge • Every 16th rising edge When a capture is made, the Interrupt Request Flag bit CCP1IF of the PIR1 register is set. The interrupt flag must be cleared in software. If another capture occurs before the value in the CCPR1H, CCPR1L register pair is read, the old captured value is overwritten by the new captured value. Kind regards, Rob ________________________________ Van: [email protected] <[email protected]> namens Jes <[email protected]> Verzonden: donderdag 3 september 2020 13:45 Aan: [email protected] <[email protected]> Onderwerp: Re: [jallib] Some help needed to measure pulse length Thanks Rob, I look for it, just what I needed to know :0) El jue., 3 sept. 2020 12:01, Rob CJ <[email protected]> escribió: Hi Jes, I thought there is already a Jal library to measure the width of a pulse created by Matt. Would that do the job? Met vriendelijke groet, Rob Jansen ________________________________ From: [email protected] <[email protected]> on behalf of Jesito's μFabLab <[email protected]> Sent: Thursday, September 3, 2020 10:49:48 AM To: jallib <[email protected]> Subject: [jallib] Some help needed to measure pulse length Hello, I'm new to JAL and I would like to measure the length of some pulses that can be as long as 5 sec and as short as 1/8000 of second. I have a handful of different pics, but ideally I would like to use a small one, I just need one pin for the pulse, two more to interface to an I2C small display and one more to reset and restart the measure. Could anyone point me to an example that could guide me through this?. I love the cleanless and simplicity of JAL. Thanks in advance. Jes. -- You received this message because you are subscribed to the Google Groups "jallib" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jallib/29ca65ab-4f67-4e77-a321-9162fd396026n%40googlegroups.com<https://groups.google.com/d/msgid/jallib/29ca65ab-4f67-4e77-a321-9162fd396026n%40googlegroups.com?utm_medium=email&utm_source=footer>. -- You received this message because you are subscribed to the Google Groups "jallib" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jallib/AM0PR07MB62419C76A4D0F51F787AE7F5E62C0%40AM0PR07MB6241.eurprd07.prod.outlook.com<https://groups.google.com/d/msgid/jallib/AM0PR07MB62419C76A4D0F51F787AE7F5E62C0%40AM0PR07MB6241.eurprd07.prod.outlook.com?utm_medium=email&utm_source=footer>. -- You received this message because you are subscribed to the Google Groups "jallib" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jallib/CAJSrQ%3Df1Lm6tHoKCfC4LW68OcQgsKw5FUeGQgaKaiag5oKV8EA%40mail.gmail.com<https://groups.google.com/d/msgid/jallib/CAJSrQ%3Df1Lm6tHoKCfC4LW68OcQgsKw5FUeGQgaKaiag5oKV8EA%40mail.gmail.com?utm_medium=email&utm_source=footer>. -- You received this message because you are subscribed to the Google Groups "jallib" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]<mailto:[email protected]>. To view this discussion on the web visit https://groups.google.com/d/msgid/jallib/a079e103-5ea2-463a-b57d-53ad94caa730n%40googlegroups.com<https://groups.google.com/d/msgid/jallib/a079e103-5ea2-463a-b57d-53ad94caa730n%40googlegroups.com?utm_medium=email&utm_source=footer>. -- You received this message because you are subscribed to the Google Groups "jallib" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]<mailto:[email protected]>. To view this discussion on the web visit https://groups.google.com/d/msgid/jallib/AM0PR07MB624194D03E0DB682805B8BF3E62A0%40AM0PR07MB6241.eurprd07.prod.outlook.com<https://groups.google.com/d/msgid/jallib/AM0PR07MB624194D03E0DB682805B8BF3E62A0%40AM0PR07MB6241.eurprd07.prod.outlook.com?utm_medium=email&utm_source=footer>. -- You received this message because you are subscribed to the Google Groups "jallib" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]<mailto:[email protected]>. To view this discussion on the web visit https://groups.google.com/d/msgid/jallib/CAJSrQ%3Df4shHgZ9P7ykPjWW2JVG%2BaFdsFV9QLp6QMCdQ16hP1Vw%40mail.gmail.com<https://groups.google.com/d/msgid/jallib/CAJSrQ%3Df4shHgZ9P7ykPjWW2JVG%2BaFdsFV9QLp6QMCdQ16hP1Vw%40mail.gmail.com?utm_medium=email&utm_source=footer>. -- You received this message because you are subscribed to the Google Groups "jallib" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/jallib/AM0PR07MB624192315940757F3EB81813E62A0%40AM0PR07MB6241.eurprd07.prod.outlook.com.
16F1823_frequency_counter_draft.jal
Description: 16F1823_frequency_counter_draft.jal
