Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 4834

General • Re: Pulse counter using RP2040

$
0
0
So, I think I should be more specific:
I am getting a square pulse (generated by a pulse generator). The frequency doesn't matter, as I can change the time between pulses. So I am generating 1 pulse with width 1μs (10^-6 sec).
So firstly I thought maybe somehow I can detect even shorter pulses, but now I understand that is not posible with only the RP2040.
Secondly I have to messure the ampplitude (in Volts) of the pulse. I am having problem with that too.
the code that I am using is here:

Code:

import machineimport utimevoltage_pin=machine.ADC(26)volt=0while True:    val = voltage_pin.read_u16()    if (val > 1000):            volt=(float)(val*3.3/65536)            print(f"{volt}V")
I thought maybe I could use GPIO and interrupts to messure the amplitude and count the pulses.
If you have any ideas how could I do that.
Also i found this code: https://github.com/jbentham/pico/blob/m ... dc_test.py
But I am not sure how can I use that for my problem...

Statistics: Posted by Hristeks — Wed Apr 10, 2024 10:50 pm



Viewing all articles
Browse latest Browse all 4834

Trending Articles