Electronic Projects, forums and more.

Go Back   Electronic Circuits Projects Diagrams Free > Electronics Categories > Micro Controllers


Micro Controllers Discuss all aspects of micro controllers - building them, coding them, etc. All controllers are welcome - PIC, BASIC, Z8 Encore!, etc.

Reply
 
Thread Tools Display Modes
Old 2nd October 2007, 06:33 PM   (permalink)
New Member
autaorte is on a distinguished road
Default Measuring Pulse width

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.
autaorte is offline   Reply With Quote
Old 3rd October 2007, 01:55 AM   (permalink)
Experienced Member
boxer4 is an unknown quantity at this point
Default

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.
boxer4 is offline   Reply With Quote
Old 3rd October 2007, 02:23 PM   (permalink)
New Member
DavidT is on a distinguished road
Default

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.
DavidT is offline   Reply With Quote
Old 3rd October 2007, 02:38 PM   (permalink)
Experienced Member
Pommie is a splendid one to beholdPommie is a splendid one to beholdPommie is a splendid one to beholdPommie is a splendid one to beholdPommie is a splendid one to beholdPommie is a splendid one to beholdPommie is a splendid one to beholdPommie is a splendid one to behold
Default

The hardware will do it for you. Read the section in the data sheet on the CCP module.

Mike.
Pommie is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes


Similar Threads
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



All times are GMT. The time now is 10:36 AM.


Electronic Circuits  |  Radio Controlled
Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.