![]() | ![]() | ![]() |
| | |||||||
| Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc. |
| | Thread Tools | Display Modes |
| | (permalink) |
| New Member | How i do for measuring Pulse Width in C langue? (Pic 16f628A) Any guy have a example? Last edited by autaorte; 2nd October 2007 at 06:35 PM. |
| | |
| | (permalink) |
| Experienced Member | I've never seriously messed with 16F628A interrupts to measure pulse widths, but for a AVR I'd set an interrupt pin to trigger on both edges, and simply measure how many clock ticks with a timer it stays in each state. For the 628A it looks like PORTB has an interrupt option on state change. You can probably use one of portb 7:4 to do something similar. If you're out of resources you may have to use a tight loop to check if the port changed state or not, I'd probably avoid this method unless the pulse widths are quite a bit longer than several instruction cycle time. |
| | |
| | (permalink) |
| New Member | I have a few examples measuring 1 to 2ms pulses on my site. See 'pulse width', 'port mirror', 'lvc1' and 'lvc2' here: http://www.flyelectric.ukgateway.net...buildingblocks Regards, David. |
| | |
| | (permalink) |
| Experienced Member | The hardware will do it for you. Read the section in the data sheet on the CCP module. Mike. |
| | |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
| |
| | ||||
| Thread | Thread Starter | Forum | Replies | Latest |
| Problem measuring pulse width - 12F683 TMR1, 8MHz | jess | Micro Controllers | 18 | 5th February 2007 10:00 AM |
| Measuring Pulse width modulation PWM | walters | General Electronics Chat | 44 | 12th June 2005 08:37 PM |
| detecting pulse width using PIC | mr. mister | Micro Controllers | 4 | 11th April 2005 01:16 PM |
| measure pulse width with a counter...other ways?? | xmat | Electronic Projects Design/Ideas/Reviews | 7 | 6th April 2005 08:05 AM |
| Pulse Width Calculation | waqar | Micro Controllers | 1 | 25th June 2003 11:53 AM |