Hi Jes!
PIC12F1822 would be a nice candidate. 8 pins, one I2C, up to 32MHz on Timer1. 
For your application I wouldn't use "Capture", but "Timer1 Gate". 
As resolution, you could  think about 64µs (or 15625 Hz), it is 6.4% at shutter 
1/1000. Without crystal you won't get more garanteed than 2-3% accuracy anyway. 
Without using interrupts, you could measure as long as (65536*64µs=) 4,19 
seconds. 
Ok, well if you have speeds down to 1/8000 (which I have never seen ;-) can 
central shutters do that? ) you would need to use the interrupt method to 
extend the timer.
And... phototransistors are quite slow, especially then overdriven by something 
like a laser. Might be worth thinking about using a photodiode. 
Greets,Kiste
    Am Samstag, 5. September 2020, 12:08:40 MESZ hat Jes 
<[email protected]> Folgendes geschrieben:  
 
 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]> 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] <[email protected]> namens Jesito's 
μFabLab <[email protected]>
Verzonden: zaterdag 5 september 2020 09:55
Aan: jallib <[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] 
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 Timer1resource. When an event 
occurs on the CCP1 pin, the16-bit CCPR1H:CCPR1L register pair captures 
andstores the 16-bit value of the TMR1H:TMR1L registerpair, respectively. An 
event is defined as one of thefollowing and is configured by the CCP1M<3:0> 
bits ofthe CCP1CON register:• Every falling edge• Every rising edge• Every 4th 
rising edge• Every 16th rising edgeWhen a capture is made, the Interrupt 
Request Flag bitCCP1IF of the PIR1 register is set. The interrupt flagmust be 
cleared in software. If another capture occursbefore the value in the CCPR1H, 
CCPR1L register pairis read, the old captured value is overwritten by the 
newcaptured 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 
[email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jallib/29ca65ab-4f67-4e77-a321-9162fd396026n%40googlegroups.com.


-- 
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 
[email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jallib/AM0PR07MB62419C76A4D0F51F787AE7F5E62C0%40AM0PR07MB6241.eurprd07.prod.outlook.com.



-- 
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 
[email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jallib/CAJSrQ%3Df1Lm6tHoKCfC4LW68OcQgsKw5FUeGQgaKaiag5oKV8EA%40mail.gmail.com.



-- 
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 
[email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jallib/a079e103-5ea2-463a-b57d-53ad94caa730n%40googlegroups.com.


-- 
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/AM0PR07MB624194D03E0DB682805B8BF3E62A0%40AM0PR07MB6241.eurprd07.prod.outlook.com.



-- 
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%3Df4shHgZ9P7ykPjWW2JVG%2BaFdsFV9QLp6QMCdQ16hP1Vw%40mail.gmail.com.
  

-- 
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/100684801.1074600.1599302821173%40mail.yahoo.com.

Reply via email to