Can mega 2560 decode a 110 kHz PWM ? (micro/nano resolution)

is it fast enough ? as ive read 328 is not and understand it has something to do with micros resolution. what is the 2560's micros resolution ?

thanks

The (micros) library is the same as far as I know.

4 µS resolution.

thankyou very much for the reply, so im gussing there's no software way i can get it to read said 100 kHz signal, as it has a 9.8 mic cycle time and i would need 100 increments of resolution within that ... =(

At that rate, you can think about inline self-clocked assembly language. That's essentially how the "software USB" implementations manage to read the 1.5Mbps (low speed) USB datastream do things; Look for the start of message, read all the bits, and THEN figure our what you have and what to do with it. So it will depend on the details of what's in your datastream, how often you have to read it, and how much time you need to do things OTHER than reading it.

once again thanks for the reply,

it is a rssi reading as pwm, it only has one 'bit' just the length of the duty cycle (on period), this is just constantly repeated every 9.8 mics

so a 99% of 9.8 mic pulse = 100% rssi and 1% pulse of the 9.8 mic cycle = 0% thus the need for 100 steps in the range, which i work out to be 98 nano second resolution.

it would only need to read about once or twice every second

it would either be running on a 2560 multicopter flight controller, or a 328 osd unit

is this do able ? thanks!

You can probably measure a pulse with about 125ns resolution; Maybe even better, using "capture mode" on one of the timers (I'm not familiar with "capture mode", but measure pulse widths is one of the things it does.) But I don't know that you could do anything meaningful with it at 110k samples/sec...

15.6 Input Capture Unit The Timer/Counter incorporates an Input Capture unit that can capture external events and give them a time-stamp indicating time of occurrence. The external signal indicating an event, or mul- tiple events, can be applied via the ICP1 pin or alternatively, via the analog-comparator unit. The time-stamps can then be used to calculate frequency, duty-cycle, and other features of the sig- nal applied. Alternatively the time-stamps can be used for creating a log of the events.

I’m working on a project that uses a TDC-GP22 that should be able to measure that sort of duration. It’s typically 90ps resolution but can supposedly go down to 22ps in mode 2 or 45ps in mode 1.

It sounds to me like your trying to read an ANALOG signal using software! What are you trying to read from? As PWM used to move an old fashioned meter!

Mark