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
 
Tools
Old 19th August 2003, 05:14 PM   #1
Default Need a program in Assembly that reads PWM

Hello,

I am doing a project that requires me to read a PWM signal generated by an Electronic Compass.

When the PIC16F877 reads the PWM signal from the compass it has to determine how long the PWM signal is Positive for the Duty Cycle.

I need the code in Assembly. I am not lazy or anything and I am willing to work with anyone who wants to help me with this.

The compass by the way is the Devantech CMPS03. And i am trying my best to avoid using the I2C and MSSP. This is why I want to be able to write a routine to read the PWM positive time for the Duty Cycle.

So any ideas on where to begin?

Yours Respectfully
Avin Sinanan
__________________
Yours Respectfully
Avin Sinanan
avinsinanan is offline  
Old 19th August 2003, 10:43 PM   #2
Default

Hi as i mentioned in an previous post where someone had to effectivly time the lenght of a low the easyest way is to use a TMRx register.

Set it to a incriment that will give u a suiteble level of acuracy, set an interupt for that pin, bit test on that pin, if its low, disable increment, you have ur value in the TMR register, if its high, clear it, and allow increment.
TheAnimus is offline  
Reply

Thread Tools
Display Modes




All times are GMT. The time now is 04:36 PM.


Electronic Circuits  |  Learning Electronics
eXTReMe Tracker