transmit PWM / but how to receive PWM

Go To Last Post
4 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have made pwm transmission(with help of expert) but I don't know how to receive this signal with an AT90S2313
can someone tell me how to receive pwm signal and how to decode them!!

thx
greetz
franskelol

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

franskelol wrote:
I have made pwm transmission(with help of expert) but I don't know how to receive this signal with an AT90S2313
can someone tell me how to receive pwm signal and how to decode them!!

thx
greetz
franskelol

Ok Friend listen. An easy method to do this is using a timer/counter. According to the Period time of the PWM you want to read, you choose the timer (16 bits or 8 bits). Choosing a prescaller 1/1 you decrease the inaccuracy.

First off all you have to wait for a falling edge at your PWM pin. After this you have to wait for a rising edge. At the time you read the first rising edge you must turn on your timer.

Now your timer is timing and you wait until the first falling edge off the PWM signal. When this occured save the T/Cs contents in a byte (or word). Now you have the Positive Width time but don't stop the timer until the first rising edge. When this occured save again the T/C contents in another byte (or word). And now you have the period time of the PWM.

Dividing the first byte (or word) by the second you calculate the PWMs Duty Cycle.

It's so easy. keep On.

Good Night, Icarus

Michael.

User of:
IAR Embedded Workbench C/C++ Compiler
Altium Designer

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

franskelol wrote:
I have made pwm transmission(with help of expert) but I don't know how to receive this signal with an AT90S2313
can someone tell me how to receive pwm signal and how to decode them!!

thx
greetz
franskelol

Ok Friend listen. An easy method to do this is using a timer/counter. According to the Period time of the PWM you want to read, you choose the timer (16 bits or 8 bits). Choosing a prescaller 1/1 you decrease the inaccuracy.

First off all you have to wait for a falling edge at your PWM pin. After this you have to wait for a rising edge. At the time you read the first rising edge you must turn on your timer.

Now your timer is timing and you wait until the first falling edge off the PWM signal. When this occured save the T/Cs contents in a byte (or word). Now you have the Positive Width time but don't stop the timer until the first rising edge. When this occured save again the T/C contents in another byte (or word). And now you have the period time of the PWM.

Dividing the first byte (or word) by the second you calculate the PWMs Duty Cycle.

It's so easy. keep On.

Good Night, Icarus

Michael.

User of:
IAR Embedded Workbench C/C++ Compiler
Altium Designer

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Another alternative, which may be is easier, but less precise, is to pass the PWM signal by a low pass filter (a simple RC network plus a buffer will do the trick), and read the value with the ADC.

The mean value of the PWM signal is proportional to the modulation of the PWM signal, which is the output of the filter.

Regards,
Alejandro.
http://www.ocam.cl