I would like to build a measuring device in addition to the actual project to be developed.
How to accurately and quickly measure a pulse breaks ratio? My successful approach (30 years ago, at least, 68HC11) was just one second (32768 times) to measure an input and count up the variables. The frequency was around 10 Khz. There are now more elegant methods and the microcontrollers are much faster. My idea is to clock a PIC with 40 MHz and then to build a simple measuring device. The goal is to measure the frequency and the ratio of high low correctly even if only 10 pulses are measured and the frequency is about 40 kHz, better still higher.
Because here are some of Experts waiting for challenges I'm ask ;-)
Last edit: bed 2017-12-07
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I think you're describing a pulse train with variable duty cycle and you want to measure the frequency as well as duty cycle (on/off times); is that correct?
If so, you can do this by sending the pulse train to an input that's set up tp interrupt on positive edges as well as negative edges. Here's how I'd approach it:
Consider the positive-going edge to be the start of a cycle. When an interrupt occurs, check the input to see if it's high. If so, record the tiime ("T1"). Now, when an interrupt occurs on a negative edge (check for low) record the time again ("T2). Now when an interrupt occurs again (high), check the time again ("T3). The repetition rate is T1 minus T3. The on (high) time is T2. The off time (low) is T3. From these, you can completely characterize each cycle of the pulse train.
This method will be as accurate as your crystal oscillator and won't tie up the processor while measuring.
Joe
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yes Joe, exact this " pulse train with variable duty cycle"
Thank you for the flow :-) I think http://gcbasic.sourceforge.net/help/_measuring_a_pulse_width.html
is going to be my friend ;-)
Whow! I even not knew that a 32MHz Internal OSC PIC do exists. Wunderful Help page
Last edit: bed 2017-12-08
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The Master of Docs Anombium and the excellent documentation surprises me again and again! Actually, I did not want to buy extra PIC's, because about 50 pieces I have lying around, which are too bad only to sleep in the box ... well let's see
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The SMT Demos only demonstrate use of the SMT 24-bit timer. I was just beginning to explore the SMT peripherial when I wrote the SMT_Timers library and the demos. SMT can do way more than toggle an LED with precise timing.
As time permits I will try to write a new SMT library that utilizes the SMT peripheral to makes precise pulse measurements.
Last edit: William Roth 2017-12-09
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Sounds very interesting!
But no hurry, I will try it first with my available stuff. Even that will need a lot time passing by because of other challenges in real live... ;-)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I would like to build a measuring device in addition to the actual project to be developed.
How to accurately and quickly measure a pulse breaks ratio? My successful approach (30 years ago, at least, 68HC11) was just one second (32768 times) to measure an input and count up the variables. The frequency was around 10 Khz. There are now more elegant methods and the microcontrollers are much faster. My idea is to clock a PIC with 40 MHz and then to build a simple measuring device. The goal is to measure the frequency and the ratio of high low correctly even if only 10 pulses are measured and the frequency is about 40 kHz, better still higher.
Because here are some of Experts waiting for challenges I'm ask ;-)
Last edit: bed 2017-12-07
I think you're describing a pulse train with variable duty cycle and you want to measure the frequency as well as duty cycle (on/off times); is that correct?
If so, you can do this by sending the pulse train to an input that's set up tp interrupt on positive edges as well as negative edges. Here's how I'd approach it:
Consider the positive-going edge to be the start of a cycle. When an interrupt occurs, check the input to see if it's high. If so, record the tiime ("T1"). Now, when an interrupt occurs on a negative edge (check for low) record the time again ("T2). Now when an interrupt occurs again (high), check the time again ("T3). The repetition rate is T1 minus T3. The on (high) time is T2. The off time (low) is T3. From these, you can completely characterize each cycle of the pulse train.
This method will be as accurate as your crystal oscillator and won't tie up the processor while measuring.
Joe
Yes Joe, exact this " pulse train with variable duty cycle"
Thank you for the flow :-) I think http://gcbasic.sourceforge.net/help/_measuring_a_pulse_width.html
is going to be my friend ;-)
Whow! I even not knew that a 32MHz Internal OSC PIC do exists. Wunderful Help page
Last edit: bed 2017-12-08
Check out the 16F188xx and 16F16xx series of chips that include a dedicated Signal Measurement Timer (SMT)
And, pop over to GitHub...
https://github.com/Anobium/Great-Cow-BASIC-Demonstration-Sources/find/master
Enter SMT and then you will be shown all the demos with SMT. Top few look like a match.
The Master of Docs Anombium and the excellent documentation surprises me again and again! Actually, I did not want to buy extra PIC's, because about 50 pieces I have lying around, which are too bad only to sleep in the box ... well let's see
The SMT Demos only demonstrate use of the SMT 24-bit timer. I was just beginning to explore the SMT peripherial when I wrote the SMT_Timers library and the demos. SMT can do way more than toggle an LED with precise timing.
As time permits I will try to write a new SMT library that utilizes the SMT peripheral to makes precise pulse measurements.
Last edit: William Roth 2017-12-09
Sounds very interesting!
But no hurry, I will try it first with my available stuff. Even that will need a lot time passing by because of other challenges in real live... ;-)