caramoan tour package

caramoan tour package

Author Topic: How to capture PWM input w/o use of CCP module in DSPIC30f4011?  (Read 204 times)

Offline vaia-riseng

  • LR44 Battery
  • *
  • Posts: 6
  • Pogi/Ganda Points: 0
How to capture PWM input w/o use of CCP module in DSPIC30f4011?
« on: December 01, 2011, 03:12:15 PM »
Hi! Does anyone know how to capture PWM input using DSPIC30f4011 without the use of CCP module? For example, gagamit lang ako ng GPIO pin pero yung function nung pin na yun ay macapture ung PWM input. Ang gusto ko po sana gawin malaman lang kung may PWM input na pumapasok sa pin na yun or wala. Thanks po very much sa help! :) ???

Philippine Electronics Forum

How to capture PWM input w/o use of CCP module in DSPIC30f4011?
« on: December 01, 2011, 03:12:15 PM »

Offline RiDdLeR???

  • Hydroelectric
  • ***
  • Posts: 3033
  • Pogi/Ganda Points: 208
Re: How to capture PWM input w/o use of CCP module in DSPIC30f4011?
« Reply #1 on: December 01, 2011, 03:45:44 PM »
Gagamit ka ng interrupt on change at magse-set ng timer  .... di ko alam sa DSPIC kung anong port ito pero sa PIC16, karaniwan sa PORTB ito located.

Philippine Electronics Forum

Re: How to capture PWM input w/o use of CCP module in DSPIC30f4011?
« Reply #1 on: December 01, 2011, 03:45:44 PM »

Offline insomartin

  • Technical People
  • Nuclear Reactor
  • *****
  • Posts: 4839
  • Pogi/Ganda Points: 321
  • Gender: Male
  • Nalulunod lang...
Re: How to capture PWM input w/o use of CCP module in DSPIC30f4011?
« Reply #2 on: December 01, 2011, 05:24:20 PM »
Question. kaano kabilis ang pwm mo? humidity sensor ba?

Philippine Electronics Forum

Re: How to capture PWM input w/o use of CCP module in DSPIC30f4011?
« Reply #2 on: December 01, 2011, 05:24:20 PM »

Offline insomartin

  • Technical People
  • Nuclear Reactor
  • *****
  • Posts: 4839
  • Pogi/Ganda Points: 321
  • Gender: Male
  • Nalulunod lang...
Re: How to capture PWM input w/o use of CCP module in DSPIC30f4011?
« Reply #3 on: December 01, 2011, 05:41:11 PM »
if you're capturing...
*fan speed
*engine speed
*humidity sensor
*heart rate
or in the range of micro seconds...
pwede na software capture.

just edge detect/trigger, count lang pwede na.

Philippine Electronics Forum

Re: How to capture PWM input w/o use of CCP module in DSPIC30f4011?
« Reply #3 on: December 01, 2011, 05:41:11 PM »

Offline vaia-riseng

  • LR44 Battery
  • *
  • Posts: 6
  • Pogi/Ganda Points: 0
Re: How to capture PWM input w/o use of CCP module in DSPIC30f4011?
« Reply #4 on: December 01, 2011, 10:11:42 PM »
Hi! Thank you po sa replies. Naisip ko na gumamit ng Change Notification input pero simultaneous monitoring po kasi kelangan ko and isang interrupt lang po kayang i-serve ng dsPIC for Change Notification inputs.

Dun po sa input, PWM signals din galing isa pang microcontroller, from approximately 1kHz to 5kHz with different duty cycles. So yun po, panu po mag software capture? Alam ko po kung pano mag-capture ng constant high (100% duty cycle) na signal, pero medyo lost po ako kung PWM or may varying duty cycle yung input. Thank you very much po ulit sa help! :)

Philippine Electronics Forum

Re: How to capture PWM input w/o use of CCP module in DSPIC30f4011?
« Reply #4 on: December 01, 2011, 10:11:42 PM »

Offline insomartin

  • Technical People
  • Nuclear Reactor
  • *****
  • Posts: 4839
  • Pogi/Ganda Points: 321
  • Gender: Male
  • Nalulunod lang...
Re: How to capture PWM input w/o use of CCP module in DSPIC30f4011?
« Reply #5 on: December 01, 2011, 10:32:24 PM »
kaya pa din yan via software, since 200uS lang naman ang assumed max 5khz Frequency mo.
in terms... in 1ms. you could capture five signals.

baka naman pwede ka mag post nang schematic diagram and ano ba ang kinacapture mo.

* naguguluhan ako... 1khz to 5khz then nagiiba din ang duty cycle?! saan signal ito? i'm so curious. 

Offline RiDdLeR???

  • Hydroelectric
  • ***
  • Posts: 3033
  • Pogi/Ganda Points: 208
Re: How to capture PWM input w/o use of CCP module in DSPIC30f4011?
« Reply #6 on: December 01, 2011, 10:51:52 PM »
Do you want to measure the pwm signal or do you just want to verify if there is pwm signal present?

If you just want to check if there is pwm signal present at the input w/o the need to measure the period and duty cylcle, simple timer interrupt lang kailangan.  Yung pwm signal mo is 1KHz-5KHz, which means 0.2ms~1ms, setup a timer interrupt for every 1.1ms and check if the input has changed state during the interrupt.

Or pwede din external interrupt (there are at least several external interrupt pins,  but its not as flexible as the interrupt on change.

Offline vaia-riseng

  • LR44 Battery
  • *
  • Posts: 6
  • Pogi/Ganda Points: 0
Re: How to capture PWM input w/o use of CCP module in DSPIC30f4011?
« Reply #7 on: December 02, 2011, 03:05:35 AM »
Thanks po again sa replies! At least 4 po yung kelangan kong i-monitor na PWM signal and galing sila sa isa pang microcontroller. Yung pong 1kHz to 5kHz with different duty cycles, i meant na dun po sa apat na yun, pedeng iba iba yung frequency at duty cycle nila from each other.

Yes, I just want to check if may PWM signal sa pins. Specifically, gusto ko pong macheck, for example, if there are 2 PWM signals simultaneously occuring on the different pins. And I will try the timer-based interrupt/software capture. I will update here once I've tried it. Thank you po ulit! :)

Philippine Electronics Forum

Re: How to capture PWM input w/o use of CCP module in DSPIC30f4011?
« Reply #7 on: December 02, 2011, 03:05:35 AM »

 

Privacy Policy

Contact Us: elabph@yahoo.com