Hi J, > Does anyone have any code examples of how I can use a LPC2138 to detect > the width of the positive pulse in a PWM signal. I know I can use the > timer circuit and detect the rising and falling edges do some math and > determine the width. I am very new to micro controllers and some code > examples or guidance would be greatly appreciated. For some theory take a look at this Atmel application note: AVR135: Using Timer Capture to Measure PWM Duty Cycle (12 pages, revision A, updated 10/05) Found here: http://www.atmel.com/dyn/products/app_notes.asp?family_id=607 As for the LPC2100 you would use the Capture feature of the Timer peripheral. Setup timer to generate an interrupt on capture pin leading or trailing edge. In the interrupt routine read the capture register value and pass it on to your algorithm. Be sure to read the correct section of the errata sheet related to TIMER. Joel
Message
RE: [lpc2000] PWM width detection
2006-02-18 by Joel Winarske
Attachments
- No local attachments were found for this message.