measuring pulse widths

Questions on other types of hardware and getting it talking to the ARM CPU
Post Reply
YahooArchive
Posts: 1462
Joined: Fri Oct 19, 2012 5:11 am

measuring pulse widths

Post by YahooArchive »

>from the help line
>What is the best way to measure pulse widths - ON pulse width and OFF pulse
width - in a pulse width modulated stream? Can you sketch a basic skeletal code?
In my case, the ON or OFF pulse can last anywhere from 500 us to 10 ms and the
pulse width carries the information.

There are built in functions that use the CPU to measure the widths. These
follow the PBASIC PULSIN function.

As these consume the CPU, they don't work for all applications.

The LPC2103 also has timer/counter hardware that can be engaged to capture a
count when pins transition. With BASIC you can read/write these registers
directly.

HWPWM uses this hardware to generate pulses, but we have not written an example
to show pulse capture.

In addition the BASIC compiler now supports general interrupts, so they can be
used when the capture occurs.

Details on the hardware are in the NXP user manual for the LPC2103.



YahooArchive
Posts: 1462
Joined: Fri Oct 19, 2012 5:11 am

Re: measuring pulse widths

Post by YahooArchive »

I use an Oscilloscope......cheap secondhand ones can be found on ebay, as can
new cheap Chinese ones (never used personally!)

Greetings from

Andy Mathison

Post Reply